Re: [gpm] Issues with latest dbus



On Thu, Mar 02, 2006 at 07:55:22PM +0000, Richard Hughes wrote:
> Guys,
> 
> A few of you may be having problems with g-p-m events and HAL (i.e.
> where g-p-m ignores any change in HAL). The problem has been traced to
> the update of dbus from 0.60 to 0.61, and downgrading seems to have
> fixed the issues of at least one person.
> 
> Kudos to Sjoerd for finding the "solution", so if you are having
> problems on a recent update, then please downgrade dbus to 0.60 and tell
> me if that fixes the problem.
> 
> This problem *may* be debian specific, we're not sure yet.

Finally tracked it down (had to learn some new stuff about dbus). In dbus <=
0.60 dbus struct weren't really typed from dbus-glib's pov. In dbus >= 0.61
they are, so when defining a signal you need to be more precise then before.

Attached patch will fixes this issue, unfortunately when upgrading from dbus 
0.60 to dbus 0.61 you'll need to recompile g-p-m.. But that's life with
unstable api's i guess :)

  Sjoerd
PS: Debs are available at http://pkg-utopia.alioth.debian.org/gnome-power-manager/
-- 
What the world *really* needs is a good Automatic Bicycle Sharpener.
Index: configure.in
===================================================================
RCS file: /cvs/gnome/gnome-power-manager/configure.in,v
retrieving revision 1.105
diff -u -r1.105 configure.in
--- configure.in	2 Mar 2006 00:04:39 -0000	1.105
+++ configure.in	3 Mar 2006 11:43:57 -0000
@@ -142,6 +142,27 @@
 AC_SUBST(DBUS_SERVICES_DIR)
 
 dnl ---------------------------------------------------------------------------
+dnl - Get the dbus version
+dnl ---------------------------------------------------------------------------
+dbus_version=`pkg-config --modversion dbus-1`
+DBUS_VERSION_MAJOR=`echo $dbus_version | awk -F. '{print $1}'`
+DBUS_VERSION_MINOR=`echo $dbus_version | awk -F. '{print $2}'`
+DBUS_VERSION_MICRO=`echo $dbus_version | awk -F. '{print $3}'`
+if test "z$DBUS_VERSION_MAJOR" = "z"; then
+  DBUS_VERSION_MAJOR="0"
+fi
+if test "z$DBUS_VERSION_MINOR" = "z"; then
+  DBUS_VERSION_MINOR="0"
+fi
+if test "z$DBUS_VERSION_MICRO" = "z"; then
+  DBUS_VERSION_MICRO="0"
+fi
+echo "Your dbus version is $DBUS_VERSION_MAJOR,$DBUS_VERSION_MINOR,$DBUS_VERSION_MICRO."
+DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_VERSION_MAJOR=$DBUS_VERSION_MAJOR"
+DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_VERSION_MINOR=$DBUS_VERSION_MINOR"
+DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_VERSION_MICRO=$DBUS_VERSION_MICRO"
+
+dnl ---------------------------------------------------------------------------
 dnl - Should we should show the Suspend/Hibernate menu options?
 dnl ---------------------------------------------------------------------------
 AC_ARG_ENABLE(actions-menu,
Index: src/gpm-hal-monitor.c
===================================================================
RCS file: /cvs/gnome/gnome-power-manager/src/gpm-hal-monitor.c,v
retrieving revision 1.17
diff -u -r1.17 gpm-hal-monitor.c
--- src/gpm-hal-monitor.c	28 Feb 2006 17:55:42 -0000	1.17
+++ src/gpm-hal-monitor.c	3 Mar 2006 11:43:58 -0000
@@ -350,15 +350,23 @@
 					const char    *udi)
 {
 	DBusGProxy *proxy;
-	GType       struct_array_type;
+	GType       struct_array_type, struct_type;
 
 	proxy = g_hash_table_lookup (monitor->priv->devices, udi);
 	if (proxy == NULL) {
 		gpm_warning ("Device is not being watched: %s", udi);
 		return;
 	}
-
-	struct_array_type = dbus_g_type_get_collection ("GPtrArray", G_TYPE_VALUE_ARRAY);
+#if (DBUS_VERSION_MAJOR == 0) && (DBUS_VERSION_MINOR < 61)
+	struct_type = G_TYPE_VALUE_ARRAY;
+#else
+	struct_type = dbus_g_type_get_struct ("GValueArray", 
+						G_TYPE_STRING, 
+						G_TYPE_BOOLEAN, 
+						G_TYPE_BOOLEAN, 
+						G_TYPE_INVALID);
+#endif
+	struct_array_type = dbus_g_type_get_collection ("GPtrArray", struct_type);
 
 	dbus_g_object_register_marshaller (gpm_marshal_VOID__INT_BOXED,
 					   G_TYPE_NONE, G_TYPE_INT,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]