[tracker/miner-fs-refactor: 100/119] libtracker-miner: Fix problems with directories going out and into config again



commit 23f2c104d2d2b099028681113a27d8a710046431
Author: Carlos Garnacho <carlos lanedo com>
Date:   Thu Oct 20 13:58:47 2011 +0200

    libtracker-miner: Fix problems with directories going out and into config again
    
    Remove the queried/crawled flags before possibly reindexing a dir tree for the
    second time (i.e. mounts). Also, check correctly the pending index roots when
    a dir is added or removed.

 src/libtracker-miner/tracker-file-notifier.c |   24 +++++++++++++++++++-----
 1 files changed, 19 insertions(+), 5 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-file-notifier.c b/src/libtracker-miner/tracker-file-notifier.c
index 259a073..f9eda71 100644
--- a/src/libtracker-miner/tracker-file-notifier.c
+++ b/src/libtracker-miner/tracker-file-notifier.c
@@ -552,6 +552,17 @@ crawl_directories_start (TrackerFileNotifier *notifier)
 		                                directory,
 		                                &flags);
 
+		/* Unset crawled/queried checks on the
+		 * directory, we might have requested a
+		 * reindex.
+		 */
+		tracker_file_system_unset_property (priv->file_system,
+						    directory,
+						    quark_property_crawled);
+		tracker_file_system_unset_property (priv->file_system,
+						    directory,
+						    quark_property_queried);
+
 		if ((flags & TRACKER_DIRECTORY_FLAG_IGNORE) == 0 &&
 		    tracker_crawler_start (priv->crawler,
 		                           directory,
@@ -962,10 +973,12 @@ indexing_tree_directory_added (TrackerIndexingTree *indexing_tree,
 		start_crawler = TRUE;
 	}
 
-	priv->pending_index_roots = g_list_append (priv->pending_index_roots,
-	                                           directory);
-	if (start_crawler) {
-		crawl_directories_start (notifier);
+	if (!g_list_find (priv->pending_index_roots, directory)) {
+		priv->pending_index_roots = g_list_append (priv->pending_index_roots,
+		                                           directory);
+		if (start_crawler) {
+			crawl_directories_start (notifier);
+		}
 	}
 }
 
@@ -986,7 +999,8 @@ indexing_tree_directory_removed (TrackerIndexingTree *indexing_tree,
 		g_signal_emit (notifier, signals[FILE_DELETED], 0, directory);
 	}
 
-	if (directory == priv->pending_index_roots->data) {
+	if (priv->pending_index_roots &&
+	    directory == priv->pending_index_roots->data) {
 		/* Directory being currently processed */
 		tracker_crawler_stop (priv->crawler);
 



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