[tracker/miner-fs-refactor: 99/127] tracker-miner-fs: Remove the preserve flag if a dir is removed from config



commit f3337b63ab8cc3c444a92dae7b16482c47b83346
Author: Carlos Garnacho <carlos lanedo com>
Date:   Thu Oct 20 13:55:48 2011 +0200

    tracker-miner-fs: Remove the preserve flag if a dir is removed from config
    
    We don't want to know anymore about that directory, even if it happened
    to be within a mount point

 src/miners/fs/tracker-miner-files.c |   22 +++++++++++++++++++---
 1 files changed, 19 insertions(+), 3 deletions(-)
---
diff --git a/src/miners/fs/tracker-miner-files.c b/src/miners/fs/tracker-miner-files.c
index 4f6051f..7f86d1a 100644
--- a/src/miners/fs/tracker-miner-files.c
+++ b/src/miners/fs/tracker-miner-files.c
@@ -1629,16 +1629,32 @@ update_directories_from_new_config (TrackerMinerFS *mf,
 
 			g_message ("  Removing directory: '%s'", path);
 
+			file = g_file_new_for_path (path);
+
+			/* First, remove the preserve flag, it might be
+			 * set on configuration directories within mount
+			 * points, as data should be persistent across
+			 * unmounts.
+			 */
+			tracker_indexing_tree_get_root (indexing_tree,
+							file, &flags);
+
+			if ((flags & TRACKER_DIRECTORY_FLAG_PRESERVE) != 0) {
+				flags &= ~(TRACKER_DIRECTORY_FLAG_PRESERVE);
+				tracker_indexing_tree_add (indexing_tree,
+							   file, flags);
+			}
+
 			/* Fully remove item (monitors and from store),
-			 * directories from configuration do not have the
-			 * preserve flag set.
+			 * now that there's no preserve flag.
 			 */
-			file = g_file_new_for_path (path);
 			tracker_indexing_tree_remove (indexing_tree, file);
 			g_object_unref (file);
 		}
 	}
 
+	flags = TRACKER_DIRECTORY_FLAG_NONE;
+
 	if (recurse) {
 		flags |= TRACKER_DIRECTORY_FLAG_RECURSE;
 	}



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