SettingsBackend

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. g_settings_backend_create_tree() is a convenience function to create suitable trees.

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.

Constructors

this
this(GSettingsBackend* gSettingsBackend, bool ownedRef = false)

Sets our main struct and passes it to the parent class.

Members

Functions

changed
void changed(string key, void* originTag)

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

changedTree
void changedTree(BBTree tree, void* originTag)

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

getSettingsBackendStruct
GSettingsBackend* getSettingsBackendStruct(bool transferOwnership = false)

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

keysChanged
void keysChanged(string path, string[] items, void* originTag)

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

pathChanged
void pathChanged(string path, void* originTag)

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.

pathWritableChanged
void pathWritableChanged(string path)

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

writableChanged
void writableChanged(string key)

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

Static functions

flattenTree
void flattenTree(BBTree tree, out string path, out string[] keys, out Variant[] values)

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.

getDefault
SettingsBackend getDefault()

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.

getType
GType getType()
keyfileSettingsBackendNew
SettingsBackend keyfileSettingsBackendNew(string filename, string rootPath, string rootGroup)

Creates a keyfile-backed GSettingsBackend

memorySettingsBackendNew
SettingsBackend memorySettingsBackendNew()

Creates a memory-backed GSettingsBackend

nullSettingsBackendNew
SettingsBackend nullSettingsBackendNew()

Creates a readonly GSettingsBackend

Variables

gSettingsBackend
GSettingsBackend* gSettingsBackend;

the main Gtk struct