[tracker/gconf-dbus] libtracker-common: Deal better with disappearing gconfd-2 for gconf-dbus



commit ff2c163bc9de918eaf46fec62f5883191b8c0724
Author: Philip Van Hoof <philip codeminded be>
Date:   Fri Apr 1 18:01:35 2011 +0200

    libtracker-common: Deal better with disappearing gconfd-2 for gconf-dbus

 src/libtracker-common/tracker-locale-gconfdbus.c |   77 +++++++++++-----------
 1 files changed, 39 insertions(+), 38 deletions(-)
---
diff --git a/src/libtracker-common/tracker-locale-gconfdbus.c b/src/libtracker-common/tracker-locale-gconfdbus.c
index 8877bb7..f5c70a8 100644
--- a/src/libtracker-common/tracker-locale-gconfdbus.c
+++ b/src/libtracker-common/tracker-locale-gconfdbus.c
@@ -30,7 +30,7 @@
 
 /* This helps with testing, change all the names in gconf-dbus and then you
  * can run it in parallel with an upstream gconf-d of the GNOME platform */
-#define GCONF_DBUS_NAME "GConf"
+#define GCONF_DBUS_NAME "GConfDBus"
 
 #define GCONF_DBUS_SERVICE                    "org.gnome." GCONF_DBUS_NAME
 #define GCONF_DBUS_SERVER_INTERFACE           "org.gnome." GCONF_DBUS_NAME ".Server"
@@ -213,23 +213,6 @@ handle_set_property (GDBusConnection  *connection,
 	return TRUE;
 }
 
-static void
-on_gconfd_dbus_appeared (GDBusConnection *connection,
-                         const gchar     *name,
-                         const gchar     *name_owner,
-                         gpointer         user_data)
-{
-	service_running = TRUE;
-	add_notify ();
-}
-
-static void
-on_gconfd_dbus_disappeared  (GDBusConnection *connection,
-                             const gchar     *name,
-                             gpointer         user_data)
-{
-	service_running = FALSE;
-}
 
 
 static gchar *
@@ -278,13 +261,44 @@ get_value_from_config (const gchar *key_in)
 	return val;
 }
 
+
+static void
+on_gconfd_dbus_appeared (GDBusConnection *connection,
+                         const gchar     *name,
+                         const gchar     *name_owner,
+                         gpointer         user_data)
+{
+	guint i;
+
+	service_running = TRUE;
+	add_notify ();
+
+	/* And (re)initialize all */
+	for (i = 0; i < TRACKER_LOCALE_LAST; i++) {
+		gchar *str;
+
+		str = get_value_from_config (gconf_locales[i]);
+		if (str) {
+			tracker_locale_set (i, str);
+			g_free (str);
+		}
+	}
+}
+
+static void
+on_gconfd_dbus_disappeared  (GDBusConnection *connection,
+                             const gchar     *name,
+                             gpointer         user_data)
+{
+	service_running = FALSE;
+}
+
 void
 tracker_locale_gconfdbus_init (void)
 {
 	if (!g_getenv (TRACKER_DISABLE_MEEGOTOUCH_LOCALE_ENV) && !non_maemo_mode) {
 		GError *error = NULL;
 		GVariant *reply;
-		guint i;
 		GDBusInterfaceVTable interface_vtable = {
 			handle_method_call,
 			handle_get_property,
@@ -360,25 +374,12 @@ tracker_locale_gconfdbus_init (void)
 			return;
 		}
 
-		if (add_notify ()) {
-			watch_name_id = g_bus_watch_name_on_connection (connection,
-			                                                GCONF_DBUS_SERVICE,
-			                                                G_BUS_NAME_WATCHER_FLAGS_NONE,
-			                                                on_gconfd_dbus_appeared,
-			                                                on_gconfd_dbus_disappeared,
-			                                                NULL, NULL);
-		}
-
-		/* And initialize all */
-		for (i = 0; i < TRACKER_LOCALE_LAST; i++) {
-			gchar *str;
-
-			str = get_value_from_config (gconf_locales[i]);
-			if (str) {
-				tracker_locale_set (i, str);
-				g_free (str);
-			}
-		}
+		watch_name_id = g_bus_watch_name_on_connection (connection,
+		                                                GCONF_DBUS_SERVICE,
+		                                                G_BUS_NAME_WATCHER_FLAGS_NONE,
+		                                                on_gconfd_dbus_appeared,
+		                                                on_gconfd_dbus_disappeared,
+		                                                NULL, NULL);
 	}
 }
 



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