[tracker/miner-fs-rename-directory-to-hidden-name] libtracker-miner: make sure original monitors are removed during a move operation



commit 60198ca1fac70ed2268ef6e528e58bc0f1f8ae41
Author: Aleksander Morgado <aleksander lanedo com>
Date:   Tue Dec 14 13:24:29 2010 +0100

    libtracker-miner: make sure original monitors are removed during a move operation

 src/libtracker-miner/tracker-miner-fs.c |   64 ++++++++++++++++++-------------
 1 files changed, 37 insertions(+), 27 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index 4db3178..b4f609e 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -3102,20 +3102,23 @@ monitor_item_moved_cb (TrackerMonitor *monitor,
 	fs = user_data;
 
 	if (!is_source_monitored) {
-		if (is_directory &&
-		    should_recurse_for_directory (fs, other_file)) {
-			gchar *path;
-
-			path = g_file_get_path (other_file);
-
-			g_debug ("Not in store:'?'->'%s' (DIR) (move monitor event, source unknown)",
-			         path);
-
-			/* If the source is not monitored, we need to crawl it. */
-			tracker_miner_fs_directory_add_internal (fs, other_file);
-
-			g_free (path);
+		if (is_directory) {
+			/* Remove monitors if any */
+			tracker_monitor_remove_recursively (fs->private->monitor,
+			                                    file);
+			if (should_recurse_for_directory (fs, other_file)) {
+				gchar *path;
+
+				path = g_file_get_path (other_file);
+				g_debug ("Not in store:'?'->'%s' (DIR) "
+				         "(move monitor event, source unknown)",
+				         path);
+				/* If the source is not monitored, we need to crawl it. */
+				tracker_miner_fs_directory_add_internal (fs, other_file);
+				g_free (path);
+			}
 		}
+		/* else, file, do nothing */
 	} else {
 		gchar *path;
 		gchar *other_path;
@@ -3140,22 +3143,29 @@ monitor_item_moved_cb (TrackerMonitor *monitor,
 		 *        Most of these decisions should be taken when the event is
 		 *        actually being processed.
 		 */
-		if (!source_stored && !should_process_other) {
-			/* Do nothing */
-		} else if (!source_stored) {
-			/* Source file was not stored, check dest file as new */
-			if (!is_directory ||
-			    !should_recurse_for_directory (fs, other_file)) {
-				g_queue_push_tail (fs->private->items_created,
-				                   g_object_ref (other_file));
-
-				item_queue_handlers_set_up (fs);
-			} else {
-				g_debug ("Not in store:'?'->'%s' (DIR) (move monitor event, source monitored)",
-				         path);
+		if (!source_stored) {
+			/* Remove monitors if any */
+			if (is_directory) {
+				tracker_monitor_remove_recursively (fs->private->monitor,
+				                                    file);
+			}
 
-				tracker_miner_fs_directory_add_internal (fs, other_file);
+			if (should_process_other) {
+				/* Source file was not stored, check dest file as new */
+				if (!is_directory ||
+				    !should_recurse_for_directory (fs, other_file)) {
+					g_queue_push_tail (fs->private->items_created,
+					                   g_object_ref (other_file));
+
+					item_queue_handlers_set_up (fs);
+				} else {
+					g_debug ("Not in store:'?'->'%s' (DIR) "
+					         "(move monitor event, source monitored)",
+					         path);
+					tracker_miner_fs_directory_add_internal (fs, other_file);
+				}
 			}
+			/* Else, do nothing else */
 		} else if (!should_process_other) {
 			/* Remove monitors if any */
 			if (is_directory) {



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