[tracker/libtracker-common-cleanup: 6/11] libtracker-common: Removed all locale runtime update management



commit b73af3b0d5e5d149301ffc188f2082f01b4ada3e
Author: Martyn Russell <martyn lanedo com>
Date:   Fri Oct 10 22:21:01 2014 +0100

    libtracker-common: Removed all locale runtime update management
    
    General consensus was that we should remove this now, it's not useful and
    GNOME at least expects a log out when changing the locale.

 src/libtracker-common/Makefile.am                  |   11 -
 src/libtracker-common/tracker-common.h             |    4 -
 src/libtracker-common/tracker-locale-gconfdbus.c   |  563 --------------------
 src/libtracker-common/tracker-locale-gconfdbus.h   |   44 --
 src/libtracker-common/tracker-locale.c             |   53 +--
 src/libtracker-common/tracker-locale.h             |   18 +-
 src/libtracker-common/tracker-meego.cpp            |   94 ----
 src/libtracker-common/tracker-meego.h              |   37 --
 src/libtracker-common/tracker-miner-locale.c       |   24 +-
 src/libtracker-data/tracker-db-interface-sqlite.c  |   20 -
 src/miners/apps/tracker-miner-applications.c       |   50 --
 src/miners/user-guides/tracker-miner-user-guides.c |   44 --
 src/tracker-store/Makefile.am                      |    2 -
 src/tracker-store/tracker-locale-change.c          |  152 ------
 src/tracker-store/tracker-locale-change.h          |   32 --
 src/tracker-store/tracker-main.vala                |    5 -
 16 files changed, 17 insertions(+), 1136 deletions(-)
---
diff --git a/src/libtracker-common/Makefile.am b/src/libtracker-common/Makefile.am
index baa7298..b44a221 100644
--- a/src/libtracker-common/Makefile.am
+++ b/src/libtracker-common/Makefile.am
@@ -52,17 +52,6 @@ libtracker_common_la_SOURCES += tracker-language.c
 noinst_HEADERS += tracker-language.h
 endif
 
-if HAVE_MEEGOTOUCH
-libtracker_common_la_SOURCES += 
-       tracker-locale-gconfdbus.c \
-       tracker-locale-gconfdbus.h \
-       tracker-meego.cpp \
-       tracker-meego.h
-noinst_HEADERS += \
-       tracker-locale-gconfdbus.h \
-       tracker-meego.h
-endif
-
 libtracker_common_la_LIBADD = \
        $(BUILD_LIBS) \
        $(LIBTRACKER_COMMON_LIBS) \
diff --git a/src/libtracker-common/tracker-common.h b/src/libtracker-common/tracker-common.h
index c82684f..44f3292 100644
--- a/src/libtracker-common/tracker-common.h
+++ b/src/libtracker-common/tracker-common.h
@@ -44,10 +44,6 @@
 #include "tracker-miner-locale.h"
 #include "tracker-enum-types.h"
 
-#ifdef HAVE_MEEGOTOUCH
-#include "tracker-miner-meego.h"
-#endif /* HAVE_MEEGOTOUCH */
-
 #undef __LIBTRACKER_COMMON_INSIDE__
 
 #endif /* __LIBTRACKER_COMMON_H__ */
diff --git a/src/libtracker-common/tracker-locale.c b/src/libtracker-common/tracker-locale.c
index e2cfab1..e76c10b 100644
--- a/src/libtracker-common/tracker-locale.c
+++ b/src/libtracker-common/tracker-locale.c
@@ -26,10 +26,6 @@
 
 #include "tracker-locale.h"
 
-#ifdef HAVE_MEEGOTOUCH
-#include "tracker-locale-gconfdbus.h"
-#endif /* HAVE_MEEGOTOUCH */
-
 /* Current locales in use. They will be stored in heap and available throughout
  * the whole program execution, so will be reported as still reachable by Valgrind.
  */
@@ -103,22 +99,10 @@ tracker_locale_set (TrackerLocaleID  id,
 }
 
 void
-tracker_locale_shutdown (void)
-{
-#ifdef HAVE_MEEGOTOUCH
-       tracker_locale_gconfdbus_shutdown ();
-#endif /* HAVE_MEEGOTOUCH */
-}
-
-void
 tracker_locale_init (void)
 {
        guint i;
 
-#ifdef HAVE_MEEGOTOUCH
-       tracker_locale_gconfdbus_init ();
-#endif /* HAVE_MEEGOTOUCH */
-
        /* Initialize those not retrieved from gconf, or if not in meegotouch */
        for (i = 0; i < TRACKER_LOCALE_LAST; i++) {
                if (!current_locales[i]) {
@@ -159,6 +143,19 @@ tracker_locale_init (void)
        initialized = TRUE;
 }
 
+void
+tracker_locale_shutdown (void)
+{
+       gint i;
+
+       for (i = 0; i < TRACKER_LOCALE_LAST; i++) {
+               g_free (current_locales[i]);
+               current_locales[i] = NULL;
+       }
+
+       initialized = FALSE;
+}
+
 gchar *
 tracker_locale_get (TrackerLocaleID id)
 {
@@ -176,27 +173,3 @@ tracker_locale_get (TrackerLocaleID id)
 
        return locale;
 }
-
-gpointer
-tracker_locale_notify_add (TrackerLocaleID         id,
-                           TrackerLocaleNotifyFunc func,
-                           gpointer                user_data,
-                           GFreeFunc               destroy_notify)
-{
-#ifdef HAVE_MEEGOTOUCH
-       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;
-#endif /* HAVE_MEEGOTOUCH */
-}
-
-void
-tracker_locale_notify_remove (gpointer notification_id)
-{
-#ifdef HAVE_MEEGOTOUCH
-       return tracker_locale_gconfdbus_notify_remove (notification_id);
-#else
-       /* If not using gconf locales, this is a no-op... */
-#endif /* HAVE_MEEGOTOUCH */
-}
diff --git a/src/libtracker-common/tracker-locale.h b/src/libtracker-common/tracker-locale.h
index 3ade737..d1b8003 100644
--- a/src/libtracker-common/tracker-locale.h
+++ b/src/libtracker-common/tracker-locale.h
@@ -38,32 +38,18 @@ typedef enum {
        TRACKER_LOCALE_LAST
 } TrackerLocaleID;
 
-/* Callback for the notification of locale changes */
-typedef void (* TrackerLocaleNotifyFunc)  (TrackerLocaleID id,
-                                           gpointer user_data);
+void         tracker_locale_init          (void);
+void         tracker_locale_shutdown      (void);
 
 /* Get the current locale of the given type.
  * Note that it returns a newly-allocated string which should be g_free()-ed
  */
 gchar       *tracker_locale_get           (TrackerLocaleID id);
 
-/* Adds a new subscriber to locale change notifications.
- * Returns a pointer which identifies the subscription.
- */
-gpointer     tracker_locale_notify_add    (TrackerLocaleID         id,
-                                           TrackerLocaleNotifyFunc func,
-                                           gpointer                user_data,
-                                           GFreeFunc               destroy_notify);
-
-/* Remove a given subscriber, passing the id you got in _add() */
-void         tracker_locale_notify_remove (gpointer                notification_id);
-
 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
 
diff --git a/src/libtracker-common/tracker-miner-locale.c b/src/libtracker-common/tracker-miner-locale.c
index 9cf39f5..a247383 100644
--- a/src/libtracker-common/tracker-miner-locale.c
+++ b/src/libtracker-common/tracker-miner-locale.c
@@ -20,12 +20,8 @@
 #include "config.h"
 #include <string.h>
 
-#include <libtracker-common/tracker-locale.h>
-
+#include "tracker-locale.h"
 #include "tracker-miner-locale.h"
-#ifdef HAVE_MEEGOTOUCH
-#include "tracker-miner-meego.h"
-#endif
 
 /* NOTE: This applies to more miners than just the application miner,
  * it's kept this way to avoid breaking things.
@@ -35,18 +31,8 @@
 static gchar *
 miner_locale_get_filename (void)
 {
-       gchar *data_dir;
-       gchar *filename;
-
        /* Locate locale file */
-       data_dir = g_build_filename (g_get_user_cache_dir (),
-                                    "tracker",
-                                    NULL);
-       filename = g_build_filename (data_dir, TRACKER_MINER_LOCALE_FILE, NULL);
-
-       g_free (data_dir);
-
-       return filename;
+       return g_build_filename (g_get_user_cache_dir (), "tracker", TRACKER_MINER_LOCALE_FILE, NULL);
 }
 
 static gchar *
@@ -86,14 +72,8 @@ miner_locale_get_current (void)
 {
        gchar *current_locale;
 
-#ifdef HAVE_MEEGOTOUCH
-       /* If we have meegotouch enabled, take the correct locale as the one from
-        * meegotouch. */
-       current_locale = tracker_miner_meego_get_locale ();
-#else
        /* Get current tracker LANG locale */
        current_locale = tracker_locale_get (TRACKER_LOCALE_LANGUAGE);
-#endif
 
        return current_locale;
 }
diff --git a/src/libtracker-data/tracker-db-interface-sqlite.c 
b/src/libtracker-data/tracker-db-interface-sqlite.c
index 12903bf..2cbac29 100644
--- a/src/libtracker-data/tracker-db-interface-sqlite.c
+++ b/src/libtracker-data/tracker-db-interface-sqlite.c
@@ -922,17 +922,6 @@ check_interrupt (void *user_data)
 }
 
 static void
-tracker_locale_notify_cb (TrackerLocaleID id,
-                          gpointer        user_data)
-{
-       TrackerDBInterface *db_interface = user_data;
-
-       /* Request a collator reset. Use thread-safe methods as this function will get
-        * called from the main thread */
-       g_atomic_int_compare_and_exchange (&(db_interface->collator_reset_requested), FALSE, TRUE);
-}
-
-static void
 open_database (TrackerDBInterface  *db_interface,
                GError             **error)
 {
@@ -963,11 +952,6 @@ open_database (TrackerDBInterface  *db_interface,
 
        /* Set our unicode collation function */
        tracker_db_interface_sqlite_reset_collator (db_interface);
-       /* And register for updates on locale changes */
-       db_interface->locale_notification_id = tracker_locale_notify_add (TRACKER_LOCALE_COLLATE,
-                                                                         tracker_locale_notify_cb,
-                                                                         db_interface,
-                                                                         NULL);
 
        sqlite3_progress_handler (db_interface->db, 100,
                                  check_interrupt, db_interface);
@@ -1360,10 +1344,6 @@ tracker_db_interface_sqlite_finalize (GObject *object)
        g_free (db_interface->filename);
        g_free (db_interface->busy_status);
 
-       if (db_interface->locale_notification_id) {
-               tracker_locale_notify_remove (db_interface->locale_notification_id);
-       }
-
        G_OBJECT_CLASS (tracker_db_interface_parent_class)->finalize (object);
 }
 
diff --git a/src/miners/apps/tracker-miner-applications.c b/src/miners/apps/tracker-miner-applications.c
index 4ea4434..9e092dd 100644
--- a/src/miners/apps/tracker-miner-applications.c
+++ b/src/miners/apps/tracker-miner-applications.c
@@ -42,8 +42,6 @@ static gboolean miner_applications_process_file_attributes (TrackerMinerFS
                                                             GFile                *file,
                                                             TrackerSparqlBuilder *sparql,
                                                             GCancellable         *cancellable);
-static void     miner_applications_finalize                (GObject              *object);
-
 
 static GQuark miner_applications_error_quark = 0;
 
@@ -67,11 +65,8 @@ G_DEFINE_TYPE_WITH_CODE (TrackerMinerApplications, tracker_miner_applications, T
 static void
 tracker_miner_applications_class_init (TrackerMinerApplicationsClass *klass)
 {
-       GObjectClass *object_class = G_OBJECT_CLASS (klass);
        TrackerMinerFSClass *miner_fs_class = TRACKER_MINER_FS_CLASS (klass);
 
-       object_class->finalize = miner_applications_finalize;
-
        miner_fs_class->process_file = miner_applications_process_file;
        miner_fs_class->process_file_attributes = miner_applications_process_file_attributes;
 
@@ -127,11 +122,6 @@ miner_applications_basedir_add (TrackerMinerFS *fs,
 static void
 miner_applications_add_directories (TrackerMinerFS *fs)
 {
-#ifdef HAVE_MEEGOTOUCH
-       TrackerIndexingTree *indexing_tree;
-       GFile *file;
-       const gchar *path;
-#endif /* HAVE_MEEGOTOUCH */
        const gchar * const *xdg_dirs;
        const gchar *user_data_dir;
        gint i;
@@ -172,19 +162,6 @@ miner_applications_add_directories (TrackerMinerFS *fs)
 }
 
 static void
-tracker_locale_notify_cb (TrackerLocaleID id,
-                          gpointer        user_data)
-{
-       TrackerMiner *miner = user_data;
-
-       if (tracker_miner_applications_detect_locale_changed (miner)) {
-               tracker_miner_fs_set_mtime_checking (TRACKER_MINER_FS (miner), TRUE);
-
-               miner_applications_add_directories (TRACKER_MINER_FS (miner));
-       }
-}
-
-static void
 miner_finished_cb (TrackerMinerFS *fs,
                    gdouble         seconds_elapsed,
                    guint           total_directories_found,
@@ -205,12 +182,10 @@ miner_applications_initable_init (GInitable     *initable,
                                   GError       **error)
 {
        TrackerMinerFS *fs;
-       TrackerMinerApplications *app;
        GError *inner_error = NULL;
        TrackerIndexingTree *indexing_tree;
 
        fs = TRACKER_MINER_FS (initable);
-       app = TRACKER_MINER_APPLICATIONS (initable);
        indexing_tree = tracker_miner_fs_get_indexing_tree (fs);
 
        /* Set up files filter, deny every file, but
@@ -238,35 +213,10 @@ miner_applications_initable_init (GInitable     *initable,
 
        miner_applications_add_directories (fs);
 
-#ifdef HAVE_MEEGOTOUCH
-       tracker_meego_init ();
-#endif /* HAVE_MEEGOTOUCH */
-
-       app->locale_notification_id = tracker_locale_notify_add (TRACKER_LOCALE_LANGUAGE,
-                                                                tracker_locale_notify_cb,
-                                                                app,
-                                                                NULL);
-
        return TRUE;
 }
 
 static void
-miner_applications_finalize (GObject *object)
-{
-       TrackerMinerApplications *app;
-
-       app = TRACKER_MINER_APPLICATIONS (object);
-
-       tracker_locale_notify_remove (app->locale_notification_id);
-
-#ifdef HAVE_MEEGOTOUCH
-       tracker_meego_shutdown ();
-#endif /* HAVE_MEEGOTOUCH */
-
-       G_OBJECT_CLASS (tracker_miner_applications_parent_class)->finalize (object);
-}
-
-static void
 insert_data_from_desktop_file (TrackerSparqlBuilder *sparql,
                                const gchar          *subject,
                                const gchar          *metadata_key,
diff --git a/src/miners/user-guides/tracker-miner-user-guides.c 
b/src/miners/user-guides/tracker-miner-user-guides.c
index 3c513dc..8328dfa 100644
--- a/src/miners/user-guides/tracker-miner-user-guides.c
+++ b/src/miners/user-guides/tracker-miner-user-guides.c
@@ -60,7 +60,6 @@ static gboolean miner_userguides_process_file_attributes (TrackerMinerFS       *
                                                           GFile                *file,
                                                           TrackerSparqlBuilder *sparql,
                                                           GCancellable         *cancellable);
-static void     miner_userguides_finalize                (GObject              *object);
 static void     parser_get_file_content                  (const gchar          *uri,
                                                           gssize                max_extract_size,
                                                           gchar               **content,
@@ -77,11 +76,8 @@ G_DEFINE_TYPE_WITH_CODE (TrackerMinerUserguides, tracker_miner_userguides, TRACK
 static void
 tracker_miner_userguides_class_init (TrackerMinerUserguidesClass *klass)
 {
-       GObjectClass *object_class = G_OBJECT_CLASS (klass);
        TrackerMinerFSClass *miner_fs_class = TRACKER_MINER_FS_CLASS (klass);
 
-       object_class->finalize = miner_userguides_finalize;
-
        miner_fs_class->process_file = miner_userguides_process_file;
        miner_fs_class->process_file_attributes = miner_userguides_process_file_attributes;
 
@@ -218,19 +214,6 @@ miner_userguides_add_directories (TrackerMinerFS *fs)
 }
 
 static void
-tracker_locale_notify_cb (TrackerLocaleID id,
-                          gpointer        user_data)
-{
-       TrackerMiner *miner = user_data;
-
-       if (tracker_miner_userguides_detect_locale_changed (miner)) {
-               tracker_miner_fs_set_mtime_checking (TRACKER_MINER_FS (miner), TRUE);
-
-               miner_userguides_add_directories (TRACKER_MINER_FS (miner));
-       }
-}
-
-static void
 miner_finished_cb (TrackerMinerFS *fs,
                    gdouble         seconds_elapsed,
                    guint           total_directories_found,
@@ -251,12 +234,10 @@ miner_userguides_initable_init (GInitable     *initable,
                                 GError       **error)
 {
        TrackerMinerFS *fs;
-       TrackerMinerUserguides *app;
        GError *inner_error = NULL;
        TrackerIndexingTree *indexing_tree;
 
        fs = TRACKER_MINER_FS (initable);
-       app = TRACKER_MINER_USERGUIDES (initable);
        indexing_tree = tracker_miner_fs_get_indexing_tree (fs);
 
        /* Set up files filter, deny every file, but
@@ -281,34 +262,9 @@ miner_userguides_initable_init (GInitable     *initable,
 
        miner_userguides_add_directories (fs);
 
-#ifdef HAVE_MEEGOTOUCH
-       tracker_meego_init ();
-#endif /* HAVE_MEEGOTOUCH */
-
-       app->locale_notification_id = tracker_locale_notify_add (TRACKER_LOCALE_LANGUAGE,
-                                                                tracker_locale_notify_cb,
-                                                                app,
-                                                                NULL);
-
        return TRUE;
 }
 
-static void
-miner_userguides_finalize (GObject *object)
-{
-       TrackerMinerUserguides *app;
-
-       app = TRACKER_MINER_USERGUIDES (object);
-
-       tracker_locale_notify_remove (app->locale_notification_id);
-
-#ifdef HAVE_MEEGOTOUCH
-       tracker_meego_shutdown ();
-#endif /* HAVE_MEEGOTOUCH */
-
-       G_OBJECT_CLASS (tracker_miner_userguides_parent_class)->finalize (object);
-}
-
 static const gchar *
 get_file_urn (TrackerMinerFS *miner,
               GFile          *file,
diff --git a/src/tracker-store/Makefile.am b/src/tracker-store/Makefile.am
index 4c201de..7e4845a 100644
--- a/src/tracker-store/Makefile.am
+++ b/src/tracker-store/Makefile.am
@@ -22,7 +22,6 @@ tracker_store_SOURCES =                                \
        tracker-config.c                               \
        tracker-dbus.vala                              \
        tracker-events.c                               \
-       tracker-locale-change.c                        \
        tracker-main.vala                              \
        tracker-resources.vala                         \
        tracker-statistics.vala                        \
@@ -34,7 +33,6 @@ tracker_store_SOURCES =                                \
 noinst_HEADERS =                                       \
        tracker-config.h                               \
        tracker-events.h                               \
-       tracker-locale-change.h                        \
        tracker-store.h                                \
        tracker-writeback.h
 
diff --git a/src/tracker-store/tracker-main.vala b/src/tracker-store/tracker-main.vala
index 7d61131..8d991c6 100644
--- a/src/tracker-store/tracker-main.vala
+++ b/src/tracker-store/tracker-main.vala
@@ -285,9 +285,6 @@ License which can be viewed at:
                notifier = null;
 
                if (!shutdown) {
-                       /* Setup subscription to get notified of locale changes */
-                       Tracker.locale_change_initialize_subscription ();
-
                        Tracker.DBus.register_prepare_class_signal ();
 
                        Tracker.Events.init ();
@@ -322,8 +319,6 @@ License which can be viewed at:
                Tracker.Writeback.shutdown ();
                Tracker.Events.shutdown ();
 
-               Tracker.locale_change_shutdown_subscription ();
-
                Tracker.DBus.shutdown ();
                Tracker.Data.Manager.shutdown ();
                Tracker.Log.shutdown ();


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