DBus Low level API - Receiving complex structures

Simon McVittie simon.mcvittie at collabora.co.uk
Tue Aug 16 02:27:08 PDT 2011


On Mon, 15 Aug 2011 at 22:49:23 +0200, Bogdan Lotko wrote:
> <arg type="(iia(ssii))">
...
> myPrefix_my_method( MyClass *self, <HELP_WHAT_TYPE???> myStruct,
> GError ** error );

As Thiago said, this isn't the low-level API (libdbus), this is the obsolete
high-level GObject API (dbus-glib). As you've noticed, dbus-glib is
under-documented and not very easy to use.

For new GObject applications I strongly recommend GDBus, which is part of GLib
2.26 or later.

If you particularly need to use dbus-glib, this type is a
"specialized GValueArray" - the parameter type is GValueArray *, but what
it contains (in pseudo-C++ notation) is:

  GValueArray<gint, gint, GPtrArray<GValueArray<gchar *, gchar *, gint, gint>>>

Its GType is:

  dbus_g_type_get_struct ("GValueArray",
    G_TYPE_INT,
    G_TYPE_INT,
    dbus_g_type_get_collection ("GPtrArray",
      dbus_g_type_get_struct ("GValueArray",
        G_TYPE_STRING,
	G_TYPE_STRING,
	G_TYPE_INT,
	G_TYPE_INT)),
    G_TYPE_INVALID);

(Ugh.)

Regards,
    smcv


More information about the dbus mailing list