In Gio.Settings I can list relocatable schemas using
Gio.Settings.list_relocatable_schemas()
and I can use
Gio.Settings.new_with_path(schema_id, path)
to get a Gio.Settings
instance. But how can I get all value for path
that are currently used for a given schema_id
?
You can't, at least not for an arbitrary schema, and this is by definition of what a relocatable schema is: a schema that can have multiple instances, stored in multiple arbitrary paths.
Since a relocatable schema instance can be stored basically anywhere inside DConf,
gsettings
has no way to list their paths, it does not keep track of instances. Anddconf
can't help you either, as it has no notion of schemas at all, it only knows about paths and keys. It can list the subpaths of a given path, but that's about it.It's up for the application, when creating multiple instances of a given relocatable schema, to store each instance in a sensible, easily discoverable path, such as a subpath of the (non-relocatable) application schema. Or store the instance paths (or suffixes) as a list key in such schema.
Or both, like Gnome Terminal does with its profiles:
org.gnome.Terminal.ProfilesList
is a non-relocatable, regular schema, stored at DConf path/org/gnome/terminal/legacy/profiles:/
default
string with a single UUID, and alist
list of strings containing UUIDs.org.gnome.Terminal.Legacy.Profile
, and stored at, you guess.../org/gnome/terminal/legacy/profiles:/:<UUID>/
!This way a client can access all instances using either
gsettings
, readinglist
and building the paths from the UUIDs, or fromdconf
, by directly listing the subpaths of/org/gnome/terminal/legacy/profiles:/
.And, of course, for non-relocatable schemas you can always get their paths with: