Gio.SettingsSchemaSource¶
Fields¶
None
Methods¶
class |
|
class |
|
|
|
|
|
|
|
|
Details¶
- class Gio.SettingsSchemaSource¶
This is an opaque structure type. You may not access it directly.
New in version 2.32.
- classmethod get_default()[source]¶
- Returns:
the default schema source
- Return type:
Gets the default system schema source.
This function is not required for normal uses of
Gio.Settings
but it may be useful to authors of plugin management systems or to those who want to introspect the content of schemas.If no schemas are installed,
None
will be returned.The returned source may actually consist of multiple schema sources from different directories, depending on which directories were given in
XDG_DATA_DIRS
andGSETTINGS_SCHEMA_DIR
. For this reason, all lookups performed against the default source should probably be done recursively.New in version 2.32.
- classmethod new_from_directory(directory, parent, trusted)[source]¶
- Parameters:
directory (
str
) – the filename of a directoryparent (
Gio.SettingsSchemaSource
orNone
) – aGio.SettingsSchemaSource
, orNone
- Raises:
- Return type:
Attempts to create a new schema source corresponding to the contents of the given directory.
This function is not required for normal uses of
Gio.Settings
but it may be useful to authors of plugin management systems.The directory should contain a file called
gschemas.compiled
as produced by the glib-compile-schemas tool.If trusted is
True
thengschemas.compiled
is trusted not to be corrupted. This assumption has a performance advantage, but can result in crashes or inconsistent behaviour in the case of a corrupted file. Generally, you should set trusted toTrue
for files installed by the system and toFalse
for files in the home directory.In either case, an empty file or some types of corruption in the file will result in
GLib.FileError.INVAL
being returned.If parent is non-
None
then there are two effects.First, if
Gio.SettingsSchemaSource.lookup
() is called with the recursive flag set toTrue
and the schema can not be found in the source, the lookup will recurse to the parent.Second, any references to other schemas specified within this source (ie:
child
orextends
) references may be resolved from the parent.For this second reason, except in very unusual situations, the parent should probably be given as the default schema source, as returned by
Gio.SettingsSchemaSource.get_default
().New in version 2.32.
- list_schemas(recursive)[source]¶
- Parameters:
recursive (
bool
) – if we should recurse- Returns:
- non_relocatable:
the list of non-relocatable schemas, in no defined order
- relocatable:
the list of relocatable schemas, in no defined order
- Return type:
Lists the schemas in a given source.
If recursive is
True
then include parent sources. IfFalse
then only include the schemas from one source (ie: one directory). You probably wantTrue
.Non-relocatable schemas are those for which you can call
Gio.Settings.new
(). Relocatable schemas are those for which you must useGio.Settings.new_with_path
().Do not call this function from normal programs. This is designed for use by database editors, commandline tools, etc.
New in version 2.40.
- lookup(schema_id, recursive)[source]¶
- Parameters:
- Returns:
a new
Gio.SettingsSchema
- Return type:
Looks up a schema with the identifier schema_id in self.
This function is not required for normal uses of
Gio.Settings
but it may be useful to authors of plugin management systems or to those who want to introspect the content of schemas.If the schema isn’t found directly in self and recursive is
True
then the parent sources will also be checked.If the schema isn’t found,
None
is returned.New in version 2.32.