IBus Reference Manual: IBusRegistry

## IBusRegistry IBusRegistry — Registry cache handling. |

## Stability Level

Stable, unless otherwise indicated

## Functions

IBusRegistry * | ibus_registry_new ()
void | ibus_registry_load ()
void | ibus_registry_load_in_dir ()
gboolean | ibus_registry_load_cache ()
gboolean | ibus_registry_load_cache_file ()
gboolean | ibus_registry_save_cache ()
gboolean | ibus_registry_save_cache_file ()
void | ibus_registry_output ()
gboolean | ibus_registry_check_modification ()
GList * | ibus_registry_get_components ()
GList * | ibus_registry_get_observed_paths ()
void | ibus_registry_start_monitor_changes ()

## Signals

void | changed | Run Last

## Types and Values

struct | IBusRegistry

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── IBusObject
                ╰── IBusSerializable
                    ╰── IBusRegistry

## Description

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

see_also: IBusComponent

## Functions

### 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 ':'.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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` .

#### Parameters

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.

#### Parameters

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` .

#### Parameters

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.

#### Parameters

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.

#### Parameters

registry | An IBusRegistry. |

#### Returns

`TRUE` if mtime is changed; `FALSE` otherwise.

### ibus_registry_get_components ()

    GList *
    ibus_registry_get_components (IBusRegistry *registry);

List components.

#### Parameters

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.

#### Parameters

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.

#### Parameters

registry | An IBusRegistry. |

## Types and Values

### struct IBusRegistry

    struct IBusRegistry;

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

## Signal Details

### The `“changed”` signal

    void
    user_function (IBusRegistry *registry,
                   gpointer      user_data)

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()`.

#### Parameters

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

Flags: Run Last