[tracker/gconf-dbus: 6/8] libtracker-common, -data: Use locale_init and locale_shutdown



commit 6c5b676f907aac333f34e3cecb29ddc86b59d35c
Author: Philip Van Hoof <philip codeminded be>
Date:   Mon Apr 4 12:46:32 2011 +0200

    libtracker-common, -data: Use locale_init and locale_shutdown

 src/libtracker-common/tracker-locale.c     |   18 +++++++++++-------
 src/libtracker-common/tracker-locale.h     |    3 +++
 src/libtracker-data/tracker-data-manager.c |    5 +++++
 3 files changed, 19 insertions(+), 7 deletions(-)
---
diff --git a/src/libtracker-common/tracker-locale.c b/src/libtracker-common/tracker-locale.c
index f2e91fa..dc87d90 100644
--- a/src/libtracker-common/tracker-locale.c
+++ b/src/libtracker-common/tracker-locale.c
@@ -101,9 +101,16 @@ tracker_locale_set (TrackerLocaleID  id,
 	g_static_rec_mutex_unlock (&locales_mutex);
 }
 
+void
+tracker_locale_shutdown (void)
+{
+#ifdef HAVE_MAEMO
+	tracker_locale_gconfdbus_shutdown ();
+#endif /* HAVE_MAEMO */
+}
 
-static void
-locale_init (void)
+void
+tracker_locale_init (void)
 {
 	guint i;
 
@@ -156,12 +163,9 @@ tracker_locale_get (TrackerLocaleID id)
 {
 	gchar *locale;
 
-	g_static_rec_mutex_lock (&locales_mutex);
+	g_return_val_if_fail (initialized, NULL);
 
-	/* Initialize if not already done */
-	if (!initialized) {
-		locale_init ();
-	}
+	g_static_rec_mutex_lock (&locales_mutex);
 
 	/* Always return a duplicated string, as the locale may change at any
 	 * moment */
diff --git a/src/libtracker-common/tracker-locale.h b/src/libtracker-common/tracker-locale.h
index a7c2934..3ade737 100644
--- a/src/libtracker-common/tracker-locale.h
+++ b/src/libtracker-common/tracker-locale.h
@@ -62,6 +62,9 @@ const gchar* tracker_locale_get_name      (guint                   i);
 void         tracker_locale_set           (TrackerLocaleID         id,
                                            const gchar            *value);
 
+void         tracker_locale_init          (void);
+void         tracker_locale_shutdown      (void);
+
 G_END_DECLS
 
 #endif /* __LIBTRACKER_COMMON_LOCALE_H__ */
diff --git a/src/libtracker-data/tracker-data-manager.c b/src/libtracker-data/tracker-data-manager.c
index f90a250..ae5a5b0 100644
--- a/src/libtracker-data/tracker-data-manager.c
+++ b/src/libtracker-data/tracker-data-manager.c
@@ -34,6 +34,8 @@
 #include <libtracker-fts/tracker-fts.h>
 #endif
 
+#include <libtracker-common/tracker-locale.h>
+
 #include "tracker-class.h"
 #include "tracker-data-manager.h"
 #include "tracker-data-update.h"
@@ -3478,6 +3480,8 @@ tracker_data_manager_init (TrackerDBManagerFlags   flags,
 	/* Make sure we initialize all other modules we depend on */
 	tracker_ontologies_init ();
 
+	tracker_locale_init ();
+
 	read_journal = FALSE;
 
 	if (!tracker_db_manager_init (flags,
@@ -4132,6 +4136,7 @@ tracker_data_manager_shutdown (void)
 	tracker_db_journal_shutdown ();
 	tracker_db_manager_shutdown ();
 	tracker_ontologies_shutdown ();
+	tracker_locale_shutdown ();
 	tracker_data_update_shutdown ();
 
 	initialized = FALSE;



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