IBusRegistry

## IBusRegistry IBusRegistry — Registry cache handling. |

## Stability Level

Stable, unless otherwise indicated

## Synopsis

    struct              IBusRegistry;
    struct              IBusRegistryClass;
    IBusRegistry *      ibus_registry_new                   (void);
    void                ibus_registry_load                  (IBusRegistry *registry);
    void                ibus_registry_load_in_dir           (IBusRegistry *registry,
                                                             const gchar *dirname);
    gboolean            ibus_registry_load_cache            (IBusRegistry *registry,
                                                             gboolean is_user);
    gboolean            ibus_registry_load_cache_file       (IBusRegistry *registry,
                                                             const gchar *filename);
    gboolean            ibus_registry_save_cache            (IBusRegistry *registry,
                                                             gboolean is_user);
    gboolean            ibus_registry_save_cache_file       (IBusRegistry *registry,
                                                             const gchar *filename);
    void                ibus_registry_output                (IBusRegistry *registry,
                                                             GString *output,
                                                             int indent);
    gboolean            ibus_registry_check_modification    (IBusRegistry *registry);
    GList *             ibus_registry_get_components        (IBusRegistry *registry);
    GList *             ibus_registry_get_observed_paths    (IBusRegistry *registry);
    void                ibus_registry_start_monitor_changes (IBusRegistry *registry);

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----IBusObject
                   +----IBusSerializable
                         +----IBusRegistry

## Signals

      "changed"                                        : Run Last

## Description

An IBusRegistry loads IBus component files and generates the cache files.

see_also: IBusComponent

## Details

### struct IBusRegistry

    struct IBusRegistry;

Registry cache handling. You can load the registry from compose files or a cache file.

### struct IBusRegistryClass

    struct IBusRegistryClass {
        /* class members */
    };

### ibus_registry_new ()

    IBusRegistry *      ibus_registry_new                   (void);

New a IBusRegistry

Returns : | A newly allocated IBusRegistry.

### ibus_registry_load ()

    void                ibus_registry_load                  (IBusRegistry *registry);

Read all XML files in a IBus component directory (typically /usr/share/ibus/component/ *.xml) and update the registry object. IBUS_COMPONENT_PATH environment valuable is also available for the custom component directories, whose delimiter is ':'.

`registry` : | An IBusRegistry.

### ibus_registry_load_in_dir ()

    void                ibus_registry_load_in_dir           (IBusRegistry *registry,
                                                             const gchar *dirname);

Read all XML files in `dirname`, create a IBusComponent object for each file, and add the component objects to the registry. If `dirname` is "/usr/share/ibus/component", this API and `ibus_registry_load()` are same.

`registry` : | An IBusRegistry.
`dirname` : | IBus component directory which includes XML files.

### ibus_registry_load_cache ()

    gboolean            ibus_registry_load_cache            (IBusRegistry *registry,
                                                             gboolean is_user);

Load the user or system registry cache.

`registry` : | An IBusRegistry.
`is_user` : | `TRUE` if the registry cache is loaded in the user directory.
Returns : | `TRUE` if the cache exists and is loaded successfully, `FALSE` otherwise.

### ibus_registry_load_cache_file ()

    gboolean            ibus_registry_load_cache_file       (IBusRegistry *registry,
                                                             const gchar *filename);

Load the registry cache `filename`.

`registry` : | An IBusRegistry.
`filename` : | The file path of the registry cache
Returns : | `TRUE` if the cache exists and is loaded successfully, `FALSE` otherwise.

### ibus_registry_save_cache ()

    gboolean            ibus_registry_save_cache            (IBusRegistry *registry,
                                                             gboolean is_user);

Save the registry in a user directory or system directory.

`registry` : | An IBusRegistry.
`is_user` : | `TRUE` if the registry cache is saved in the user directory.
Returns : | `TRUE` if the cache is saved successfully, `FALSE` otherwise.

### ibus_registry_save_cache_file ()

    gboolean            ibus_registry_save_cache_file       (IBusRegistry *registry,
                                                             const gchar *filename);

Save the registry cache `filename`.

`registry` : | An IBusRegistry.
`filename` : | The file path of the registry cache
Returns : | `TRUE` if the cache is saved successfully, `FALSE` otherwise.

### ibus_registry_output ()

    void                ibus_registry_output                (IBusRegistry *registry,
                                                             GString *output,
                                                             int indent);

Output IBusRegistry as an XML-formatted string. The output string can be then shown on the screen or written to file.

`registry` : | An IBusRegistry.
`output` : | GString that holds the result.
`indent` : | level of indent.

### ibus_registry_check_modification ()

    gboolean            ibus_registry_check_modification    (IBusRegistry *registry);

Check if the registry is updated.

`registry` : | An IBusRegistry.
Returns : | `TRUE` if mtime is changed; `FALSE` otherwise.

### ibus_registry_get_components ()

    GList *             ibus_registry_get_components        (IBusRegistry *registry);

List components.

`registry` : | An IBusRegistry.
Returns : | a list of IBusComponent objects. The caller has to call `g_list_free()` for the returned list. [transfer container][element-type IBusComponent]

### ibus_registry_get_observed_paths ()

    GList *             ibus_registry_get_observed_paths    (IBusRegistry *registry);

List observed paths.

`registry` : | An IBusRegistry.
Returns : | a list of IBusObservedPath objects. The caller has to call `g_list_free()` for the returned list. [transfer container][element-type IBusObservedPath]

### ibus_registry_start_monitor_changes ()

    void                ibus_registry_start_monitor_changes (IBusRegistry *registry);

Start to monitor observed paths.

`registry` : | An IBusRegistry.

## Signal Details

### The `"changed"` signal

    void                user_function                      (IBusRegistry *registry,
                                                            gpointer      user_data)      : Run Last

Emitted when any observed paths are changed. A method is not associated in this class. the "changed" signal would be handled in other classes.

See also: `ibus_registry_start_monitor_changes()`.

`registry` : | An IBusRegistry.
`user_data` : | user data set when the signal handler was connected.