The GSettings API allows for object properties to be directly bound to keys stored in GSettings through the g_settings_bind_with_mapping() API, which is very convenient.
However, what I am wondering is whether there is a way to connect a GtkListStore with a key in GSettings? In essence, I’d like to be able to populate the GtkListStore from GSettings and then store the values back.
I understand that this will have to be done through a mapping function with g_settings_bind_with_mapping() but I don’t know what property of GtkListStore is appropriate to use?
I don’t want to iterate over a schema. I want to use values stored in GSettings to populate a GtkListStore.
For example, a GSettings schema could contain a key called ‘listValues’ of type ‘a(ss)’, each element of that list would be a string that will be inserted into one of the columns of a GtkListStore. I would look up the value of key ‘listValues’ and use that information to populate the GtkListStore.
There’s definitely no API to do this out of the box; you will need to iterate manually over the GVariant you get out of the GSettings key, and then populate the GtkListStore.