[tracker/miner-paranoid-logs] libtracker-miner: Add directory before crawling



commit de3824b90fa1e73d30c02b7b1e0268986029abec
Author: Aleksander Morgado <aleksander lanedo com>
Date:   Thu Aug 5 16:02:33 2010 +0200

    libtracker-miner: Add directory before crawling

 src/libtracker-miner/tracker-miner-fs.c |   79 ++++++++++++++++++++++++-------
 1 files changed, 62 insertions(+), 17 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index a81023f..40634a3 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -2085,6 +2085,24 @@ fill_in_queue (TrackerMinerFS       *fs,
 
 		g_queue_push_tail (dir_data->nodes, node);
 
+#ifdef PARANOID_DEBUG
+		{
+			gboolean ignore;
+			gchar *uri;
+
+			uri = g_file_get_uri (file);
+			ignore = (g_object_get_qdata (G_OBJECT (file),
+			                              fs->private->quark_ignore_file) != NULL ?
+			          TRUE : FALSE);
+
+			paranoid_debug ("(Root dir) File '%s' set as %s",
+			                uri,
+			                ignore ? "IGNORED" : "NOT ignored");
+			g_free (uri);
+		}
+#endif
+
+
 		if (!g_object_get_qdata (G_OBJECT (file), fs->private->quark_ignore_file)) {
 			g_queue_push_tail (queue, g_object_ref (file));
 			return;
@@ -2111,6 +2129,23 @@ fill_in_queue (TrackerMinerFS       *fs,
 			file = children->data;
 			dir_data->n_items_processed++;
 
+#ifdef PARANOID_DEBUG
+		{
+			gboolean ignore;
+			gchar *uri;
+
+			uri = g_file_get_uri (file);
+			ignore = (g_object_get_qdata (G_OBJECT (file),
+			                              fs->private->quark_ignore_file) != NULL ?
+			          TRUE : FALSE);
+
+			paranoid_debug ("(Child) File '%s' set as %s",
+			                uri,
+			                ignore ? "IGNORED" : "NOT ignored");
+			g_free (uri);
+		}
+#endif
+
 			if (!g_object_get_qdata (G_OBJECT (file), fs->private->quark_ignore_file)) {
 				g_queue_push_tail (queue, g_object_ref (file));
 			}
@@ -2813,31 +2848,41 @@ monitor_item_created_cb (TrackerMonitor *monitor,
 {
 	TrackerMinerFS *fs;
 	gboolean should_process = TRUE;
-	gchar *path;
+	gchar *uri;
 
 	fs = user_data;
 	should_process = should_check_file (fs, file, is_directory);
 
-	path = g_file_get_path (file);
+
+	uri = g_file_get_uri (file);
 
 	g_debug ("%s:'%s' (%s) (create monitor event or user request)",
 	         should_process ? "Found " : "Ignored",
-	         path,
+	         uri,
 	         is_directory ? "DIR" : "FILE");
 
 	if (should_process) {
+		paranoid_debug ("Added '%s' to the items created queue", uri);
+
+		/* First, add the directory to the items_created list */
+		g_queue_push_tail (fs->private->items_created,
+		                   g_object_ref (file));
+		item_queue_handlers_set_up (fs);
+
+		/* As we already added here, specify that it shouldn't be added
+		 * any more */
+		g_object_set_qdata (G_OBJECT (file),
+		                    fs->private->quark_ignore_file,
+		                    GINT_TO_POINTER (TRUE));
+
+		/* Then, if applies, recurse */
 		if (is_directory &&
 		    should_recurse_for_directory (fs, file)) {
 			tracker_miner_fs_directory_add_internal (fs, file);
-		} else {
-			g_queue_push_tail (fs->private->items_created,
-			                   g_object_ref (file));
-
-			item_queue_handlers_set_up (fs);
 		}
 	}
 
-	g_free (path);
+	g_free (uri);
 }
 
 static void
@@ -2848,16 +2893,16 @@ monitor_item_updated_cb (TrackerMonitor *monitor,
 {
 	TrackerMinerFS *fs;
 	gboolean should_process;
-	gchar *path;
+	gchar *uri;
 
 	fs = user_data;
 	should_process = should_check_file (fs, file, is_directory);
 
-	path = g_file_get_path (file);
+	uri = g_file_get_uri (file);
 
 	g_debug ("%s:'%s' (%s) (update monitor event or user request)",
 	         should_process ? "Found " : "Ignored",
-	         path,
+	         uri,
 	         is_directory ? "DIR" : "FILE");
 
 	if (should_process) {
@@ -2867,7 +2912,7 @@ monitor_item_updated_cb (TrackerMonitor *monitor,
 		item_queue_handlers_set_up (fs);
 	}
 
-	g_free (path);
+	g_free (uri);
 }
 
 static void
@@ -2878,15 +2923,15 @@ monitor_item_deleted_cb (TrackerMonitor *monitor,
 {
 	TrackerMinerFS *fs;
 	gboolean should_process;
-	gchar *path;
+	gchar *uri;
 
 	fs = user_data;
 	should_process = should_check_file (fs, file, is_directory);
-	path = g_file_get_path (file);
+	uri = g_file_get_uri (file);
 
 	g_debug ("%s:'%s' (%s) (delete monitor event or user request)",
 	         should_process ? "Found " : "Ignored",
-	         path,
+	         uri,
 	         is_directory ? "DIR" : "FILE");
 
 	if (should_process) {
@@ -2917,7 +2962,7 @@ monitor_item_deleted_cb (TrackerMonitor *monitor,
 	}
 #endif
 
-	g_free (path);
+	g_free (uri);
 }
 
 static void



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