GConfClient (and GConfBridge) API conversion: GIO Reference Manual

## GConfClient (and GConfBridge) API conversion

Most people use GConf via the high-level GConfClient API. The corresponding API is the GSettings object. While not every GConfClient function has a direct GSettings equivalent, many do:

Table 3.

GConfClient | GSettings
--- | ---
`gconf_client_get_default()` | no direct equivalent, instead you call `g_settings_new()` for the schemas you use
`gconf_client_set()` | `g_settings_set()`
`gconf_client_get()` | `g_settings_get()`
`gconf_client_get_bool()` | `g_settings_get_boolean()`
`gconf_client_set_bool()` | `g_settings_set_boolean()`
`gconf_client_get_int()` | `g_settings_get_int()`
`gconf_client_set_int()` | `g_settings_set_int()`
`gconf_client_get_float()` | `g_settings_get_double()`
`gconf_client_set_float()` | `g_settings_set_double()`
`gconf_client_get_string()` | `g_settings_get_string()`
`gconf_client_set_string()` | `g_settings_set_string()`
`gconf_client_get_list()` | for string lists, see `g_settings_get_strv()`, else see `g_settings_get_value()` and GVariant API
`gconf_client_set_list()` | for string lists, see `g_settings_set_strv()`, else see `g_settings_set_value()` and GVariant API
`gconf_entry_get_is_writable()` | `g_settings_is_writable()`
`gconf_client_notify_add()` | not required, the “changed” signal is emitted automatically
`gconf_client_add_dir()` | not required, each GSettings instance automatically watches all keys in its path
GConfChangeSet | `g_settings_delay()`, `g_settings_apply()`
`gconf_client_get_default_from_schema()` | no equivalent, applications are expected to know their schema
`gconf_client_all_entries()` | no equivalent, applications are expected to know their schema, and GSettings does not allow schema-less entries
`gconf_client_get_without_default()` | no equivalent
`gconf_bridge_bind_property()` | `g_settings_bind()`
`gconf_bridge_bind_property_full()` | `g_settings_bind_with_mapping()`

GConfBridge was a third-party library that used GConf to bind an object property to a particular configuration key. GSettings offers this service itself.

There is a pattern that is sometimes used for GConf, where a setting can have explicit 'value A', explicit 'value B' or 'use the system default'. With GConf, 'use the system default' is sometimes implemented by unsetting the user value.

This is not possible in GSettings, since it does not have API to determine if a value is the default and does not let you unset values. The recommended way (and much clearer) way in which this can be implemented in GSettings is to have a separate 'use-system-default' boolean setting.