:right-sidebar: True SettingsSchemaSource =================================================================== .. currentmodule:: gi.repository.Gio .. versionadded:: 2.32 .. class:: SettingsSchemaSource(*args, **kwargs) :no-contents-entry: This is an opaque structure type. You may not access it directly. Constructors ------------ .. rst-class:: interim-class .. class:: SettingsSchemaSource :no-index: .. classmethod:: new_from_directory(directory: str, parent: ~gi.repository.Gio.SettingsSchemaSource | None, trusted: bool) -> ~gi.repository.Gio.SettingsSchemaSource Attempts to create a new schema source corresponding to the contents of the given directory. This function is not required for normal uses of :obj:`~gi.repository.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][glib-compile-schemas] tool. If ``trusted`` is :const:`True` then ``gschemas.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`` to :const:`True` for files installed by the system and to :const:`False` for files in the home directory. In either case, an empty file or some types of corruption in the file will result in %G_FILE_ERROR_INVAL being returned. If ``parent`` is non-:const:`None` then there are two effects. First, if :func:`~gi.repository.Gio.SettingsSchemaSource.lookup` is called with the ``recursive`` flag set to :const:`True` 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`` or ``extends``\) 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 :func:`~gi.repository.Gio.SettingsSchemaSource.get_default`. .. versionadded:: 2.32 :param directory: the filename of a directory :param parent: a :obj:`~gi.repository.Gio.SettingsSchemaSource`\, or :const:`None` :param trusted: :const:`True`, if the directory is trusted Methods ------- .. rst-class:: interim-class .. class:: SettingsSchemaSource :no-index: .. classmethod:: get_default() -> ~gi.repository.Gio.SettingsSchemaSource | None Gets the default system schema source. This function is not required for normal uses of :obj:`~gi.repository.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, :const:`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`` and ``GSETTINGS_SCHEMA_DIR``\. For this reason, all lookups performed against the default source should probably be done recursively. .. versionadded:: 2.32 .. method:: list_schemas(recursive: bool) -> ~typing.Tuple[list[str], list[str]] Lists the schemas in a given source. If ``recursive`` is :const:`True` then include parent sources. If :const:`False` then only include the schemas from one source (ie: one directory). You probably want :const:`True`. Non-relocatable schemas are those for which you can call :func:`~gi.repository.Gio.Settings.new`. Relocatable schemas are those for which you must use :func:`~gi.repository.Gio.Settings.new_with_path`. Do not call this function from normal programs. This is designed for use by database editors, commandline tools, etc. .. versionadded:: 2.40 :param recursive: if we should recurse .. method:: lookup(schema_id: str, recursive: bool) -> ~gi.repository.Gio.SettingsSchema | None Looks up a schema with the identifier ``schema_id`` in ``source``\. This function is not required for normal uses of :obj:`~gi.repository.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 ``source`` and ``recursive`` is :const:`True` then the parent sources will also be checked. If the schema isn't found, :const:`None` is returned. .. versionadded:: 2.32 :param schema_id: a schema ID :param recursive: :const:`True` if the lookup should be recursive