The D-Bus tutorial says that the correct mapping from D-Bus type 'OBJECT_PATH' to GType is 'DBUS_TYPE_G_PROXY'. That sounds very wrong as OBJECT_PATH seems to basically be a string with it's own type (DBUS_TYPE_G_OBJECT_PATH). In case anyone else is wondering how to handle object type in signal signatures, this is how it works in dbus-glib (mentioning the use of STRING in marshaller might be a good idea for the tutorial as well): // registering the marshaller // (generated using glib-genmarshal with "VOID:STRING"): dbus_g_object_register_marshaller (obj_marshal_VOID__STRING, G_TYPE_NONE, DBUS_TYPE_G_OBJECT_PATH, G_TYPE_INVALID); // connecting to the signal dbus_g_proxy_add_signal (proxy, "SignalName", DBUS_TYPE_G_OBJECT_PATH, G_TYPE_INVALID); dbus_g_proxy_connect_signal (proxy, "SignalName", G_CALLBACK (signal_cb), NULL, NULL);
(dbus/doc is a dead project; documentation that lives in dbus.git is dbus/core. Reassigning.) It's wrong that there's a file in dbus.git referring to dbus-glib APIs at all, really; it should just point to some dbus-glib document. I'm tempted to replace the entire dbus-glib section of the tutorial with "Use GDBus instead"... In dbus-glib, there is not necessarily a bidirectional mapping between D-Bus types and GObject types. Several D-Bus types have more than one GObject type: for instance, D-Bus arrays can be mapped to either GList or GPtrArray. I believe dbus-glib also accepts proxies and possibly exported objects as object path arguments, and converts them into their object path? (Or possibly it was meant to do that once, but that was never implemented.) When mapping from D-Bus into GLib types with no particular type information, for instance in a variant, the default is indeed to use DBUS_TYPE_G_OBJECT_PATH.
Created attachment 106056 [details] [review] dbus-tutorial: replace the entire GLib section with "use GDBus" Also provide links to relevant GLib and Qt documentation.
(In reply to comment #1) > I'm tempted to > replace the entire dbus-glib section of the tutorial with "Use GDBus > instead"... Here's a patch to do so.
I intend to apply this in a couple of weeks if there is no positive or negative review.
(In reply to Simon McVittie from comment #4) > I intend to apply this in a couple of weeks if there is no positive or > negative review. Done, for 1.9.2
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.