how to store an array of array of strings in gsettings

991 views Asked by At

I am using GSettings in my JS code to store some data. Now i need to store an array of array of strings, something like this:

var arr1 = new Array();
for (var index in list) {
    arr1[index] = new Array();

    arr1[index].push(list[index].blablaString);

    arr1[index] = arr1[index].concat(list[index].moreblablaStrings));
}

I know how to store array of strings in GSettings schema, but i got some problem to convert this array of array into variant obj, i try this:

var tmpVariant = GLib.Variant.new_objv(arr1);

and in gschema i create this key:

    <key name="tmparray" type="a(ss)">
        <default>[]</default>
    </key>

the error i got is this

had error: Error: Invalid element in string array

So, how can i store a matrix of strings in GSettings? thx

0

There are 0 answers