tracker r2282 - in trunk: . src/trackerd



Author: mr
Date: Tue Sep 30 14:50:36 2008
New Revision: 2282
URL: http://svn.gnome.org/viewvc/tracker?rev=2282&view=rev

Log:
	* src/trackerd/tracker-crawler.c: 
	* src/trackerd/tracker-crawler.h:
	* src/trackerd/tracker-processor.c: Make sure we reset the boolean
	we used to know if we have already iterated the paths,
	recurse_paths and special_paths lists when we _start(). The API
	was improved and a new function added to clear the special_paths()
	list.


Modified:
   trunk/ChangeLog
   trunk/src/trackerd/tracker-crawler.c
   trunk/src/trackerd/tracker-crawler.h
   trunk/src/trackerd/tracker-processor.c

Modified: trunk/src/trackerd/tracker-crawler.c
==============================================================================
--- trunk/src/trackerd/tracker-crawler.c	(original)
+++ trunk/src/trackerd/tracker-crawler.c	Tue Sep 30 14:50:36 2008
@@ -947,6 +947,11 @@
 	priv->files_found = 0;
 	priv->files_ignored = 0;
 
+	/* Reset paths which have been iterated */
+	priv->paths_are_done = FALSE;
+	priv->recurse_paths_are_done = FALSE;
+	priv->special_paths_are_done = FALSE;
+
 	return TRUE;
 }
 
@@ -991,8 +996,8 @@
  * "Files" module, for example.
  */
 void
-tracker_crawler_add_path (TrackerCrawler *crawler,
-			  const gchar	 *path)
+tracker_crawler_special_paths_add (TrackerCrawler *crawler,
+				   const gchar	 *path)
 {
 	TrackerCrawlerPrivate *priv;
 
@@ -1007,8 +1012,22 @@
 }
 
 void
-tracker_crawler_set_use_module_paths (TrackerCrawler *crawler,
-				      gboolean	      use_paths)
+tracker_crawler_special_paths_clear (TrackerCrawler *crawler)
+{
+	TrackerCrawlerPrivate *priv;
+
+	g_return_if_fail (TRACKER_IS_CRAWLER (crawler));
+
+	priv = crawler->private;
+
+	g_slist_foreach (priv->special_paths, (GFunc) g_free, NULL);
+	g_slist_free (priv->special_paths);
+	priv->special_paths = NULL;
+}
+
+void
+tracker_crawler_use_module_paths (TrackerCrawler *crawler,
+				  gboolean        use_module_paths)
 {
 	TrackerCrawlerPrivate *priv;
 
@@ -1016,7 +1035,7 @@
 
 	priv = crawler->private;
 
-	priv->use_module_paths = use_paths;
+	priv->use_module_paths = use_module_paths;
 }
 
 gboolean

Modified: trunk/src/trackerd/tracker-crawler.h
==============================================================================
--- trunk/src/trackerd/tracker-crawler.h	(original)
+++ trunk/src/trackerd/tracker-crawler.h	Tue Sep 30 14:50:36 2008
@@ -47,20 +47,21 @@
 	GObjectClass	       parent;
 };
 
-GType		tracker_crawler_get_type	     (void);
-TrackerCrawler *tracker_crawler_new		     (TrackerConfig  *config,
-						      const gchar    *module_name);
-gboolean	tracker_crawler_start		     (TrackerCrawler *crawler);
-void		tracker_crawler_stop		     (TrackerCrawler *crawler);
-gboolean	tracker_crawler_is_path_ignored      (TrackerCrawler *crawler,
-						      const gchar    *path,
-						      gboolean	      is_directory);
+GType           tracker_crawler_get_type            (void);
+TrackerCrawler *tracker_crawler_new                 (TrackerConfig  *config,
+						     const gchar    *module_name);
+gboolean        tracker_crawler_start               (TrackerCrawler *crawler);
+void            tracker_crawler_stop                (TrackerCrawler *crawler);
+gboolean        tracker_crawler_is_path_ignored     (TrackerCrawler *crawler,
+						     const gchar    *path,
+						     gboolean        is_directory);
 
 /* Convenience API for old .cfg file */
-void		tracker_crawler_add_path	     (TrackerCrawler *crawler,
-						      const gchar    *path);
-void		tracker_crawler_set_use_module_paths (TrackerCrawler *crawler,
-						      gboolean	      use_paths);
+void            tracker_crawler_special_paths_add   (TrackerCrawler *crawler,
+						     const gchar    *path);
+void            tracker_crawler_special_paths_clear (TrackerCrawler *crawler);
+void            tracker_crawler_use_module_paths    (TrackerCrawler *crawler,
+						     gboolean        use_module_paths);
 
 G_END_DECLS
 

Modified: trunk/src/trackerd/tracker-processor.c
==============================================================================
--- trunk/src/trackerd/tracker-processor.c	(original)
+++ trunk/src/trackerd/tracker-processor.c	Tue Sep 30 14:50:36 2008
@@ -761,6 +761,9 @@
 
 	crawler = g_hash_table_lookup (processor->private->crawlers, module_name);
 
+	tracker_crawler_use_module_paths (crawler, FALSE);
+	tracker_crawler_special_paths_clear (crawler);
+
 #ifdef HAVE_HAL
 	roots = tracker_hal_get_removable_device_roots (processor->private->hal);
 #else  /* HAVE_HAL */
@@ -799,14 +802,12 @@
 		}
 
 		g_message ("    %s", (gchar*) l->data);
-		tracker_crawler_add_path (crawler, l->data);
+		tracker_crawler_special_paths_add (crawler, l->data);
 	}
 
 	if (g_slist_length (roots) == 0) {
 		g_message ("    NONE");
 	}
-
-	tracker_crawler_set_use_module_paths (crawler, FALSE);
 }
 
 static void
@@ -823,6 +824,9 @@
 
 	crawler = g_hash_table_lookup (processor->private->crawlers, module_name);
 
+	tracker_crawler_use_module_paths (crawler, TRUE);
+	tracker_crawler_special_paths_clear (crawler);
+
 	no_watch_roots = tracker_config_get_no_watch_directory_roots (processor->private->config);
 	watch_roots = tracker_config_get_watch_directory_roots (processor->private->config);
 	crawl_roots = tracker_config_get_crawl_directory_roots (processor->private->config);
@@ -877,7 +881,7 @@
 		}
 
 		g_message ("    %s", (gchar*) l->data);
-		tracker_crawler_add_path (crawler, l->data);
+		tracker_crawler_special_paths_add (crawler, l->data);
 	}
 
 	for (l = crawl_roots; l; l = l->next) {
@@ -886,7 +890,7 @@
 		}
 
 		g_message ("    %s", (gchar*) l->data);
-		tracker_crawler_add_path (crawler, l->data);
+		tracker_crawler_special_paths_add (crawler, l->data);
 
 		crawl_root_count++;
 	}



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