[tracker/tracker-0.6] Make tracker-search use the iface invalidation mechanism.



commit f6fe55ed05d15c6d995b521c47088e81d06d5cdf
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Jun 3 15:37:16 2009 +0200

    Make tracker-search use the iface invalidation mechanism.
    
    This is necessary now that the DB manager can be restarted in the middle
    of trackerd lifetime.
---
 src/trackerd/tracker-search.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/src/trackerd/tracker-search.c b/src/trackerd/tracker-search.c
index cfa9ce6..898ed63 100644
--- a/src/trackerd/tracker-search.c
+++ b/src/trackerd/tracker-search.c
@@ -1304,6 +1304,25 @@ search_sql_iface_cleanup_cb (gpointer user_data)
 	return FALSE;
 }
 
+static void
+search_sql_iface_invalidate (TrackerDBInterface *iface,
+			     TrackerSearch      *object)
+{
+	TrackerSearchPrivate *priv;
+
+	priv = TRACKER_SEARCH_GET_PRIVATE (object);
+
+	if (priv->sql_query_timeout_id != 0) {
+		g_source_remove (priv->sql_query_timeout_id);
+		priv->sql_query_timeout_id = 0;
+	}
+
+	if (priv->sql_query_iface) {
+		g_object_unref (priv->sql_query_iface);
+		priv->sql_query_iface = NULL;
+	}
+}
+
 void
 tracker_search_sql_query (TrackerSearch		*object,
 			  gchar 		*query,
@@ -1340,6 +1359,9 @@ tracker_search_sql_query (TrackerSearch		*object,
 								 TRACKER_DB_FILE_METADATA,
 								 TRACKER_DB_EMAIL_CONTENTS,
 								 TRACKER_DB_EMAIL_METADATA);
+
+		g_signal_connect (priv->sql_query_iface, "invalidated",
+				  G_CALLBACK (search_sql_iface_invalidate), object);
 	}
 
 	result_set = tracker_db_interface_execute_query (priv->sql_query_iface,



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