sending arrays of variants with dbus-glib

Brian J. Tarricone kelnos at xfce.org
Thu Jan 10 11:42:06 PST 2008


Hi all,

I'm working on a (hopefully!) simple dbus-based config system for Xfce 
(client/daemon style), to use until we're ready to adopt something like 
dconf/gsettings.  One of the things I want to do is be able to store 
arrays of arbitrary data types in the config store.

I have Get() and Set() methods that return/take a variant (signature 
'v') for the config property value.  I'm using dbus-glib, and for the 
array stuff, I'm putting the array elements into GValues, and then those 
GValues into a GValueArray, which then gets stuffed into its own GValue 
and then passed to the dbus bindings.

The problem is that the config daemon on the other end isn't really able 
to figure out what it receives.  G_VALUE_TYPE_NAME() tells me things 
like "GValueArray_gchararray+gchararray" (for an array with 2 string 
elements), for example.  These special GTypes don't appear to be 
subtypes of G_TYPE_VALUE_ARRAY, so I can't match using g_type_is_a(). 
Basically I just want a way to know "the item in this GValue is a 
GValueArray, but I don't care at this point what the elements of the 
array are."

Is there any way I can do what I want here using this approach, or am I 
just going about this the wrong way?

Thanks,
Brian


More information about the dbus mailing list