Gio.SettingsBackend
Description: Reference for Gio.SettingsBackend

### Class

# GioSettingsBackend

#### Description [src]

    abstract class Gio.SettingsBackend : GObject.Object
    {
      /* No available fields */
    }

The `GSettingsBackend` interface defines a generic interface for non-strictly-typed data that is stored in a hierarchy. To implement an alternative storage backend for `GSettings`, you need to implement the `GSettingsBackend` interface and then make it implement the extension point `G_SETTINGS_BACKEND_EXTENSION_POINT_NAME`.

The interface defines methods for reading and writing values, a method for determining if writing of certain values will fail (lockdown) and a change notification mechanism.

The semantics of the interface are very precisely defined and implementations must carefully adhere to the expectations of callers that are documented on each of the interface methods.

Some of the `GSettingsBackend` functions accept or return a `GTree`. These trees always have strings as keys and `GVariant` as values.

The `GSettingsBackend` API is exported to allow third-party implementations, but does not carry the same stability guarantees as the public GIO API. For this reason, you have to define the C preprocessor symbol `G_SETTINGS_ENABLE_BACKEND` before including `gio/gsettingsbackend.h`.

#### Ancestors

- GObject

#### Functions

###### g_settings_backend_flatten_tree

Calculate the longest common prefix of all keys in a tree and write out an array of the key names relative to that prefix and, optionally, the value to store at each of those keys.

since: 2.26

###### g_settings_backend_get_default

Returns the default `GSettingsBackend`. It is possible to override the default by setting the `GSETTINGS_BACKEND` environment variable to the name of a settings backend.

since: 2.28

#### Instance methods

###### g_settings_backend_changed

Signals that a single key has possibly changed. Backend implementations should call this if a key has possibly changed its value.

since: 2.26

###### g_settings_backend_changed_tree

This call is a convenience wrapper. It gets the list of changes from `tree`, computes the longest common prefix and calls g_settings_backend_changed().

since: 2.26

###### g_settings_backend_keys_changed

Signals that a list of keys have possibly changed. Backend implementations should call this if keys have possibly changed their values.

since: 2.26

###### g_settings_backend_path_changed

Signals that all keys below a given path may have possibly changed. Backend implementations should call this if an entire path of keys have possibly changed their values.

since: 2.26

###### g_settings_backend_path_writable_changed

Signals that the writability of all keys below a given path may have changed.

since: 2.26

###### g_settings_backend_writable_changed

Signals that the writability of a single key has possibly changed.

since: 2.26

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

#### Signals

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

#### Class structure

    struct GioSettingsBackendClass {
      GObjectClass parent_class;
      GVariant* (* read) (
        GSettingsBackend* backend,
        const gchar* key,
        const GVariantType* expected_type,
        gboolean default_value
      );
      gboolean (* get_writable) (
        GSettingsBackend* backend,
        const gchar* key
      );
      gboolean (* write) (
        GSettingsBackend* backend,
        const gchar* key,
        GVariant* value,
        gpointer origin_tag
      );
      gboolean (* write_tree) (
        GSettingsBackend* backend,
        GTree* tree,
        gpointer origin_tag
      );
      void (* reset) (
        GSettingsBackend* backend,
        const gchar* key,
        gpointer origin_tag
      );
      void (* subscribe) (
        GSettingsBackend* backend,
        const gchar* name
      );
      void (* unsubscribe) (
        GSettingsBackend* backend,
        const gchar* name
      );
      void (* sync) (
        GSettingsBackend* backend
      );
      GPermission* (* get_permission) (
        GSettingsBackend* backend,
        const gchar* path
      );
      GVariant* (* read_user_value) (
        GSettingsBackend* backend,
        const gchar* key,
        const GVariantType* expected_type
      );

    }

Class structure for `GSettingsBackend`.

###### Class members

`parent_class: GObjectClass`

  No description available.

`read: GVariant* (* read) ( GSettingsBackend* backend, const gchar* key, const GVariantType* expected_type, gboolean default_value )`

  Virtual method to read a key’s value.

`get_writable: gboolean (* get_writable) ( GSettingsBackend* backend, const gchar* key )`

  Virtual method to get if a key is writable.

`write: gboolean (* write) ( GSettingsBackend* backend, const gchar* key, GVariant* value, gpointer origin_tag )`

  Virtual method to change key’s value.

`write_tree: gboolean (* write_tree) ( GSettingsBackend* backend, GTree* tree, gpointer origin_tag )`

  Virtual method to change a tree of keys.

`reset: void (* reset) ( GSettingsBackend* backend, const gchar* key, gpointer origin_tag )`

  Virtual method to reset state.

`subscribe: void (* subscribe) ( GSettingsBackend* backend, const gchar* name )`

  Virtual method to subscribe to key changes.

`unsubscribe: void (* unsubscribe) ( GSettingsBackend* backend, const gchar* name )`

  Virtual method to unsubscribe to key changes.

`sync: void (* sync) ( GSettingsBackend* backend )`

  Virtual method to sync state.

`get_permission: GPermission* (* get_permission) ( GSettingsBackend* backend, const gchar* path )`

  Virtual method to get permission of a key.

`read_user_value: GVariant* (* read_user_value) ( GSettingsBackend* backend, const gchar* key, const GVariantType* expected_type )`

  Virtual method to read user’s key value.

#### Virtual methods

###### Gio.SettingsBackendClass.get_permission

Virtual method to get permission of a key.

###### Gio.SettingsBackendClass.get_writable

Virtual method to get if a key is writable.

###### Gio.SettingsBackendClass.read

Virtual method to read a key’s value.

###### Gio.SettingsBackendClass.read_user_value

Virtual method to read user’s key value.

###### Gio.SettingsBackendClass.reset

Virtual method to reset state.

###### Gio.SettingsBackendClass.subscribe

Virtual method to subscribe to key changes.

###### Gio.SettingsBackendClass.sync

Virtual method to sync state.

###### Gio.SettingsBackendClass.unsubscribe

Virtual method to unsubscribe to key changes.

###### Gio.SettingsBackendClass.write

Virtual method to change key’s value.

###### Gio.SettingsBackendClass.write_tree

Virtual method to change a tree of keys.