Bug 25140 - dbus tutorial should not document deprecated dbus-glib API
Summary: dbus tutorial should not document deprecated dbus-glib API
Status: RESOLVED FIXED
Alias: None
Product: dbus
Classification: Unclassified
Component: core (show other bugs)
Version: 1.5
Hardware: All All
: medium enhancement
Assignee: Simon McVittie
QA Contact: D-Bus Maintainers
URL:
Whiteboard: review?
Keywords: patch
Depends on:
Blocks:
 
Reported: 2009-11-17 02:24 UTC by Jussi Kukkonen [inactive]
Modified: 2014-10-29 16:23 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
dbus-tutorial: replace the entire GLib section with "use GDBus" (35.98 KB, patch)
2014-09-10 12:57 UTC, Simon McVittie
Details | Splinter Review

Description Jussi Kukkonen [inactive] 2009-11-17 02:24:59 UTC
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);
Comment 1 Simon McVittie 2013-01-24 17:13:14 UTC
(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.
Comment 2 Simon McVittie 2014-09-10 12:57:24 UTC
Created attachment 106056 [details] [review]
dbus-tutorial: replace the entire GLib section with "use  GDBus"

Also provide links to relevant GLib and Qt documentation.
Comment 3 Simon McVittie 2014-09-10 12:58:36 UTC
(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.
Comment 4 Simon McVittie 2014-10-09 10:51:32 UTC
I intend to apply this in a couple of weeks if there is no positive or negative review.
Comment 5 Simon McVittie 2014-10-29 16:23:15 UTC
(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.