[tracker/miner-paranoid-logs: 2/2] libtracker-miner: Add to items_created just just before setting the GFileMonitor



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

    libtracker-miner: Add to items_created just just before setting the GFileMonitor

 src/libtracker-miner/tracker-miner-fs.c |   74 +++++++++++++++++++++++++-----
 1 files changed, 61 insertions(+), 13 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index a81023f..9e1660f 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,16 +2848,17 @@ 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) {
@@ -2832,12 +2868,11 @@ monitor_item_created_cb (TrackerMonitor *monitor,
 		} 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 +2883,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 +2902,7 @@ monitor_item_updated_cb (TrackerMonitor *monitor,
 		item_queue_handlers_set_up (fs);
 	}
 
-	g_free (path);
+	g_free (uri);
 }
 
 static void
@@ -2878,15 +2913,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 +2952,7 @@ monitor_item_deleted_cb (TrackerMonitor *monitor,
 	}
 #endif
 
-	g_free (path);
+	g_free (uri);
 }
 
 static void
@@ -3098,6 +3133,19 @@ crawler_check_directory_contents_cb (TrackerCrawler *crawler,
 	 * the finished sig?
 	 */
 	if (add_monitor) {
+		/* Before adding the monitor, start notifying the store
+		 * about the new directory, so that if any file event comes
+		 * afterwards, the directory is already in store. */
+		g_queue_push_tail (fs->private->items_created,
+		                   g_object_ref (parent));
+		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 (parent),
+		                    fs->private->quark_ignore_file,
+		                    GINT_TO_POINTER (TRUE));
+
 		tracker_monitor_add (fs->private->monitor, parent);
 	} else {
 		tracker_monitor_remove (fs->private->monitor, parent);



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