]> err.no Git - mapper/commitdiff
Sigh.. use correct dbus connection for hal.
authorKaj-Michael Lang <milang@onion.tal.org>
Thu, 13 Mar 2008 14:26:29 +0000 (16:26 +0200)
committerKaj-Michael Lang <milang@onion.tal.org>
Thu, 13 Mar 2008 14:26:29 +0000 (16:26 +0200)
src/mapper.c

index 306d813c36d68138e762bef9b5d1f718c71a983c..ae97f8beba53a743b50f3be60d8064bac269960f 100644 (file)
@@ -44,6 +44,7 @@
 #include <gdk/gdkkeysyms.h>
 #include <dbus/dbus.h>
 #include <dbus/dbus-glib.h>
+#include <dbus/dbus-glib-lowlevel.h>
 #include <libgnomevfs/gnome-vfs.h>
 #include <curl/multi.h>
 #include <gconf/gconf-client.h>
@@ -238,6 +239,10 @@ gnome_vfs_shutdown();
 #ifdef WITH_OSSO
 osso_deinitialize(_osso);
 #endif
+#ifdef WITH_HAL
+if (ctx)
+       libhal_ctx_shutdown(ctx, NULL);
+#endif
 curl_global_cleanup();
 }
 
@@ -265,9 +270,10 @@ if (strcmp(name, "ButtonPressed")==0 && strcmp(detail, "phone")==0)
 }
 
 static gboolean
-mapper_hal_init(DBusConnection *dbc)
+mapper_hal_init(DBusGConnection *gdbc)
 {
 DBusError error;
+DBusConnection *dbc=dbus_g_connection_get_connection(gdbc);
 
 g_return_if_fail(dbc);
 
@@ -276,10 +282,14 @@ dbus_error_init(&error);
 ctx=libhal_ctx_new();
 g_return_if_fail(ctx);
 
-libhal_ctx_set_dbus_connection(ctx, dbc);
+if (!libhal_ctx_set_dbus_connection(ctx, dbc)) {
+       g_warning("HAL dbus connection failed");
+       return FALSE;
+}
 
 if (!libhal_ctx_init(ctx, &error)) {
        g_warning("HAL Init failed");
+       ctx=NULL;
        return FALSE;
 }
 
@@ -416,7 +426,6 @@ switch (mis) {
 #ifdef WITH_HAL
                mapper_hal_init(dbus_conn);
 #endif
-
                mis=MAPPER_INIT_UI;
                p=0.9;
                w="Misc";