dbus glib structure

Rob Taylor robtaylor at floopily.org
Thu Aug 24 10:07:33 PDT 2006


keith preston wrote:
> So I've been trying to send structure over dbus-glib for a while and
> haven't
> had much success.   Does anyone know an exist project that does this, or
> could write a small example.
> 
> Here a bit of what I have tried
> 
> 
> I define a type in the xml as   "a(isb)" and array of structs that have an
> interger string and boolean in them
> 
> then in my code, I make
> 
> GArray* array = g_array_sized_new(false,false,sizeof(mystruct),
> number_of_structs)
> 
> for ...
>    array = g_array_append_vals(array,(gconstpointer) &mystruct ,1 )
> 
> dbus call passing array in
> 
> 
> 
> The error I get is the GValueArray can not be in a collection.
> 
> Does this mean I can't do arrays of structs?  Or an am I just doing
> everything wrong?
> 
> Keith
> 

I'm afraid its the latter, but that's more my fault for not having
written enough documentation yet...

I'd recommended looking at gabble_media_channel_list_streams in
http://projects.collabora.co.uk/trac/telepathy/browser/src/gabble-media-channel.c
for an example of how to do this.

dbus_g_type_struct_set and friends are all documented in the doxygen
output (gtk-doc if you're using bleeding-edge git)

Thanks,
Rob Taylor



More information about the dbus mailing list