GNOME Bugzilla – Bug 622920
Migrate from dbus-glib to glib's GDBus
Last modified: 2010-10-28 12:33:15 UTC
For GLib 2.25.5 GDBus D-Bus support was merged, providing an API to replace dbus-glib. See http://library.gnome.org/devel/gio/unstable/gdbus.html and http://library.gnome.org/devel/gio/unstable/ch28.html . According to a quick grep this module seems to use dbus-glib: ./gnome-power-manager/configure.ac: dbus-glib-1 >= 0.70
It's on my TODO list. Help more than welcome. Thanks.
Created attachment 171787 [details] [review] Port to GDBus Port completely and drop the dependency from dbus-glib to the new GDBus API, preparing for DBus API additions soon.
Review of attachment 171787 [details] [review]: ::: src/gpm-backlight.c @@ +661,3 @@ + GPM_DBUS_INTERFACE_BACKLIGHT, + "BrightnessChanged", + g_variant_new ("u", percentage), You need a tuple here, so "(u)". @@ +705,3 @@ + g_error_free (error); + } else { + g_dbus_method_invocation_return_value (invocation, g_variant_new ("u", value)); "(u)". @@ +712,3 @@ + GError *error; + guint value; + g_variant_get (parameters, "u", &value); "(u)". @@ +776,3 @@ + self, + NULL, + NULL); You can now unref node_info. ::: src/gpm-manager.c @@ +2016,3 @@ + NULL, + NULL); + Can now unref node_info. ::: src/gpm-phone.c @@ +219,3 @@ + guint number; + + g_variant_get (parameters, "u", &number); "(u)". ::: src/gpm-screensaver.c @@ +252,3 @@ + ret = g_dbus_proxy_call_sync (screensaver->priv->proxy, + "UnThrottle", + g_variant_new ("s", cookie), "(s)". @@ +301,3 @@ + if (ret != NULL) { + g_variant_get (ret, "b", &active); "(b)".
Giovanni, I very much appreciate you working on this, thanks.
Created attachment 171903 [details] [review] Port to GDBus Fixed
Could you please split this into one patch per file please, so for instance the screensaver changes would be 0001, and the manager changes would be 0002, etc. Thanks. Then it's much easier to commit some bits and rework other bits. Thanks.
Giovanni, did you compile gpm with your patch? I've spent more than an hour on it already just to compile and fix up all the missing bits. I'll post something here when I've got things working. Richard.
I tried compiling just now, but it seems to fail on unrelated Gtk changes (GtkComboBox). I am sure it compiled, back when I submitted it a week ago.
Created attachment 173178 [details] [review] Port to GDBus Port completely and drop the dependency from dbus-glib to the new GDBus API, preparing for DBus API additions soon. Previous patch was incomplete, this one should work.
I went a bit further and make a few source files go away. Thanks for all your help, appreciated. commit 7568769fb1e46de1b8ed8601fe106df9b367bb45 Author: Richard Hughes <richard@hughsie.com> Date: Tue Oct 26 11:13:04 2010 +0100 Migrate from dbus-glib to GDBus, based on a patch from Giovanni Campagna, many thanks
commit 802bbba78f4f6143eea81a796abe374a4963a36b Author: Richard Hughes <richard@hughsie.com> Date: Wed Oct 27 11:14:46 2010 +0100 Add two methods to the DBus interface for gnome-shell These return a tuple, and a tuple array of the following: s device_id u type of device s display device summary u percentage charge u device state u time remaining until change or discharge All the enumerated values are from UPower. :100644 100644 79bf84c... 120ca10... M src/gpm-manager.c commit a85e6cf90e385fe5174c95b9ed1b6387313bc4e5 Author: Richard Hughes <richard@hughsie.com> Date: Wed Oct 27 10:46:52 2010 +0100 Add two properties to the DBus interface for gnome-shell :100644 100644 c44872f... 79bf84c... M src/gpm-manager.c
Some minor fixes are still needed for this to work, as it currently asserts while building variants. Patch coming.
Created attachment 173350 [details] [review] Fix use of GVariant types and DBus signatures Prevent an assertion by using a GVariantBuilder for "as", and correctly pass a guint when a "u" is expected instead of a "s"
(In reply to comment #13) > Created an attachment (id=173350) [details] [review] > Fix use of GVariant types and DBus signatures > > Prevent an assertion by using a GVariantBuilder for "as", and correctly > pass a guint when a "u" is expected instead of a "s" Applied. In the future, obviously correct patches like this please just commit without asking -- you know what you are doing. Thanks.