[tracker/gconf-dbus] squash



commit b7961a7de4098fb4b5e631195df5ac8636fe44b4
Author: Philip Van Hoof <philip codeminded be>
Date:   Fri Apr 1 14:21:28 2011 +0200

    squash

 src/libtracker-common/tracker-locale-gconfdbus.c |    2 +-
 src/libtracker-common/tracker-locale.c           |   15 ++++++++++++---
 2 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/src/libtracker-common/tracker-locale-gconfdbus.c b/src/libtracker-common/tracker-locale-gconfdbus.c
index eabfb4b..1e512b8 100644
--- a/src/libtracker-common/tracker-locale-gconfdbus.c
+++ b/src/libtracker-common/tracker-locale-gconfdbus.c
@@ -89,7 +89,7 @@ add_notify (void)
 	                                     gconf_dbus_default_db,
 	                                     GCONF_DBUS_DATABASE_INTERFACE,
 	                                     "AddNotify",
-	                                     g_variant_new ("(s)", "/meegotouch/i18n"),
+	                                     g_variant_new ("(s)", MEEGOTOUCH_LOCALE_DIR),
 	                                     NULL,
 	                                     G_DBUS_CALL_FLAGS_NONE,
 	                                     -1,
diff --git a/src/libtracker-common/tracker-locale.c b/src/libtracker-common/tracker-locale.c
index bb96d80..f2e91fa 100644
--- a/src/libtracker-common/tracker-locale.c
+++ b/src/libtracker-common/tracker-locale.c
@@ -35,7 +35,7 @@
  */
 static gchar *current_locales[TRACKER_LOCALE_LAST];
 
-static gchar *locale_names[TRACKER_LOCALE_LAST] = {
+static const gchar *locale_names[TRACKER_LOCALE_LAST] = {
 	"TRACKER_LOCALE_LANGUAGE",
 	"TRACKER_LOCALE_TIME",
 	"TRACKER_LOCALE_COLLATE",
@@ -45,6 +45,7 @@ static gchar *locale_names[TRACKER_LOCALE_LAST] = {
 
 /* Already initialized? */
 static gboolean initialized;
+static GStaticRecMutex locales_mutex = G_STATIC_REC_MUTEX_INIT;
 
 const gchar*
 tracker_locale_get_name (guint i)
@@ -57,6 +58,8 @@ void
 tracker_locale_set (TrackerLocaleID  id,
                     const gchar     *value)
 {
+	g_static_rec_mutex_lock (&locales_mutex);
+
 	if (current_locales[id]) {
 		g_debug ("Locale '%s' was changed from '%s' to '%s'",
 		         locale_names[id],
@@ -94,6 +97,8 @@ tracker_locale_set (TrackerLocaleID  id,
 		g_warn_if_reached ();
 		break;
 	}
+
+	g_static_rec_mutex_unlock (&locales_mutex);
 }
 
 
@@ -151,6 +156,8 @@ tracker_locale_get (TrackerLocaleID id)
 {
 	gchar *locale;
 
+	g_static_rec_mutex_lock (&locales_mutex);
+
 	/* Initialize if not already done */
 	if (!initialized) {
 		locale_init ();
@@ -160,6 +167,8 @@ tracker_locale_get (TrackerLocaleID id)
 	 * moment */
 	locale = g_strdup (current_locales[id]);
 
+	g_static_rec_mutex_unlock (&locales_mutex);
+
 	return locale;
 }
 
@@ -170,7 +179,7 @@ tracker_locale_notify_add (TrackerLocaleID         id,
                            GFreeFunc               destroy_notify)
 {
 #ifdef HAVE_MAEMO
-	tracker_locale_gconfdbus_notify_add (id, func, user_data, destroy_notify);
+	return tracker_locale_gconfdbus_notify_add (id, func, user_data, destroy_notify);
 #else
 	/* If not using gconf locales, this is a no-op... */
 	return NULL;
@@ -181,7 +190,7 @@ void
 tracker_locale_notify_remove (gpointer notification_id)
 {
 #ifdef HAVE_MAEMO
-	tracker_locale_gconfdbus_notify_remove (notification_id);
+	return tracker_locale_gconfdbus_notify_remove (notification_id);
 #else
 	/* If not using gconf locales, this is a no-op... */
 #endif /* HAVE_MAEMO */



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