[tracker/rss-enclosures] tracker-store: Disable class signals while restoring a backup



commit ae4a2b37039e3bffb272a4700ebe502265306209
Author: Philip Van Hoof <philip codeminded be>
Date:   Thu Nov 4 14:38:24 2010 +0200

    tracker-store: Disable class signals while restoring a backup
    
    Fixes NB#202581

 src/tracker-store/tracker-backup.c    |    6 ++++++
 src/tracker-store/tracker-dbus.c      |    2 +-
 src/tracker-store/tracker-resources.c |   17 +++++++++++++----
 src/tracker-store/tracker-resources.h |    4 ++--
 4 files changed, 22 insertions(+), 7 deletions(-)
---
diff --git a/src/tracker-store/tracker-backup.c b/src/tracker-store/tracker-backup.c
index f73973e..02bcd8c 100644
--- a/src/tracker-store/tracker-backup.c
+++ b/src/tracker-store/tracker-backup.c
@@ -36,6 +36,7 @@ typedef struct {
 	DBusGMethodInvocation *context;
 	guint request_id;
 	gchar *journal_uri;
+	TrackerResources *resources;
 } TrackerDBusMethodInfo;
 
 G_DEFINE_TYPE (TrackerBackup, tracker_backup, G_TYPE_OBJECT)
@@ -136,6 +137,8 @@ backup_idle_set_active_false_cb (gpointer user_data)
 	g_object_unref (journal);
 
 	tracker_store_set_active (TRUE, NULL, NULL);
+	if (info->resources)
+		tracker_resources_enable_signals (info->resources);
 }
 
 void
@@ -158,7 +161,10 @@ tracker_backup_restore (TrackerBackup          *object,
 	info->request_id = request_id;
 	info->context = context;
 	info->journal_uri = g_strdup (journal_uri);
+	info->resources = TRACKER_RESOURCES (tracker_dbus_get_object (TRACKER_TYPE_RESOURCES));
 
+	if (info->resources)
+		tracker_resources_disable_signals (info->resources);
 	tracker_store_set_active (FALSE, backup_idle_set_active_false_cb, info);
 }
 
diff --git a/src/tracker-store/tracker-dbus.c b/src/tracker-store/tracker-dbus.c
index 208d74f..87e4ed4 100644
--- a/src/tracker-store/tracker-dbus.c
+++ b/src/tracker-store/tracker-dbus.c
@@ -349,7 +349,7 @@ tracker_dbus_register_prepare_class_signal (void)
 		return FALSE;
 	}
 
-	tracker_resources_prepare (resources);
+	tracker_resources_enable_signals (resources);
 
 	return TRUE;
 }
diff --git a/src/tracker-store/tracker-resources.c b/src/tracker-store/tracker-resources.c
index 5672511..e775e3a 100644
--- a/src/tracker-store/tracker-resources.c
+++ b/src/tracker-store/tracker-resources.c
@@ -750,7 +750,7 @@ on_statement_deleted (gint         graph_id,
 }
 
 void
-tracker_resources_prepare (TrackerResources *object)
+tracker_resources_enable_signals (TrackerResources *object)
 {
 	TrackerResourcesPrivate *priv;
 
@@ -760,11 +760,10 @@ tracker_resources_prepare (TrackerResources *object)
 	tracker_data_add_delete_statement_callback (on_statement_deleted, object);
 	tracker_data_add_commit_statement_callback (on_statements_committed, object);
 	tracker_data_add_rollback_statement_callback (on_statements_rolled_back, object);
-
 }
 
-static void
-tracker_resources_finalize (GObject      *object)
+void
+tracker_resources_disable_signals (TrackerResources *object)
 {
 	TrackerResourcesPrivate *priv;
 
@@ -778,6 +777,16 @@ tracker_resources_finalize (GObject      *object)
 	if (priv->signal_timeout != 0) {
 		g_source_remove (priv->signal_timeout);
 	}
+}
+
+static void
+tracker_resources_finalize (GObject *object)
+{
+	TrackerResourcesPrivate *priv;
+
+	priv = TRACKER_RESOURCES_GET_PRIVATE (object);
+
+	tracker_resources_disable_signals ((TrackerResources *) object);
 
 	dbus_connection_unref (priv->connection);
 
diff --git a/src/tracker-store/tracker-resources.h b/src/tracker-store/tracker-resources.h
index 11c4f15..652a209 100644
--- a/src/tracker-store/tracker-resources.h
+++ b/src/tracker-store/tracker-resources.h
@@ -56,8 +56,8 @@ struct TrackerResourcesClass {
 
 GType             tracker_resources_get_type            (void);
 TrackerResources *tracker_resources_new                 (DBusGConnection        *connection);
-void              tracker_resources_prepare             (TrackerResources       *object);
-void              tracker_resources_unprepare           (TrackerResources       *object);
+void              tracker_resources_enable_signals      (TrackerResources       *object);
+void              tracker_resources_disable_signals     (TrackerResources       *object);
 
 void              tracker_resources_unreg_batches       (TrackerResources       *object,
                                                          const gchar            *old_owner);



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