small patch for DBUS < 0.60



Hi,

The recent change to libnm_glib.c to fix various problems with DBUS
calls have broken things for people with older versions of DBUS.  In
particular, the function dbus_bus_get_private() seems to have been
introduced in DBUS 0.60, and so doesnt work for people with older
versions (I have a version of FC4, updated to DBUS 0.50 via the nrpms
repository at www.nrpms.net).  There is some configurey magic to work
out the DBUS version, and that allows DBUS 0.50, but the build then
fails.

As I see it (as a very limited hacker) there are 2 ways round this.

1) Only allow DBUS >= 0.60

2) Check the DBUS version, and use the appropriate DBUS function.  The
attached patch does this, and is sent on a strictly works-for-me basis.

Cheers,
James.

patch below - apologies in advance for the line wrapping ...

diff -rup NetworkManager-0.5.1.cvs20060302/gnome/libnm_glib/libnm_glib.c
NetworkManager-0.5.1/gnome/libnm_glib/libnm_glib.c
--- NetworkManager-0.5.1.cvs20060302/gnome/libnm_glib/libnm_glib.c
2006-02-22 15:52:30.000000000 +0000
+++ NetworkManager-0.5.1/gnome/libnm_glib/libnm_glib.c  2006-03-03
12:35:54.000000000 +0000
@@ -295,7 +295,11 @@ libnm_glib_dbus_init (gpointer *user_dat
        DBusError                error;

        dbus_error_init (&error);
+#if (DBUS_VERSION_MAJOR == 0) && (DBUS_VERSION_MINOR >= 60)
        connection = dbus_bus_get_private (DBUS_BUS_SYSTEM, &error);
+#else
+       connection = dbus_bus_get (DBUS_BUS_SYSTEM, &error);
+#endif
        if (dbus_error_is_set (&error))
        {
                fprintf (stderr, "%s: error, %s raised:\n %s\n\n",
__func__, error.name, error.message);


James Begley
-- 
Telephone +354-575-2039
Marine Research Institute,
Skulagata 4, P.O. Box 1390,
121 Reykjavik, Iceland.



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