I have a gsettings schema with a key of type a{ss}
. I would like to bind said key to a property on an object. I have successfully used g_settings_bind
and g_settings_bind_with_mapping
with other keys but I don't know what type to map this key to. The GVariant
is an array of dictionaries with key string and value string, but what accual glib type is that?
Asked
Active
Viewed 303 times
1

Philip Withnall
- 5,293
- 14
- 28

Ava
- 2,038
- 3
- 23
- 45
1 Answers
0
You need to use g_settings_bind_with_mapping()
, since a{ss}
is not supported by g_settings_bind()
. a{ss}
is a dictionary mapping strings to strings, and I would probably represent it in GLib as a GHashTable
mapping strings to strings.

Philip Withnall
- 5,293
- 14
- 28
-
Correct me if I'm wrong, but can't `a{ss}` contain duplicate keys while in `GHashTable` keys must be unique? – Ava Mar 15 '18 at 16:35
-
You are wrong. `a{ss}` is a dictionary in D-Bus terms, which is defined as not accepting duplicate keys (https://dbus.freedesktop.org/doc/dbus-specification.html#container-types). You may be thinking of `a(ss)` which is an array of tuples, and has no such restrictions. – Philip Withnall Mar 15 '18 at 16:38