[tracker] TrackerMinerFS: Add tracker_miner_fs_force_recheck().



commit 2908f84a2ed11e22c15079e7c9d8ae68c4837933
Author: Carlos Garnacho <carlos lanedo com>
Date:   Mon Mar 1 18:06:22 2010 +0100

    TrackerMinerFS: Add tracker_miner_fs_force_recheck().
    
    This new call forces recheck on any directory previously passed through
    tracker_miner_fs_directory_add(). In addition, monitors are now also
    removed during the (re)crawling phase if told by the implementation.

 src/libtracker-miner/tracker-miner-fs.c |   37 ++++++++++++++++++++++++------
 src/libtracker-miner/tracker-miner-fs.h |    3 ++
 2 files changed, 32 insertions(+), 8 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index e87fbd7..6a43aee 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -2310,6 +2310,11 @@ crawler_check_directory_cb (TrackerCrawler *crawler,
 		                    GINT_TO_POINTER (TRUE));
 	}
 
+	if (!should_check) {
+		/* Remove monitors if any */
+		tracker_monitor_remove (fs->private->monitor, file);
+	}
+
 	/* We _HAVE_ to check ALL directories because mtime updates
 	 * are not guaranteed on parents on Windows AND we on Linux
 	 * only the immediate parent directory mtime is updated, this
@@ -2328,21 +2333,22 @@ crawler_check_directory_contents_cb (TrackerCrawler *crawler,
                                      gpointer        user_data)
 {
 	TrackerMinerFS *fs = user_data;
+	gboolean add_monitor = FALSE;
 	gboolean process;
 
 	g_signal_emit (fs, signals[CHECK_DIRECTORY_CONTENTS], 0, parent, children, &process);
 
 	if (process) {
-		gboolean add_monitor;
-
 		g_signal_emit (fs, signals[MONITOR_DIRECTORY], 0, parent, &add_monitor);
+	}
 
-		/* FIXME: Should we add here or when we process the queue in
-		 * the finished sig?
-		 */
-		if (add_monitor) {
-			tracker_monitor_add (fs->private->monitor, parent);
-		}
+	/* FIXME: Should we add here or when we process the queue in
+	 * the finished sig?
+	 */
+	if (add_monitor) {
+		tracker_monitor_add (fs->private->monitor, parent);
+	} else {
+		tracker_monitor_remove (fs->private->monitor, parent);
 	}
 
 	return process;
@@ -2931,3 +2937,18 @@ tracker_miner_fs_get_parent_urn (TrackerMinerFS *fs,
 
 	return data->parent_urn;
 }
+
+void
+tracker_miner_fs_force_recheck (TrackerMinerFS *fs)
+{
+	GList *directories;
+
+	g_return_if_fail (TRACKER_IS_MINER_FS (fs));
+
+	g_message ("Forcing re-check on all index directories");
+
+	directories = g_list_copy (fs->private->config_directories);
+	fs->private->directories = g_list_concat (fs->private->directories, directories);
+
+	crawl_directories_start (fs);
+}
diff --git a/src/libtracker-miner/tracker-miner-fs.h b/src/libtracker-miner/tracker-miner-fs.h
index 8ab3efe..4ff2ab2 100644
--- a/src/libtracker-miner/tracker-miner-fs.h
+++ b/src/libtracker-miner/tracker-miner-fs.h
@@ -109,6 +109,9 @@ G_CONST_RETURN gchar * tracker_miner_fs_get_urn        (TrackerMinerFS *fs,
 G_CONST_RETURN gchar * tracker_miner_fs_get_parent_urn (TrackerMinerFS *fs,
 							GFile          *file);
 
+void     tracker_miner_fs_force_recheck    (TrackerMinerFS *fs);
+
+
 G_END_DECLS
 
 #endif /* __LIBTRACKERMINER_MINER_FS_H__ */



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