## IBusConfig IBusConfig — IBus engine configuration module. |

## Synopsis

    struct              IBusConfig;
    struct              IBusConfigClass;
    IBusConfig *        ibus_config_new                     (GDBusConnection *connection,
                                                             GCancellable *cancellable,
                                                             GError **error);
    void                ibus_config_new_async               (GDBusConnection *connection,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    IBusConfig *        ibus_config_new_async_finish        (GAsyncResult *res,
                                                             GError **error);
    GVariant *          ibus_config_get_value               (IBusConfig *config,
                                                             const gchar *section,
                                                             const gchar *name);
    void                ibus_config_get_value_async         (IBusConfig *config,
                                                             const gchar *section,
                                                             const gchar *name,
                                                             gint timeout_ms,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    GVariant *          ibus_config_get_value_async_finish  (IBusConfig *config,
                                                             GAsyncResult *result,
                                                             GError **error);
    GVariant *          ibus_config_get_values              (IBusConfig *config,
                                                             const gchar *section);
    void                ibus_config_get_values_async        (IBusConfig *config,
                                                             const gchar *section,
                                                             gint timeout_ms,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    GVariant *          ibus_config_get_values_async_finish (IBusConfig *config,
                                                             GAsyncResult *result,
                                                             GError **error);
    gboolean            ibus_config_set_value               (IBusConfig *config,
                                                             const gchar *section,
                                                             const gchar *name,
                                                             GVariant *value);
    void                ibus_config_set_value_async         (IBusConfig *config,
                                                             const gchar *section,
                                                             const gchar *name,
                                                             GVariant *value,
                                                             gint timeout_ms,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            ibus_config_set_value_async_finish  (IBusConfig *config,
                                                             GAsyncResult *result,
                                                             GError **error);
    gboolean            ibus_config_unset                   (IBusConfig *config,
                                                             const gchar *section,
                                                             const gchar *name);
    gboolean            ibus_config_watch                   (IBusConfig *config,
                                                             const gchar *section,
                                                             const gchar *name);
    gboolean            ibus_config_unwatch                 (IBusConfig *config,
                                                             const gchar *section,
                                                             const gchar *name);

## Object Hierarchy

      GObject
       +----GDBusProxy
             +----IBusProxy
                   +----IBusConfig

## Implemented Interfaces

IBusConfig implements GDBusInterface, GInitable and GAsyncInitable.

## Signals

      "value-changed"                                  : Run Last

## Description

An IBusConfig provides engine configuration methods such as get and set the configure settings to configuration file.

Currently, IBusConfig supports gconf.

## Details

### struct IBusConfig

    struct IBusConfig;

An opaque data type representing an IBusConfig.

### struct IBusConfigClass

    struct IBusConfigClass {
    };

### ibus_config_new ()

    IBusConfig *        ibus_config_new                     (GDBusConnection *connection,
                                                             GCancellable *cancellable,
                                                             GError **error);

New an IBusConfig from existing GDBusConnection.

`connection` : | A GDBusConnection.
Returns : | An newly allocated IBusConfig corresponding to `connection`.

### ibus_config_new_async ()

    void                ibus_config_new_async               (GDBusConnection *connection,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

New an IBusConfig asynchronously.

`connection` : | An GDBusConnection.
`cancellable` : | A GCancellable or `NULL`.
`callback` : | A GAsyncReadyCallback to call when the request is satisfied. The callback should not be `NULL`.
`user_data` : | The data to pass to callback.

### ibus_config_new_async_finish ()

    IBusConfig *        ibus_config_new_async_finish        (GAsyncResult *res,
                                                             GError **error);

`returns`: A newly allocated IBusConfig.

Finishes an operation started with `ibus_config_new_async()`.

`res` : | A GAsyncResult obtained from the GAsyncReadyCallback pass to `ibus_config_new_async()`.
`error` : | Return location for error or `NULL`.

### ibus_config_get_value ()

    GVariant *          ibus_config_get_value               (IBusConfig *config,
                                                             const gchar *section,
                                                             const gchar *name);

Get the value of a configuration option synchronously.

GConf stores configure options in a tree-like structure, and the IBus related setting is at /desktop/ibus, thus, `section` here is a path from there, while `name` is the key of that configuration option.

ibus-chewing, for example, stores its setting in /desktop/ibus/engine/Chewing, so the section name for it is "engine/Chewing". See also: `ibus_config_set_value()`.

`config` : | An IBusConfig
`section` : | Section name of the configuration option.
`name` : | Name of the configure option.
Returns : | A GVariant or `NULL`. Free with `g_variant_unref()`.

### ibus_config_get_value_async ()

    void                ibus_config_get_value_async         (IBusConfig *config,
                                                             const gchar *section,
                                                             const gchar *name,
                                                             gint timeout_ms,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Get the value of a configuration option asynchronously.

See also: `ibus_config_get_value()`.

`config` : | An IBusConfig
`section` : | Section name of the configuration option.
`name` : | Name of the configure option.
`timeout_ms` : | The timeout in milliseconds or -1 to use the default timeout.
`cancellable` : | A GCancellable or `NULL`.
`callback` : | Callback function to invoke when the return value is ready.
`user_data` : | The data to pass to callback.

### ibus_config_get_value_async_finish ()

    GVariant *          ibus_config_get_value_async_finish  (IBusConfig *config,
                                                             GAsyncResult *result,
                                                             GError **error);

Finish get value of a configuration option.

See also: `ibus_config_get_value_async()`.

`config` : | A IBusConfig.
`result` : | A GAsyncResult.
`error` : | Return location for error or `NULL`.
Returns : | A GVariant or `NULL` if error is set. Free with `g_variant_unref()`.

### ibus_config_get_values ()

    GVariant *          ibus_config_get_values              (IBusConfig *config,
                                                             const gchar *section);

Get all values in a section synchronously.

See also: `ibus_config_set_value()`.

`config` : | An IBusConfig
`section` : | Section name of the configuration option.
Returns : | A GVariant or `NULL`. Free with `g_variant_unref()`.

### ibus_config_get_values_async ()

    void                ibus_config_get_values_async        (IBusConfig *config,
                                                             const gchar *section,
                                                             gint timeout_ms,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Get all values in a section asynchronously.

See also: `ibus_config_get_values()`.

`config` : | An IBusConfig
`section` : | Section name of the configuration option.
`timeout_ms` : | The timeout in milliseconds or -1 to use the default timeout.
`cancellable` : | A GCancellable or `NULL`.
`callback` : | Callback function to invoke when the return value is ready.
`user_data` : | The data to pass to callback.

### ibus_config_get_values_async_finish ()

    GVariant *          ibus_config_get_values_async_finish (IBusConfig *config,
                                                             GAsyncResult *result,
                                                             GError **error);

Finish get values in a section.

See also: `ibus_config_get_values_async()`.

`config` : | A IBusConfig.
`result` : | A GAsyncResult.
`error` : | Return location for error or `NULL`.
Returns : | A GVariant or `NULL` if error is set. Free with `g_variant_unref()`.

### ibus_config_set_value ()

    gboolean            ibus_config_set_value               (IBusConfig *config,
                                                             const gchar *section,
                                                             const gchar *name,
                                                             GVariant *value);

Set the value of a configuration option synchronously. See also: `ibus_config_get_value()`.

`config` : | An IBusConfig
`section` : | Section name of the configuration option.
`name` : | Name of the configure option its self.
`value` : | A GVariant that holds the value. If the value is floating, the function takes ownership of it.
Returns : | `TRUE` if succeed; `FALSE` otherwise.

### ibus_config_set_value_async ()

    void                ibus_config_set_value_async         (IBusConfig *config,
                                                             const gchar *section,
                                                             const gchar *name,
                                                             GVariant *value,
                                                             gint timeout_ms,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Set the value of a configuration option asynchronously.

See also: `ibus_config_set_value()`.

`config` : | An IBusConfig
`section` : | Section name of the configuration option.
`name` : | Name of the configure option.
`value` : | A GVariant that holds the value. If the value is floating, the function takes ownership of it.
`timeout_ms` : | The timeout in milliseconds or -1 to use the default timeout.
`cancellable` : | A GCancellable or `NULL`.
`callback` : | Callback function to invoke when the return value is ready.
`user_data` : | The data to pass to callback.

### ibus_config_set_value_async_finish ()

    gboolean            ibus_config_set_value_async_finish  (IBusConfig *config,
                                                             GAsyncResult *result,
                                                             GError **error);

Finish set value of a configuration option.

See also: `ibus_config_set_value_async()`.

`config` : | A IBusConfig.
`result` : | A GAsyncResult.
`error` : | Return location for error or `NULL`.
Returns : | `TRUE` or `FALSE` if error is set.

### ibus_config_unset ()

    gboolean            ibus_config_unset                   (IBusConfig *config,
                                                             const gchar *section,
                                                             const gchar *name);

Remove an entry of a configuration option. See also: `ibus_config_get_value()`.

`config` : | An IBusConfig
`section` : | Section name of the configuration option.
`name` : | Name of the configure option its self.
Returns : | `TRUE` if succeed; `FALSE` otherwise.

### ibus_config_watch ()

    gboolean            ibus_config_watch                   (IBusConfig *config,
                                                             const gchar *section,
                                                             const gchar *name);

Subscribe to the configuration option change notification.

Until this function is called, every change will be notified to the client through "value-changed" signal. Clients should call `ibus_config_watch()` with the sections they are interested in, to reduce the number of D-Bus messages.

See also: `ibus_config_unwatch()`.

`config` : | An IBusConfig
`section` : | Section name of the configuration option. [allow-none]
`name` : | Name of the configure option its self. [allow-none]
Returns : | `TRUE` if succeed; `FALSE` otherwise.

### ibus_config_unwatch ()

    gboolean            ibus_config_unwatch                 (IBusConfig *config,
                                                             const gchar *section,
                                                             const gchar *name);

Unsubscribe from the configuration option change notification.

See also: ibus_config_watch.

`config` : | An IBusConfig
`section` : | Section name of the configuration option. [allow-none]
`name` : | Name of the configure option its self. [allow-none]
Returns : | `TRUE` if succeed; `FALSE` otherwise.

## Signal Details

### The `"value-changed"` signal

    void                user_function                      (IBusConfig *config,
                                                            gchar      *section,
                                                            gchar      *name,
                                                            GVariant   *value,
                                                            gpointer    user_data)      : Run Last

Emitted when configuration value is changed.

### Note

Argument `user_data` is ignored in this function.

`config` : | An IBusConfig.
`section` : | Section name.
`name` : | Name of the property.
`value` : | Value.
`user_data` : | user data set when the signal handler was connected.