gi-gio-2.0.9: Gio bindings

CopyrightWill Thompson, Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (garetxe@gmail.com)
Safe HaskellNone
LanguageHaskell2010

GI.Gio.Structs.SettingsSchema

Contents

Description

The 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:

|[language="C" -- typedef struct { ... GSettingsSchemaSource *schema_source; ... } Plugin;

Plugin * initialise_plugin (const gchar *dir) { Plugin *plugin;

...

plugin->schema_source = g_settings_new_schema_source_from_directory (dir, g_settings_schema_source_get_default (), FALSE, NULL);

...

return plugin; }

...

GSettings * plugin_get_settings (Plugin *plugin, const gchar *schema_id) { GSettingsSchema *schema;

if (schema_id == NULL) schema_id = plugin->identifier;

schema = g_settings_schema_source_lookup (plugin->schema_source, schema_id, FALSE);

if (schema == NULL) { ... disable the plugin or abort, etc ... }

return g_settings_new_full (schema, NULL, NULL); } ]|

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:

|[language="C" -- { GSettings *settings; gint some_value;

settings = plugin_get_settings (self, NULL); some_value = g_settings_get_int (settings, "some-value"); ... } ]|

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.

Synopsis

Exported types

newtype SettingsSchema Source #

Constructors

SettingsSchema (ManagedPtr SettingsSchema) 

Instances

BoxedObject SettingsSchema Source # 

Methods

boxedType :: SettingsSchema -> IO GType

((~) * info (ResolveSettingsSchemaMethod t SettingsSchema), MethodInfo * info SettingsSchema p) => IsLabel t (SettingsSchema -> p) Source # 

Methods

fromLabel :: Proxy# Symbol t -> SettingsSchema -> p #

((~) * info (ResolveSettingsSchemaMethod t SettingsSchema), MethodInfo * info SettingsSchema p) => IsLabelProxy t (SettingsSchema -> p) Source # 
HasAttributeList * SettingsSchema Source # 
((~) * signature (m ()), MonadIO m) => MethodInfo * SettingsSchemaUnrefMethodInfo SettingsSchema signature Source # 

Methods

overloadedMethod :: MethodProxy SettingsSchemaUnrefMethodInfo SettingsSchema -> signature -> s

((~) * signature (m SettingsSchema), MonadIO m) => MethodInfo * SettingsSchemaRefMethodInfo SettingsSchema signature Source # 

Methods

overloadedMethod :: MethodProxy SettingsSchemaRefMethodInfo SettingsSchema -> signature -> s

((~) * signature (m [Text]), MonadIO m) => MethodInfo * SettingsSchemaListKeysMethodInfo SettingsSchema signature Source # 

Methods

overloadedMethod :: MethodProxy SettingsSchemaListKeysMethodInfo SettingsSchema -> signature -> s

((~) * signature (m [Text]), MonadIO m) => MethodInfo * SettingsSchemaListChildrenMethodInfo SettingsSchema signature Source # 
((~) * signature (Text -> m Bool), MonadIO m) => MethodInfo * SettingsSchemaHasKeyMethodInfo SettingsSchema signature Source # 

Methods

overloadedMethod :: MethodProxy SettingsSchemaHasKeyMethodInfo SettingsSchema -> signature -> s

((~) * signature (m Text), MonadIO m) => MethodInfo * SettingsSchemaGetPathMethodInfo SettingsSchema signature Source # 

Methods

overloadedMethod :: MethodProxy SettingsSchemaGetPathMethodInfo SettingsSchema -> signature -> s

((~) * signature (Text -> m SettingsSchemaKey), MonadIO m) => MethodInfo * SettingsSchemaGetKeyMethodInfo SettingsSchema signature Source # 

Methods

overloadedMethod :: MethodProxy SettingsSchemaGetKeyMethodInfo SettingsSchema -> signature -> s

((~) * signature (m Text), MonadIO m) => MethodInfo * SettingsSchemaGetIdMethodInfo SettingsSchema signature Source # 

Methods

overloadedMethod :: MethodProxy SettingsSchemaGetIdMethodInfo SettingsSchema -> signature -> s

type AttributeList SettingsSchema Source # 
type AttributeList SettingsSchema

Methods

getId

data SettingsSchemaGetIdMethodInfo Source #

Instances

((~) * signature (m Text), MonadIO m) => MethodInfo * SettingsSchemaGetIdMethodInfo SettingsSchema signature Source # 

Methods

overloadedMethod :: MethodProxy SettingsSchemaGetIdMethodInfo SettingsSchema -> signature -> s

getKey

data SettingsSchemaGetKeyMethodInfo Source #

Instances

((~) * signature (Text -> m SettingsSchemaKey), MonadIO m) => MethodInfo * SettingsSchemaGetKeyMethodInfo SettingsSchema signature Source # 

Methods

overloadedMethod :: MethodProxy SettingsSchemaGetKeyMethodInfo SettingsSchema -> signature -> s

getPath

data SettingsSchemaGetPathMethodInfo Source #

Instances

((~) * signature (m Text), MonadIO m) => MethodInfo * SettingsSchemaGetPathMethodInfo SettingsSchema signature Source # 

Methods

overloadedMethod :: MethodProxy SettingsSchemaGetPathMethodInfo SettingsSchema -> signature -> s

hasKey

data SettingsSchemaHasKeyMethodInfo Source #

Instances

((~) * signature (Text -> m Bool), MonadIO m) => MethodInfo * SettingsSchemaHasKeyMethodInfo SettingsSchema signature Source # 

Methods

overloadedMethod :: MethodProxy SettingsSchemaHasKeyMethodInfo SettingsSchema -> signature -> s

listChildren

data SettingsSchemaListChildrenMethodInfo Source #

Instances

((~) * signature (m [Text]), MonadIO m) => MethodInfo * SettingsSchemaListChildrenMethodInfo SettingsSchema signature Source # 

listKeys

data SettingsSchemaListKeysMethodInfo Source #

Instances

((~) * signature (m [Text]), MonadIO m) => MethodInfo * SettingsSchemaListKeysMethodInfo SettingsSchema signature Source # 

Methods

overloadedMethod :: MethodProxy SettingsSchemaListKeysMethodInfo SettingsSchema -> signature -> s

ref

data SettingsSchemaRefMethodInfo Source #

Instances

((~) * signature (m SettingsSchema), MonadIO m) => MethodInfo * SettingsSchemaRefMethodInfo SettingsSchema signature Source # 

Methods

overloadedMethod :: MethodProxy SettingsSchemaRefMethodInfo SettingsSchema -> signature -> s

unref

data SettingsSchemaUnrefMethodInfo Source #

Instances

((~) * signature (m ()), MonadIO m) => MethodInfo * SettingsSchemaUnrefMethodInfo SettingsSchema signature Source # 

Methods

overloadedMethod :: MethodProxy SettingsSchemaUnrefMethodInfo SettingsSchema -> signature -> s