[tracker/gconf-dbus] libtracker-common: Locale values must be there on return of the init function



commit b1067a848ed1a03f46724b1181f49a6fa9893b0e
Author: Philip Van Hoof <philip codeminded be>
Date:   Tue Apr 5 14:27:45 2011 +0200

    libtracker-common: Locale values must be there on return of the init function

 src/libtracker-common/tracker-locale-gconfdbus.c |   33 +++++++++++++++++----
 1 files changed, 26 insertions(+), 7 deletions(-)
---
diff --git a/src/libtracker-common/tracker-locale-gconfdbus.c b/src/libtracker-common/tracker-locale-gconfdbus.c
index 22cbd06..e40bf18 100644
--- a/src/libtracker-common/tracker-locale-gconfdbus.c
+++ b/src/libtracker-common/tracker-locale-gconfdbus.c
@@ -263,20 +263,25 @@ on_gconfd_dbus_appeared (GDBusConnection *connection,
                          gpointer         user_data)
 {
 	guint i;
+	static gboolean first_time = TRUE;
 
 	service_running = TRUE;
 	add_notify ();
 
-	/* And (re)initialize all */
-	for (i = 0; i < TRACKER_LOCALE_LAST; i++) {
-		gchar *str;
+	if (!first_time) {
+		/* 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);
+			str = get_value_from_config (gconf_locales[i]);
+			if (str) {
+				tracker_locale_set (i, str);
+				g_free (str);
+			}
 		}
 	}
+
+	first_time = FALSE;
 }
 
 static void
@@ -385,6 +390,20 @@ tracker_locale_gconfdbus_init (void)
 		                                                on_gconfd_dbus_disappeared,
 		                                                NULL, NULL);
 
+		/* And initialize all (must be synchronously done at the return of this
+		 * function, which is why we do the first_time trick in on_gconfd_dbus_
+		 * appeared above) */
+
+		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);
+			}
+		}
+
 		g_main_context_pop_thread_default (NULL);
 	}
 }



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