[tracker/libtracker-miner] Started removing TrackerConfig



commit b6e2a9e0231f59994e933079677dbfe4cd82989e
Author: Martyn Russell <martyn imendio com>
Date:   Mon Aug 3 14:52:22 2009 +0100

    Started removing TrackerConfig

 src/libtracker-miner/tracker-crawler.c       |   12 +++----
 src/libtracker-miner/tracker-crawler.h       |    2 +-
 src/libtracker-miner/tracker-miner-crawler.c |    6 ++--
 src/libtracker-miner/tracker-monitor.c       |   14 ++++----
 src/libtracker-miner/tracker-monitor.h       |    4 +--
 src/libtracker-miner/tracker-processor.c     |   42 ++++++++++++-------------
 src/libtracker-miner/tracker-processor.h     |    3 +-
 src/libtracker-miner/tracker-status.c        |   13 +++++++-
 8 files changed, 50 insertions(+), 46 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-crawler.c b/src/libtracker-miner/tracker-crawler.c
index e64abef..2825ae4 100644
--- a/src/libtracker-miner/tracker-crawler.c
+++ b/src/libtracker-miner/tracker-crawler.c
@@ -256,22 +256,16 @@ tracker_crawler_finalize (GObject *object)
 	g_queue_foreach (priv->directories, (GFunc) g_object_unref, NULL);
 	g_queue_free (priv->directories);
 
-	g_object_unref (priv->config);
-
 	G_OBJECT_CLASS (tracker_crawler_parent_class)->finalize (object);
 }
 
 TrackerCrawler *
-tracker_crawler_new (TrackerConfig *config)
+tracker_crawler_new (void)
 {
 	TrackerCrawler *crawler;
 
-	g_return_val_if_fail (TRACKER_IS_CONFIG (config), NULL);
-
 	crawler = g_object_new (TRACKER_TYPE_CRAWLER, NULL);
 
-	crawler->private->config = g_object_ref (config);
-
 	/* Set up crawl data */
 	crawler->private->ignored_directory_patterns =
 		tracker_module_config_get_ignored_directory_patterns ("files");
@@ -494,7 +488,9 @@ process_func (gpointer data)
 	 * took the time to crawl 130k files from 7 seconds up to 68
 	 * seconds. So it is important to get this figure right.
 	 */
+#ifdef FIX
 	tracker_throttle (priv->config, 25);
+#endif
 
 	/* Crawler files */
 	file = g_queue_pop_head (priv->files);
@@ -1021,6 +1017,7 @@ tracker_crawler_start (TrackerCrawler *crawler)
 	g_slist_foreach (l, (GFunc) g_free, NULL);
 	g_slist_free (l);
 
+#ifdef FIX
 	/* Set up legacy NoWatchDirectoryRoots so we don't have to get
 	 * them from the config for EVERY file we traverse.
 	 */
@@ -1038,6 +1035,7 @@ tracker_crawler_start (TrackerCrawler *crawler)
 	g_slist_free (priv->crawl_directory_roots);
 	l = tracker_config_get_crawl_directory_roots (priv->config);
 	priv->crawl_directory_roots = tracker_gslist_copy_with_string_data (l);
+#endif
 
 	/* Time the event */
 	if (priv->timer) {
diff --git a/src/libtracker-miner/tracker-crawler.h b/src/libtracker-miner/tracker-crawler.h
index f2844c0..26419eb 100644
--- a/src/libtracker-miner/tracker-crawler.h
+++ b/src/libtracker-miner/tracker-crawler.h
@@ -48,7 +48,7 @@ struct _TrackerCrawlerClass {
 };
 
 GType           tracker_crawler_get_type            (void);
-TrackerCrawler *tracker_crawler_new                 (TrackerConfig  *config);
+TrackerCrawler *tracker_crawler_new                 (void);
 gboolean        tracker_crawler_start               (TrackerCrawler *crawler);
 void            tracker_crawler_stop                (TrackerCrawler *crawler);
 gboolean        tracker_crawler_is_path_ignored     (TrackerCrawler *crawler,
diff --git a/src/libtracker-miner/tracker-miner-crawler.c b/src/libtracker-miner/tracker-miner-crawler.c
index c2aac98..47f0e87 100644
--- a/src/libtracker-miner/tracker-miner-crawler.c
+++ b/src/libtracker-miner/tracker-miner-crawler.c
@@ -148,10 +148,10 @@ tracker_miner_crawler_init (TrackerMinerCrawler *miner)
 	priv->config = tracker_config_new ();
 	priv->storage = tracker_storage_new ();
 
-	priv->processor = tracker_processor_new (priv->config, priv->storage);
+	priv->processor = tracker_processor_new (priv->storage);
 
-	g_signal_connect (priv->processor, "check-file",
-			  G_CALLBACK (processor_check_file), miner);
+	/* g_signal_connect (priv->processor, "check-file", */
+	/* 		  G_CALLBACK (processor_check_file), miner); */
 
 	priv->dirs = g_array_new (FALSE, TRUE, sizeof (DirectoryData));
 	priv->files_queue = g_queue_new ();
diff --git a/src/libtracker-miner/tracker-monitor.c b/src/libtracker-miner/tracker-monitor.c
index a20a410..966c8a6 100644
--- a/src/libtracker-miner/tracker-monitor.c
+++ b/src/libtracker-miner/tracker-monitor.c
@@ -343,8 +343,6 @@ tracker_monitor_finalize (GObject *object)
 	g_hash_table_unref (priv->cached_events);
 	g_hash_table_unref (priv->event_pairs);
 
-	g_object_unref (priv->config);
-
 	G_OBJECT_CLASS (tracker_monitor_parent_class)->finalize (object);
 }
 
@@ -1181,19 +1179,15 @@ libinotify_monitor_cancel (gpointer data)
 }
 
 TrackerMonitor *
-tracker_monitor_new (TrackerConfig *config)
+tracker_monitor_new (void)
 {
 	TrackerMonitor	      *monitor;
 	TrackerMonitorPrivate *priv;
 
-	g_return_val_if_fail (TRACKER_IS_CONFIG (config), NULL);
-
 	monitor = g_object_new (TRACKER_TYPE_MONITOR, NULL);
 
 	priv = monitor->private;
 
-	priv->config = g_object_ref (config);
-
 	return monitor;
 }
 
@@ -1228,9 +1222,11 @@ tracker_monitor_add (TrackerMonitor *monitor,
 	g_return_val_if_fail (TRACKER_IS_MONITOR (monitor), FALSE);
 	g_return_val_if_fail (G_IS_FILE (file), FALSE);
 
+#ifdef FIX
 	if (!tracker_config_get_enable_watches (monitor->private->config)) {
 		return TRUE;
 	}
+#endif
 
 	if (!monitor->private->monitors) {
 		g_critical ("Could not add monitor, no monitors are set up");
@@ -1257,7 +1253,11 @@ tracker_monitor_add (TrackerMonitor *monitor,
 
 	path = g_file_get_path (file);
 
+#ifdef FIX
 	ignored_roots = tracker_config_get_no_watch_directory_roots (monitor->private->config);
+#else
+	ignored_roots = NULL;
+#endif
 
 	/* Check this location isn't excluded in the config */
 	for (l = ignored_roots; l; l = l->next) {
diff --git a/src/libtracker-miner/tracker-monitor.h b/src/libtracker-miner/tracker-monitor.h
index 135389f..af5b2b0 100644
--- a/src/libtracker-miner/tracker-monitor.h
+++ b/src/libtracker-miner/tracker-monitor.h
@@ -25,8 +25,6 @@
 #include <glib-object.h>
 #include <gio/gio.h>
 
-#include "tracker-config.h"
-
 G_BEGIN_DECLS
 
 #define TRACKER_TYPE_MONITOR		(tracker_monitor_get_type ())
@@ -50,7 +48,7 @@ struct _TrackerMonitorClass {
 };
 
 GType		tracker_monitor_get_type	     (void);
-TrackerMonitor *tracker_monitor_new		     (TrackerConfig  *config);
+TrackerMonitor *tracker_monitor_new		     (void);
 gboolean	tracker_monitor_get_enabled	     (TrackerMonitor *monitor);
 void		tracker_monitor_set_enabled	     (TrackerMonitor *monitor,
 						      gboolean	      enabled);
diff --git a/src/libtracker-miner/tracker-processor.c b/src/libtracker-miner/tracker-processor.c
index 14466bb..6369cae 100644
--- a/src/libtracker-miner/tracker-processor.c
+++ b/src/libtracker-miner/tracker-processor.c
@@ -47,7 +47,6 @@ typedef enum {
 } SentType;
 
 struct TrackerProcessorPrivate {
-	TrackerConfig  *config;
 	TrackerStorage *hal;
 	TrackerMonitor *monitor;
 
@@ -291,8 +290,6 @@ tracker_processor_finalize (GObject *object)
 	}
 #endif /* HAVE_HAL */
 
-	g_object_unref (priv->config);
-
 	G_OBJECT_CLASS (tracker_processor_parent_class)->finalize (object);
 }
 
@@ -352,10 +349,12 @@ path_should_be_ignored_for_media (TrackerProcessor *processor,
 	gboolean  ignore_removable_devices;
 	gboolean  ignore = FALSE;
 
+#ifdef FIX
 	ignore_mounted_directories =
 		!tracker_config_get_index_mounted_directories (processor->private->config);
 	ignore_removable_devices =
 		!tracker_config_get_index_removable_devices (processor->private->config);
+#endif
 
 	if (ignore_mounted_directories || ignore_removable_devices) {
 		get_remote_roots (processor,
@@ -600,7 +599,6 @@ is_path_on_ignore_list (GSList	    *ignore_list,
 static void
 process_files_add_legacy_options (TrackerProcessor *processor)
 {
-	TrackerCrawler *crawler;
 	GSList	       *no_watch_roots;
 	GSList	       *watch_roots;
 	GSList	       *crawl_roots;
@@ -611,9 +609,15 @@ process_files_add_legacy_options (TrackerProcessor *processor)
 	tracker_crawler_use_module_paths (processor->private->crawler, TRUE);
 	tracker_crawler_special_paths_clear (processor->private->crawler);
 
+#ifdef FIX
 	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);
+#else
+	no_watch_roots = NULL;
+	watch_roots = g_slist_append (NULL, g_get_home_dir ());
+	crawl_roots = NULL;
+#endif
 
 	watch_root_count = 0;
 	crawl_root_count = 0;
@@ -665,7 +669,7 @@ process_files_add_legacy_options (TrackerProcessor *processor)
 		}
 
 		g_message ("    %s", (gchar*) l->data);
-		tracker_crawler_special_paths_add (crawler, l->data);
+		tracker_crawler_special_paths_add (processor->private->crawler, l->data);
 	}
 
 	for (l = crawl_roots; l; l = l->next) {
@@ -674,7 +678,7 @@ process_files_add_legacy_options (TrackerProcessor *processor)
 		}
 
 		g_message ("    %s", (gchar*) l->data);
-		tracker_crawler_special_paths_add (crawler, l->data);
+		tracker_crawler_special_paths_add (processor->private->crawler, l->data);
 
 		crawl_root_count++;
 	}
@@ -689,7 +693,6 @@ static void
 process_device (TrackerProcessor *processor,
 		const gchar	 *device_root)
 {
-	TrackerCrawler *crawler;
 	GFile          *file;
 
 	g_message ("Processing device with root:'%s'", device_root);
@@ -713,9 +716,9 @@ process_device (TrackerProcessor *processor,
 	tracker_monitor_add (processor->private->monitor, file);
 	g_object_unref (file);
 	
-	tracker_crawler_special_paths_add (crawler, device_root);
+	tracker_crawler_special_paths_add (processor->private->crawler, device_root);
 
-	if (!tracker_crawler_start (crawler)) {
+	if (!tracker_crawler_start (processor->private->crawler)) {
 		process_device_next (processor);
 	}
 }
@@ -1024,7 +1027,6 @@ processor_files_check (TrackerProcessor *processor,
 		       GFile		*file,
 		       gboolean		 is_directory)
 {
-	TrackerCrawler *crawler;
 	gboolean	ignored;
 	gchar	       *path;
 
@@ -1038,7 +1040,7 @@ processor_files_check (TrackerProcessor *processor,
 
 	if (!ignored) {
 		if (is_directory) {
-			tracker_crawler_add_unexpected_path (crawler, path);
+			tracker_crawler_add_unexpected_path (processor->private->crawler, path);
 		}
 
 		g_queue_push_tail (processor->private->items_created_queue, 
@@ -1108,7 +1110,6 @@ processor_files_move (TrackerProcessor *processor,
 		      GFile	       *other_file,
 		      gboolean		is_directory)
 {
-	TrackerCrawler *crawler;
 	gchar	       *path;
 	gchar	       *other_path;
 	gboolean	path_ignored;
@@ -1139,7 +1140,7 @@ processor_files_move (TrackerProcessor *processor,
 		}
 
 		/* If this is a directory we need to crawl it */
-		tracker_crawler_add_unexpected_path (crawler, other_path);
+		tracker_crawler_add_unexpected_path (processor->private->crawler, other_path);
 	} else if (other_path_ignored) {
 		/* Delete old file */
 		g_queue_push_tail (processor->private->items_deleted_queue, g_object_ref (file));
@@ -1374,26 +1375,23 @@ mount_point_removed_cb (TrackerStorage *hal,
 #endif /* HAVE_HAL */
 
 TrackerProcessor *
-tracker_processor_new (TrackerConfig  *config,
-		       TrackerStorage *storage)
+tracker_processor_new (TrackerStorage *storage)
 {
 	TrackerProcessor	*processor;
 	TrackerProcessorPrivate *priv;
 
-	g_return_val_if_fail (TRACKER_IS_CONFIG (config), NULL);
-
 #ifdef HAVE_HAL
 	g_return_val_if_fail (TRACKER_IS_STORAGE (storage), NULL);
 #endif /* HAVE_HAL */
 
+	tracker_status_init (NULL, tracker_power_new ());
+	tracker_module_config_init ();
+
 	tracker_status_set_and_signal (TRACKER_STATUS_INITIALIZING);
 
 	processor = g_object_new (TRACKER_TYPE_PROCESSOR, NULL);
 	priv = processor->private;
 
-	/* Set up config */
-	priv->config = g_object_ref (config);
-
 #ifdef HAVE_HAL
 	/* Set up hal */
 	priv->hal = g_object_ref (storage);
@@ -1409,7 +1407,7 @@ tracker_processor_new (TrackerConfig  *config,
 #endif /* HAVE_HAL */
 
 	/* Set up the crawlers now we have config and hal */
-	priv->crawler = tracker_crawler_new (priv->config);
+	priv->crawler = tracker_crawler_new ();
 
 	g_signal_connect (priv->crawler, "processing-file",
 			  G_CALLBACK (crawler_processing_file_cb),
@@ -1422,7 +1420,7 @@ tracker_processor_new (TrackerConfig  *config,
 			  processor);
 
 	/* Set up the monitor */
-	priv->monitor = tracker_monitor_new (config);
+	priv->monitor = tracker_monitor_new ();
 
 	g_message ("Disabling monitor events until we have crawled the file system");
 	tracker_monitor_set_enabled (priv->monitor, FALSE);
diff --git a/src/libtracker-miner/tracker-processor.h b/src/libtracker-miner/tracker-processor.h
index e367b0c..8f30aa9 100644
--- a/src/libtracker-miner/tracker-processor.h
+++ b/src/libtracker-miner/tracker-processor.h
@@ -54,8 +54,7 @@ struct TrackerProcessorClass {
 
 GType		  tracker_processor_get_type		    (void) G_GNUC_CONST;
 
-TrackerProcessor *tracker_processor_new			    (TrackerConfig    *config,
-							     TrackerStorage   *storage);
+TrackerProcessor *tracker_processor_new			    (TrackerStorage   *storage);
 void		  tracker_processor_start		    (TrackerProcessor *processor);
 void		  tracker_processor_stop		    (TrackerProcessor *processor);
 
diff --git a/src/libtracker-miner/tracker-status.c b/src/libtracker-miner/tracker-status.c
index 191b39d..fdb175c 100644
--- a/src/libtracker-miner/tracker-status.c
+++ b/src/libtracker-miner/tracker-status.c
@@ -45,7 +45,6 @@ typedef struct {
 
 	gint           cpu_priority;
 
-	TrackerConfig *config;
 	TrackerPower  *hal;
 
 
@@ -87,11 +86,13 @@ private_free (gpointer data)
 		g_source_remove (private->disk_space_check_id);
 	}
 
+#ifdef FIX
 	g_signal_handlers_disconnect_by_func (private->config,
 					      low_disk_space_limit_cb,
 					      NULL);
 
 	g_object_unref (private->config);
+#endif
 
 #ifdef HAVE_HAL
 	g_signal_handlers_disconnect_by_func (private->hal,
@@ -165,11 +166,13 @@ disk_space_check (void)
 	private = g_static_private_get (&private_key);
 	g_return_val_if_fail (private != NULL, FALSE);
 
+#ifdef FIX
 	limit = tracker_config_get_low_disk_space_limit (private->config);
 
 	if (limit < 1) {
 		return FALSE;
 	}
+#endif
 
 	data_dir = g_build_filename (g_get_user_cache_dir (),
 				     "tracker",
@@ -218,6 +221,7 @@ disk_space_check_start (void)
 		return;
 	}
 
+#ifdef FIX
 	limit = tracker_config_get_low_disk_space_limit (private->config);
 
 	if (limit != -1) {
@@ -235,6 +239,7 @@ disk_space_check_start (void)
 	} else {
 		g_message ("Not setting disk space, configuration is set to -1 (disabled)");
 	}
+#endif
 }
 
 static void
@@ -275,6 +280,7 @@ set_up_throttle (gboolean debugging)
 	 * 0), then set the throttle to be higher so we don't kill
 	 * the laptop battery.
 	 */
+#ifdef FIX
 	throttle = tracker_config_get_throttle (private->config);
 
 	if (tracker_power_get_on_battery (private->hal)) {
@@ -318,6 +324,7 @@ set_up_throttle (gboolean debugging)
 			}
 		}
 	}
+#endif
 }
 
 static void
@@ -367,7 +374,9 @@ tracker_status_init (TrackerConfig *config,
 	GType		      type;
 	TrackerStatusPrivate *private;
 
+#ifdef FIX
 	g_return_val_if_fail (TRACKER_IS_CONFIG (config), FALSE);
+#endif
 
 	private = g_static_private_get (&private_key);
 	if (private) {
@@ -393,11 +402,13 @@ tracker_status_init (TrackerConfig *config,
 	type = tracker_status_get_type ();
 	private->type_class = g_type_class_ref (type);
 
+#ifdef FIX
 	private->config = g_object_ref (config);
 
 	g_signal_connect (private->config, "notify::low-disk-space-limit",
 			  G_CALLBACK (low_disk_space_limit_cb),
 			  NULL);
+#endif
 
 
 #ifdef HAVE_HAL 



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