:right-sidebar: True SettingsBackend =================================================================== .. currentmodule:: gi.repository.Gio .. class:: SettingsBackend(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` :Constructors: :: SettingsBackend(**properties) Methods ------- .. rst-class:: interim-class .. class:: SettingsBackend :no-index: .. method:: changed(key: str, origin_tag: None) -> None Signals that a single key has possibly changed. Backend implementations should call this if a key has possibly changed its value. ``key`` must be a valid key (ie starting with a slash, not containing '//', and not ending with a slash). The implementation must call this function during any call to g_settings_backend_write(), before the call returns (except in the case that no keys are actually changed and it cares to detect this fact). It may not rely on the existence of a mainloop for dispatching the signal later. The implementation may call this function at any other time it likes in response to other events (such as changes occurring outside of the program). These calls may originate from a mainloop or may originate in response to any other action (including from calls to g_settings_backend_write()). In the case that this call is in response to a call to g_settings_backend_write() then ``origin_tag`` must be set to the same value that was passed to that call. .. versionadded:: 2.26 :param key: the name of the key :param origin_tag: the origin tag .. method:: changed_tree(tree: ~gi.repository.GLib.Tree, origin_tag: None) -> None This call is a convenience wrapper. It gets the list of changes from ``tree``, computes the longest common prefix and calls :func:`~gi.repository.Gio.SettingsBackend.changed`. .. versionadded:: 2.26 :param tree: a :obj:`~gi.repository.GLib.Tree` containing the changes :param origin_tag: the origin tag .. method:: flatten_tree(tree: ~gi.repository.GLib.Tree) -> tuple[str, list[str], list[~gi.repository.GLib.Variant]] 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. You must free the value returned in ``path``, ``keys`` and ``values`` using :func:`~gi.repository.GLib.free`. You should not attempt to free or unref the contents of ``keys`` or ``values``. .. versionadded:: 2.26 :param tree: a :obj:`~gi.repository.GLib.Tree` containing the changes .. method:: get_default() -> ~gi.repository.Gio.SettingsBackend Returns the default :obj:`~gi.repository.Gio.SettingsBackend`. It is possible to override the default by setting the ``GSETTINGS_BACKEND`` environment variable to the name of a settings backend. The user gets a reference to the backend. .. versionadded:: 2.28 .. method:: keys_changed(path: str, items: ~typing.Sequence[str], origin_tag: None) -> None Signals that a list of keys have possibly changed. Backend implementations should call this if keys have possibly changed their values. ``path`` must be a valid path (ie starting and ending with a slash and not containing '//'). Each string in ``items`` must form a valid key name when ``path`` is prefixed to it (ie: each item must not start or end with '/' and must not contain '//'). The meaning of this signal is that any of the key names resulting from the contatenation of ``path`` with each item in ``items`` may have changed. The same rules for when notifications must occur apply as per :func:`~gi.repository.Gio.SettingsBackend.changed`. These two calls can be used interchangeably if exactly one item has changed (although in that case :func:`~gi.repository.Gio.SettingsBackend.changed` is definitely preferred). For efficiency reasons, the implementation should strive for ``path`` to be as long as possible (ie: the longest common prefix of all of the keys that were changed) but this is not strictly required. .. versionadded:: 2.26 :param path: the path containing the changes :param items: the :const:`None`-terminated list of changed keys :param origin_tag: the origin tag .. method:: path_changed(path: str, origin_tag: None) -> None 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. ``path`` must be a valid path (ie starting and ending with a slash and not containing '//'). The meaning of this signal is that any of the key which has a name starting with ``path`` may have changed. The same rules for when notifications must occur apply as per :func:`~gi.repository.Gio.SettingsBackend.changed`. This call might be an appropriate reasponse to a 'reset' call but implementations are also free to explicitly list the keys that were affected by that call if they can easily do so. For efficiency reasons, the implementation should strive for ``path`` to be as long as possible (ie: the longest common prefix of all of the keys that were changed) but this is not strictly required. As an example, if this function is called with the path of "/" then every single key in the application will be notified of a possible change. .. versionadded:: 2.26 :param path: the path containing the changes :param origin_tag: the origin tag .. method:: path_writable_changed(path: str) -> None Signals that the writability of all keys below a given path may have changed. Since GSettings performs no locking operations for itself, this call will always be made in response to external events. .. versionadded:: 2.26 :param path: the name of the path .. method:: writable_changed(key: str) -> None Signals that the writability of a single key has possibly changed. Since GSettings performs no locking operations for itself, this call will always be made in response to external events. .. versionadded:: 2.26 :param key: the name of the key Virtual Methods --------------- .. rst-class:: interim-class .. class:: SettingsBackend :no-index: .. method:: do_get_writable(key: str) -> bool virtual method to get if a key is writable :param key: .. method:: do_read(key: str, expected_type: ~gi.repository.GLib.VariantType, default_value: bool) -> ~gi.repository.GLib.Variant virtual method to read a key's value :param key: :param expected_type: :param default_value: .. method:: do_read_user_value(key: str, expected_type: ~gi.repository.GLib.VariantType) -> ~gi.repository.GLib.Variant virtual method to read user's key value :param key: :param expected_type: .. method:: do_reset(key: str, origin_tag: None) -> None virtual method to reset state :param key: :param origin_tag: .. method:: do_subscribe(name: str) -> None virtual method to subscribe to key changes :param name: .. method:: do_sync() -> None virtual method to sync state .. method:: do_unsubscribe(name: str) -> None virtual method to unsubscribe to key changes :param name: .. method:: do_write(key: str, value: ~gi.repository.GLib.Variant, origin_tag: None) -> bool virtual method to change key's value :param key: :param value: :param origin_tag: .. method:: do_write_tree(tree: ~gi.repository.GLib.Tree, origin_tag: None) -> bool virtual method to change a tree of keys :param tree: :param origin_tag: Fields ------ .. rst-class:: interim-class .. class:: SettingsBackend :no-index: .. attribute:: parent_instance .. attribute:: priv