SettingsSchema

The GSettingsSchemaSource and GSettingsSchema APIs provide a mechanism for advanced control over the loading of schemas and a mechanism for introspecting their content.

Plugin loading systems that wish to provide plugins a way to access settings face the problem of how to make the schemas for these settings visible to GSettings. Typically, a plugin will want to ship the schema along with itself and it won't be installed into the standard system directories for schemas.

GSettingsSchemaSource provides a mechanism for dealing with this by allowing the creation of a new 'schema source' from which schemas can be acquired. This schema source can then become part of the metadata associated with the plugin and queried whenever the plugin requires access to some settings.

Consider the following example:

The code above shows how hooks should be added to the code that initialises (or enables) the plugin to create the schema source and how an API can be added to the plugin system to provide a convenient way for the plugin to access its settings, using the schemas that it ships.

From the standpoint of the plugin, it would need to ensure that it ships a gschemas.compiled file as part of itself, and then simply do the following:

It's also possible that the plugin system expects the schema source files (ie: .gschema.xml files) instead of a gschemas.compiled file. In that case, the plugin loading system must compile the schemas for itself before attempting to create the settings source.

Constructors

this
this(GSettingsSchema* gSettingsSchema)

Sets our main struct and passes it to the parent class

Destructor

~this
~this()
Undocumented in source.

Members

Functions

doref
SettingsSchema doref()

Increase the reference count of schema, returning a new reference. Since 2.32

getId
string getId()

Get the ID of schema.

getPath
string getPath()

Gets the path associated with schema, or NULL. Schemas may be single-instance or relocatable. Single-instance schemas correspond to exactly one set of keys in the backend database: those located at the path returned by this function. Relocatable schemas can be referenced by other schemas and can threfore describe multiple sets of keys at different locations. For relocatable schemas, this function will return NULL. Since 2.32

getSettingsSchemaStruct
GSettingsSchema* getSettingsSchemaStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
getStruct
void* getStruct()

the main Gtk struct as a void*

unref
void unref()

Decrease the reference count of schema, possibly freeing it. Since 2.32

Variables

gSettingsSchema
GSettingsSchema* gSettingsSchema;

the main Gtk struct

Inherited Members

From Boxed

boxedCopy
void* boxedCopy(GType boxedType, void* srcBoxed)

Provide a copy of a boxed structure src_boxed which is of type boxed_type.

boxedFree
void boxedFree(GType boxedType, void* boxed)

Free the boxed structure boxed which is of type boxed_type.

boxedTypeRegisterStatic
GType boxedTypeRegisterStatic(string name, GBoxedCopyFunc boxedCopy, GBoxedFreeFunc boxedFree)

This function creates a new G_TYPE_BOXED derived type id for a new boxed type with name name. Boxed type handling functions have to be provided to copy and free opaque boxed structures of this type.

pointerTypeRegisterStatic
GType pointerTypeRegisterStatic(string name)

Creates a new G_TYPE_POINTER derived type id for a new pointer type with name name.

Meta