I have an array stored as a GVariant of type a(ss)
in GSettings, that I want to use in a Cinnamon Applet. I can retrieve the value successfully using the following code:
let schema = schema_source.lookup(SCHEMA_NAME, false); let settings = new Gio.Settings({ settings_schema: schema }); let my_value = settings.get_value('myvalue');
but I can't unpack it. As far as I can see, I will probably need to unpack it using a GVariantIter
structure, but the documentation is limited, and I can't find the correct interface in the gjs API (if, indeed, it exists). Does anyone know how to do it?
Thanks!
edit: my schema looks like this:
<key type="a(ss)" name="myvalue"> <default>[]</default> <summary>an array of (string, string) tuples</summary> <description></description> </key>
For the time being I'm using an external JSON
file to store settings, but it's not a 100% satisfactory solution. I suppose I could maintain two as
-type variables, and keep them aligned, but there must be a way to do this properly, right?