[tracker/collation-gconf-locale: 7/11] tracker-store: Shutdown events while reloading data manager



commit 139dc8d69c04b375c51e56e7ad788087e6fff0aa
Author: Aleksander Morgado <aleksander lanedo com>
Date:   Thu Nov 4 16:17:48 2010 +0200

    tracker-store: Shutdown events while reloading data manager

 src/tracker-store/tracker-main.c |   28 +++++++++++++++++++++++++++-
 1 files changed, 27 insertions(+), 1 deletions(-)
---
diff --git a/src/tracker-store/tracker-main.c b/src/tracker-store/tracker-main.c
index 6831d8e..97948b8 100644
--- a/src/tracker-store/tracker-main.c
+++ b/src/tracker-store/tracker-main.c
@@ -57,6 +57,8 @@
 #include "tracker-backup.h"
 #include "tracker-store.h"
 #include "tracker-statistics.h"
+#include "tracker-resources.h"
+#include "tracker-events.h"
 
 #define ABOUT	  \
 	"Tracker " PACKAGE_VERSION "\n"
@@ -82,6 +84,11 @@ typedef struct {
 	gboolean shutdown;
 } TrackerMainPrivate;
 
+typedef struct {
+	gpointer resources;
+	TrackerNotifyClassGetter getter;
+} TrackerLocaleChangeContext;
+
 /* Private */
 static GStaticPrivate private_key = G_STATIC_PRIVATE_INIT;
 static gpointer locale_notification_id;
@@ -270,6 +277,7 @@ tracker_locale_change_process_cb (gpointer user_data)
 	TrackerStatus *notifier;
 	TrackerBusyCallback busy_callback;
 	gpointer busy_user_data;
+	TrackerLocaleChangeContext *ctxt = user_data;
 
 	notifier = TRACKER_STATUS (tracker_dbus_get_object (TRACKER_TYPE_STATUS));
 
@@ -278,6 +286,13 @@ tracker_locale_change_process_cb (gpointer user_data)
 
 	tracker_data_manager_reload (busy_callback, busy_user_data);
 
+	if (ctxt->resources) {
+		tracker_events_init (ctxt->getter);
+		tracker_resources_enable_signals (ctxt->resources);
+		g_object_unref (ctxt->resources);
+	}
+	g_free (ctxt);
+
 	tracker_store_set_active (TRUE, FALSE, NULL);
 
 	locale_change_notified = FALSE;
@@ -286,9 +301,20 @@ tracker_locale_change_process_cb (gpointer user_data)
 static gboolean
 tracker_locale_change_process_idle_cb (gpointer data)
 {
+	TrackerLocaleChangeContext *ctxt;
+
+	ctxt = g_new0 (TrackerLocaleChangeContext, 1);
+	ctxt->resources = tracker_dbus_get_object (TRACKER_TYPE_RESOURCES);
+	if (ctxt->resources) {
+		g_object_ref (ctxt->resources);
+		tracker_resources_disable_signals (ctxt->resources);
+		ctxt->getter = tracker_events_get_class_getter ();
+		tracker_events_shutdown ();
+	}
+
 	/* Note: Right now, the passed callback may be called instantly and not
 	 * in an idle. */
-	tracker_store_set_active (FALSE, tracker_locale_change_process_cb, NULL);
+	tracker_store_set_active (FALSE, tracker_locale_change_process_cb, ctxt);
 
 	return FALSE;
 }



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