[tracker/libtracker-miner] Removed tracker-module-config.[ch]



commit 8cd44b4b1caf6bbe7504eafea6fcc21e0884fc46
Author: Martyn Russell <martyn imendio com>
Date:   Mon Aug 17 11:44:55 2009 +0100

    Removed tracker-module-config.[ch]

 src/libtracker-common/Makefile.am             |    2 -
 src/libtracker-common/tracker-common.h        |    1 -
 src/libtracker-common/tracker-module-config.c |  897 -------------------------
 src/libtracker-common/tracker-module-config.h |   61 --
 src/libtracker-miner/tracker-miner-process.c  |    4 -
 src/libtracker-miner/tracker-monitor.c        |  112 +++-
 src/libtracker-miner/tracker-monitor.h        |   34 +-
 src/tracker-miner-fs/tracker-config.c         |    5 +-
 src/tracker-miner-fs/tracker-crawler.c        |   21 +-
 src/tracker-miner-fs/tracker-indexer.c        |   13 +-
 src/tracker-miner-fs/tracker-main.c           |    4 -
 src/tracker-miner-fs/tracker-monitor.c        |    5 -
 src/tracker-miner-fs/tracker-processor.c      |    3 -
 src/tracker-store/tracker-main.c              |    1 -
 14 files changed, 142 insertions(+), 1021 deletions(-)
---
diff --git a/src/libtracker-common/Makefile.am b/src/libtracker-common/Makefile.am
index 1c25ffc..d694874 100644
--- a/src/libtracker-common/Makefile.am
+++ b/src/libtracker-common/Makefile.am
@@ -66,7 +66,6 @@ libtracker_common_la_SOURCES =	 			\
 	tracker-language.c				\
 	tracker-log.c	 				\
 	tracker-marshal-main.c				\
-	tracker-module-config.c				\
 	tracker-namespace.c				\
 	tracker-ontology.c				\
 	tracker-parser.c				\
@@ -94,7 +93,6 @@ libtracker_commoninclude_HEADERS =			\
 	tracker-file-utils.h				\
 	tracker-keyfile-object.h			\
 	tracker-language.h				\
-	tracker-module-config.h				\
 	tracker-namespace.h				\
 	tracker-ontology.h				\
 	tracker-parser.h				\
diff --git a/src/libtracker-common/tracker-common.h b/src/libtracker-common/tracker-common.h
index a8f191f..5a850f2 100644
--- a/src/libtracker-common/tracker-common.h
+++ b/src/libtracker-common/tracker-common.h
@@ -35,7 +35,6 @@ G_BEGIN_DECLS
 #include "tracker-class.h"
 #include "tracker-file-utils.h"
 #include "tracker-language.h"
-#include "tracker-module-config.h"
 #include "tracker-namespace.h"
 #include "tracker-ontology.h"
 #include "tracker-parser.h"
diff --git a/src/libtracker-miner/tracker-miner-process.c b/src/libtracker-miner/tracker-miner-process.c
index 1f10802..8e57075 100644
--- a/src/libtracker-miner/tracker-miner-process.c
+++ b/src/libtracker-miner/tracker-miner-process.c
@@ -20,8 +20,6 @@
 
 #include "config.h"
 
-#include <libtracker-common/tracker-module-config.h>
-
 #include "tracker-crawler.h"
 #include "tracker-marshal.h"
 #include "tracker-miner-process.h"
@@ -210,8 +208,6 @@ tracker_miner_process_init (TrackerMinerProcess *object)
 
 	priv = object->private;
 
-	tracker_module_config_init ();
-
 	/* For each module we create a TrackerCrawler and keep them in
 	 * a hash table to look up.
 	 */
diff --git a/src/libtracker-miner/tracker-monitor.c b/src/libtracker-miner/tracker-monitor.c
index ab6741f..3070474 100644
--- a/src/libtracker-miner/tracker-monitor.c
+++ b/src/libtracker-miner/tracker-monitor.c
@@ -27,7 +27,7 @@
 
 #include <libinotify/libinotify.h>
 
-#include <libtracker-common/tracker-module-config.h>
+#include <libtracker-common/tracker-keyfile-object.h>
 
 #include "tracker-monitor.h"
 #include "tracker-marshal.h"
@@ -52,6 +52,8 @@ struct TrackerMonitorPrivate {
 	GHashTable    *monitors;
 	
 	gboolean       enabled;
+	gint           scan_timeout;
+	gint           cache_timeout;
 
 	GType	       monitor_backend;
 
@@ -93,7 +95,9 @@ enum {
 
 enum {
 	PROP_0,
-	PROP_ENABLED
+	PROP_ENABLED,
+	PROP_SCAN_TIMEOUT,
+	PROP_CACHE_TIMEOUT
 };
 
 static void           tracker_monitor_finalize     (GObject        *object);
@@ -183,6 +187,24 @@ tracker_monitor_class_init (TrackerMonitorClass *klass)
 							       "Enabled",
 							       TRUE,
 							       G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+	g_object_class_install_property (object_class,
+					 PROP_SCAN_TIMEOUT,
+					 g_param_spec_int ("scan-timeout",
+							   "Scan Timeout",
+							   "Time in seconds between same events to prevent flooding (0->1000)",
+							   0,
+							   1000,
+							   0,
+							   G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+	g_object_class_install_property (object_class,
+					 PROP_CACHE_TIMEOUT,
+					 g_param_spec_int ("cache-timeout",
+							   "Scan Timeout",
+							   "Time in seconds for events to be cached (0->1000)",
+							   0,
+							   1000,
+							   60,
+							   G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
 
 	g_type_class_add_private (object_class, sizeof (TrackerMonitorPrivate));
 }
@@ -348,6 +370,14 @@ tracker_monitor_set_property (GObject	   *object,
 		tracker_monitor_set_enabled (TRACKER_MONITOR (object),
 					     g_value_get_boolean (value));
 		break;
+	case PROP_SCAN_TIMEOUT:
+		tracker_monitor_set_scan_timeout (TRACKER_MONITOR (object),
+						  g_value_get_int (value));
+		break;
+	case PROP_CACHE_TIMEOUT:
+		tracker_monitor_set_cache_timeout (TRACKER_MONITOR (object),
+						   g_value_get_int (value));
+		break;
 
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -368,6 +398,12 @@ tracker_monitor_get_property (GObject	   *object,
 	case PROP_ENABLED:
 		g_value_set_boolean (value, priv->enabled);
 		break;
+	case PROP_SCAN_TIMEOUT:
+		g_value_set_int (value, priv->scan_timeout);
+		break;
+	case PROP_CACHE_TIMEOUT:
+		g_value_set_int (value, priv->cache_timeout);
+		break;
 
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -703,8 +739,6 @@ libinotify_cached_events_timeout_cb (gpointer data)
 		EventData   *event;
 		glong	     last_event_seconds;
 		glong        start_event_seconds;
-		gint         cache_timeout;
-		gint         scan_timeout;
 		gboolean     is_directory;
 		gboolean     force_emit = FALSE;
 		gboolean     timed_out = FALSE;
@@ -730,14 +764,12 @@ libinotify_cached_events_timeout_cb (gpointer data)
 		 * the indexer of events for files which are ALWAYS
 		 * changing.
 		 */
-		cache_timeout = tracker_module_config_get_cache_timeout ("files");
-		scan_timeout = tracker_module_config_get_scan_timeout ("files");
-
-		if (cache_timeout > 0) {
-			force_emit = start_event_seconds > cache_timeout;
+		if (monitor->private->cache_timeout > 0) {
+			force_emit = start_event_seconds > monitor->private->cache_timeout;
 		}
 
-		timed_out = last_event_seconds >= MAX (CACHE_LIFETIME_SECONDS, scan_timeout);
+		timed_out = last_event_seconds >= MAX (CACHE_LIFETIME_SECONDS, 
+						       monitor->private->scan_timeout);
 
 		/* Make sure the item is in the cache for at least 2
 		 * seconds OR the time as stated by the module config
@@ -1199,6 +1231,30 @@ tracker_monitor_get_enabled (TrackerMonitor *monitor)
 	return monitor->private->enabled;
 }
 
+gint
+tracker_monitor_get_scan_timeout (TrackerMonitor *monitor)
+{
+	TrackerMonitorPrivate *priv;
+
+	g_return_val_if_fail (TRACKER_IS_MONITOR (monitor), 0);
+
+	priv = TRACKER_MONITOR_GET_PRIVATE (monitor);
+
+	return priv->scan_timeout;
+}
+
+gint
+tracker_monitor_get_cache_timeout (TrackerMonitor *monitor)
+{
+	TrackerMonitorPrivate *priv;
+
+	g_return_val_if_fail (TRACKER_IS_MONITOR (monitor), 60);
+
+	priv = TRACKER_MONITOR_GET_PRIVATE (monitor);
+
+	return priv->cache_timeout;
+}
+
 void
 tracker_monitor_set_enabled (TrackerMonitor *monitor,
 			     gboolean	     enabled)
@@ -1210,6 +1266,42 @@ tracker_monitor_set_enabled (TrackerMonitor *monitor,
 	g_object_notify (G_OBJECT (monitor), "enabled");
 }
 
+void
+tracker_monitor_set_scan_timeout (TrackerMonitor *monitor,
+				  gint            value)
+{
+	TrackerMonitorPrivate *priv;
+
+	g_return_if_fail (TRACKER_IS_MONITOR (monitor));
+
+	if (!tracker_keyfile_object_validate_int (monitor, "scan-timeout", value)) {
+		return;
+	}
+
+	priv = TRACKER_MONITOR_GET_PRIVATE (monitor);
+
+	priv->scan_timeout = value;
+	g_object_notify (G_OBJECT (monitor), "scan-timeout");
+}
+
+void
+tracker_monitor_set_cache_timeout (TrackerMonitor *monitor,
+				   gint            value)
+{
+	TrackerMonitorPrivate *priv;
+
+	g_return_if_fail (TRACKER_IS_MONITOR (monitor));
+
+	if (!tracker_keyfile_object_validate_int (monitor, "cache-timeout", value)) {
+		return;
+	}
+
+	priv = TRACKER_MONITOR_GET_PRIVATE (monitor);
+
+	priv->cache_timeout = value;
+	g_object_notify (G_OBJECT (monitor), "cache-timeout");
+}
+
 gboolean
 tracker_monitor_add (TrackerMonitor *monitor,
 		     GFile	    *file)
diff --git a/src/libtracker-miner/tracker-monitor.h b/src/libtracker-miner/tracker-monitor.h
index ed4d4af..523abb5 100644
--- a/src/libtracker-miner/tracker-monitor.h
+++ b/src/libtracker-miner/tracker-monitor.h
@@ -46,23 +46,31 @@ struct TrackerMonitorClass {
 	GObjectClass parent;
 };
 
-GType		tracker_monitor_get_type	     (void);
-TrackerMonitor *tracker_monitor_new		     (void);
-gboolean	tracker_monitor_get_enabled	     (TrackerMonitor *monitor);
-void		tracker_monitor_set_enabled	     (TrackerMonitor *monitor,
-						      gboolean	      enabled);
-gboolean	tracker_monitor_add		     (TrackerMonitor *monitor,
-						      GFile	     *file);
+GType           tracker_monitor_get_type             (void);
+TrackerMonitor *tracker_monitor_new                  (void);
+
+gboolean        tracker_monitor_get_enabled          (TrackerMonitor *monitor);
+gint            tracker_monitor_get_scan_timeout     (TrackerMonitor *monitor);
+gint            tracker_monitor_get_cache_timeout    (TrackerMonitor *monitor);
+
+void            tracker_monitor_set_enabled          (TrackerMonitor *monitor,
+						      gboolean        enabled);
+void            tracker_monitor_set_scan_timeout     (TrackerMonitor *monitor,
+						      gint            value);
+void            tracker_monitor_set_cache_timeout    (TrackerMonitor *monitor,
+						      gint            value);
+gboolean        tracker_monitor_add                  (TrackerMonitor *monitor,
+						      GFile          *file);
 gboolean        tracker_monitor_remove               (TrackerMonitor *monitor,
 						      GFile          *file);
 gboolean        tracker_monitor_remove_recursively   (TrackerMonitor *monitor,
-						      GFile	     *file);
-gboolean	tracker_monitor_is_watched	     (TrackerMonitor *monitor,
-						      GFile	     *file);
-gboolean	tracker_monitor_is_watched_by_string (TrackerMonitor *monitor,
+						      GFile          *file);
+gboolean        tracker_monitor_is_watched           (TrackerMonitor *monitor,
+						      GFile          *file);
+gboolean        tracker_monitor_is_watched_by_string (TrackerMonitor *monitor,
 						      const gchar    *path);
-guint		tracker_monitor_get_count	     (TrackerMonitor *monitor);
-guint		tracker_monitor_get_ignored	     (TrackerMonitor *monitor);
+guint           tracker_monitor_get_count            (TrackerMonitor *monitor);
+guint           tracker_monitor_get_ignored          (TrackerMonitor *monitor);
 
 G_END_DECLS
 
diff --git a/src/tracker-miner-fs/tracker-config.c b/src/tracker-miner-fs/tracker-config.c
index 905e0d1..566fe14 100644
--- a/src/tracker-miner-fs/tracker-config.c
+++ b/src/tracker-miner-fs/tracker-config.c
@@ -63,8 +63,8 @@ typedef struct {
 	GSList   *monitor_directories;
 	GSList   *monitor_directories_ignored;
 	GSList   *monitor_recurse_directories;
-	guint     scan_timeout;
-	guint     cache_timeout;
+	gint      scan_timeout;
+	gint      cache_timeout;
 
 	/* To be removed */
  	GSList	 *watch_directory_roots;
@@ -1152,7 +1152,6 @@ tracker_config_set_cache_timeout (TrackerConfig *config,
 	g_object_notify (G_OBJECT (config), "cache-timeout");
 }
 
-
 void	       
 tracker_config_set_monitor_directories (TrackerConfig *config,
 					GSList        *roots)
diff --git a/src/tracker-miner-fs/tracker-crawler.c b/src/tracker-miner-fs/tracker-crawler.c
index 1cc1be3..d68b537 100644
--- a/src/tracker-miner-fs/tracker-crawler.c
+++ b/src/tracker-miner-fs/tracker-crawler.c
@@ -28,7 +28,6 @@
 #include <libtracker-common/tracker-file-utils.h>
 #include <libtracker-common/tracker-type-utils.h>
 #include <libtracker-common/tracker-utils.h>
-#include <libtracker-common/tracker-module-config.h>
 
 #include "tracker-config.h"
 #include "tracker-crawler.h"
@@ -281,14 +280,14 @@ tracker_crawler_new (TrackerConfig *config,
 	crawler->private->module_name = g_strdup (module_name);
 
 	/* Set up crawl data */
-	crawler->private->ignored_directory_patterns =
-		tracker_module_config_get_ignored_directory_patterns (module_name);
-	crawler->private->ignored_file_patterns =
-		tracker_module_config_get_ignored_file_patterns (module_name);
-	crawler->private->index_file_patterns =
-		tracker_module_config_get_index_file_patterns (module_name);
-	crawler->private->ignored_directories_with_content =
-		tracker_module_config_get_ignored_directories_with_content (module_name);
+	/* crawler->private->ignored_directory_patterns = */
+	/* 	tracker_module_config_get_ignored_directory_patterns (module_name); */
+	/* crawler->private->ignored_file_patterns = */
+	/* 	tracker_module_config_get_ignored_file_patterns (module_name); */
+	/* crawler->private->index_file_patterns = */
+	/* 	tracker_module_config_get_index_file_patterns (module_name); */
+	/* crawler->private->ignored_directories_with_content = */
+	/* 	tracker_module_config_get_ignored_directories_with_content (module_name); */
 
 	/* Should we use module config paths? If true, when we
 	 * _start() the module config paths are used to import paths
@@ -979,8 +978,8 @@ tracker_crawler_start (TrackerCrawler *crawler)
 
 		g_message ("  Using module paths");
 
-		recurse_paths =	tracker_module_config_get_monitor_recurse_directories (priv->module_name);
-		paths = tracker_module_config_get_monitor_directories (priv->module_name);
+		/* recurse_paths =	tracker_module_config_get_monitor_recurse_directories (priv->module_name); */
+		/* paths = tracker_module_config_get_monitor_directories (priv->module_name); */
 
 		if (recurse_paths || paths) {
 			/* First we do non-recursive directories */
diff --git a/src/tracker-miner-fs/tracker-indexer.c b/src/tracker-miner-fs/tracker-indexer.c
index d689812..885510a 100644
--- a/src/tracker-miner-fs/tracker-indexer.c
+++ b/src/tracker-miner-fs/tracker-indexer.c
@@ -59,7 +59,6 @@
 #include <libtracker-common/tracker-storage.h>
 #include <libtracker-common/tracker-parser.h>
 #include <libtracker-common/tracker-ontology.h>
-#include <libtracker-common/tracker-module-config.h>
 #include <libtracker-common/tracker-utils.h>
 #include <libtracker-common/tracker-thumbnailer.h>
 
@@ -981,15 +980,13 @@ indexer_load_modules (TrackerIndexer *indexer)
 	priv = indexer->private;
 	priv->indexer_modules = g_hash_table_new (g_str_hash, g_str_equal);
 
-	modules = tracker_module_config_get_modules ();
+	/* modules = tracker_module_config_get_modules (); */
+
+	modules = g_list_prepend (NULL, g_strdup ("files"));
 
 	for (l = modules; l; l = l->next) {
 		TrackerIndexerModule *module;
 
-		if (!tracker_module_config_get_enabled (l->data)) {
-			continue;
-		}
-
 		module = tracker_indexer_module_get (l->data);
 
 		if (module) {
@@ -1664,7 +1661,11 @@ process_module (TrackerIndexer *indexer,
 		return;
 	}
 
+#ifdef FIX
 	dirs = tracker_module_config_get_monitor_recurse_directories (module_name);
+#else 
+	dirs = NULL;
+#endif
 
 	if (!dirs) {
 		return;
diff --git a/src/tracker-miner-fs/tracker-main.c b/src/tracker-miner-fs/tracker-main.c
index da71ad2..8a2462f 100644
--- a/src/tracker-miner-fs/tracker-main.c
+++ b/src/tracker-miner-fs/tracker-main.c
@@ -38,7 +38,6 @@
 #include <libtracker-common/tracker-ioprio.h>
 #include <libtracker-common/tracker-log.h>
 #include <libtracker-common/tracker-ontology.h>
-#include <libtracker-common/tracker-module-config.h>
 #include <libtracker-common/tracker-file-utils.h>
 #include <libtracker-common/tracker-thumbnailer.h>
 #include <libtracker-common/tracker-storage.h>
@@ -297,8 +296,6 @@ main (gint argc, gchar *argv[])
 
 	sanity_check_option_values (config);
 
-	tracker_module_config_init ();
-
 	/* Set IO priority */
 	tracker_ioprio_init ();
 
@@ -375,7 +372,6 @@ main (gint argc, gchar *argv[])
         tracker_albumart_shutdown ();
 	tracker_thumbnailer_shutdown ();
 	tracker_dbus_shutdown ();
-	tracker_module_config_shutdown ();
 	tracker_log_shutdown ();
 
 	g_print ("\nOK\n\n");
diff --git a/src/tracker-miner-fs/tracker-monitor.c b/src/tracker-miner-fs/tracker-monitor.c
index d97745f..562d91b 100644
--- a/src/tracker-miner-fs/tracker-monitor.c
+++ b/src/tracker-miner-fs/tracker-monitor.c
@@ -25,7 +25,6 @@
 
 #include <libtracker-common/tracker-dbus.h>
 #include <libtracker-common/tracker-file-utils.h>
-#include <libtracker-common/tracker-module-config.h>
 
 #include <sys/inotify.h>
 #include <libinotify/libinotify.h>
@@ -238,8 +237,6 @@ tracker_monitor_init (TrackerMonitor *object)
 				       g_object_unref,
 				       event_data_free);
 
-	all_modules = tracker_module_config_get_modules ();
-
 	for (l = all_modules; l; l = l->next) {
 		GHashTable *monitors;
 
@@ -874,8 +871,6 @@ libinotify_cached_events_timeout_cb (gpointer data)
 		 * the indexer of events for files which are ALWAYS
 		 * changing.
 		 */
-		cache_timeout = tracker_module_config_get_cache_timeout (module_name);
-		scan_timeout = tracker_module_config_get_scan_timeout (module_name);
 
 		if (cache_timeout > 0) {
 			force_emit = start_event_seconds > cache_timeout;
diff --git a/src/tracker-miner-fs/tracker-processor.c b/src/tracker-miner-fs/tracker-processor.c
index fb1d8b6..acecbb2 100644
--- a/src/tracker-miner-fs/tracker-processor.c
+++ b/src/tracker-miner-fs/tracker-processor.c
@@ -25,7 +25,6 @@
 #include <libtracker-common/tracker-dbus.h>
 #include <libtracker-common/tracker-file-utils.h>
 #include <libtracker-common/tracker-storage.h>
-#include <libtracker-common/tracker-module-config.h>
 #include <libtracker-common/tracker-utils.h>
 
 #include <libtracker-db/tracker-db-manager.h>
@@ -201,8 +200,6 @@ tracker_processor_init (TrackerProcessor *object)
 
 	priv = object->private;
 
-	priv->modules = tracker_module_config_get_modules ();
-
 	/* For each module we create a TrackerCrawler and keep them in
 	 * a hash table to look up.
 	 */
diff --git a/src/tracker-store/tracker-main.c b/src/tracker-store/tracker-main.c
index 9df489d..d8c8f0c 100644
--- a/src/tracker-store/tracker-main.c
+++ b/src/tracker-store/tracker-main.c
@@ -47,7 +47,6 @@
 #include <libtracker-common/tracker-storage.h>
 #include <libtracker-common/tracker-ioprio.h>
 #include <libtracker-common/tracker-log.h>
-#include <libtracker-common/tracker-module-config.h>
 #include <libtracker-common/tracker-ontology.h>
 #include <libtracker-common/tracker-thumbnailer.h>
 



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