tracker r2810 - in trunk: . src/plugins/evolution src/trackerd



Author: mr
Date: Tue Jan 20 17:31:55 2009
New Revision: 2810
URL: http://svn.gnome.org/viewvc/tracker?rev=2810&view=rev

Log:
	* src/plugins/evolution/tracker-evolution.c:
	* src/trackerd/tracker-main.c:
	* src/trackerd/tracker-processor.c: Make sure we check the module
	config AND the config for disabled modules and do that EVERYWHERE.
	Don't recusively process the "files" module for removable devices
	if the "files" module is disabled in the config or module config.


Modified:
   trunk/ChangeLog
   trunk/src/plugins/evolution/tracker-evolution.c
   trunk/src/trackerd/tracker-main.c
   trunk/src/trackerd/tracker-processor.c

Modified: trunk/src/plugins/evolution/tracker-evolution.c
==============================================================================
--- trunk/src/plugins/evolution/tracker-evolution.c	(original)
+++ trunk/src/plugins/evolution/tracker-evolution.c	Tue Jan 20 17:31:55 2009
@@ -263,12 +263,22 @@
 static gboolean 
 is_enabled (TrackerConfig *config)
 {
+	const gchar *module_name = "Evolution";
+
 	/* If none of the disabled modules include the Evolution module,
-	 * we assume we are enabled in the configuration. */
+	 * we assume we are enabled in the configuration. 
+	 */
+	if (!tracker_module_config_get_enabled (module_name)) {
+		return FALSE;
+	}
+
+	if (g_slist_find_custom (tracker_config_get_disabled_modules (config),
+				 module_name,
+				 (GCompareFunc) strcmp)) {
+		return FALSE;
+	}
 
-	return (g_slist_find_custom (tracker_config_get_disabled_modules (config),
-				    "Evolution",
-				    (GCompareFunc) g_strcmp0) != NULL);
+	return TRUE;
 }
 
 static void 

Modified: trunk/src/trackerd/tracker-main.c
==============================================================================
--- trunk/src/trackerd/tracker-main.c	(original)
+++ trunk/src/trackerd/tracker-main.c	Tue Jan 20 17:31:55 2009
@@ -410,7 +410,7 @@
 	log_option_list (tracker_config_get_no_index_file_types (config),
 			 "File types excluded from indexing");
 	log_option_list (tracker_config_get_disabled_modules (config),
-			 "Disabled modules");
+			 "Disabled modules (config)");
 }
 
 static gboolean

Modified: trunk/src/trackerd/tracker-processor.c
==============================================================================
--- trunk/src/trackerd/tracker-processor.c	(original)
+++ trunk/src/trackerd/tracker-processor.c	Tue Jan 20 17:31:55 2009
@@ -948,6 +948,25 @@
 	}
 }
 
+static gboolean
+process_module_is_disabled (TrackerProcessor *processor,
+			    const gchar      *module_name)
+{
+	GSList *disabled_modules;
+	
+	if (!tracker_module_config_get_enabled (module_name)) {
+		return TRUE;
+	} 
+
+	disabled_modules = tracker_config_get_disabled_modules (processor->private->config);
+	
+	if (g_slist_find_custom (disabled_modules, module_name, (GCompareFunc) strcmp)) {
+		return TRUE;
+	} 
+
+	return FALSE;
+}
+
 static void
 process_module (TrackerProcessor *processor,
 		const gchar	 *module_name,
@@ -960,14 +979,14 @@
 		   module_name,
 		   is_removable_media ? "(for removable media)" : "");
 
-	/* Check it is enabled */
+	/* Check it is not disabled by the module config */
 	if (!tracker_module_config_get_enabled (module_name)) {
-		g_message ("  Module disabled");
+		g_message ("  Module disabled by module config");
 		process_module_next (processor);
 		return;
 	}
 
-	/* Check it is is not disabled by the user locally */
+	/* Check it is not disabled by the user locally */
 	disabled_modules = tracker_config_get_disabled_modules (processor->private->config);
 	if (g_slist_find_custom (disabled_modules, module_name, (GCompareFunc) strcmp)) {
 		g_message ("  Module disabled by user");
@@ -1020,17 +1039,23 @@
 	if (!processor->private->current_module) {
 		processor->private->iterated_modules = TRUE;
 
-		/* Lastly we handle removable media */
-		if (g_list_length (processor->private->removable_devices) ==
-		    g_list_length (processor->private->removable_devices_completed)) {
+		/* Handle removable media */
+		module_name = "files";
+		is_removable_media = TRUE;
+
+		/* Only if the module is not disabled. Otherwise we
+		 * get into a recursive loop. Also we make sure that
+		 * we haven't already handled all removable devices
+		 * already. 
+		 */
+		
+		if (process_module_is_disabled (processor, module_name) ||
+		    (g_list_length (processor->private->removable_devices) ==
+		     g_list_length (processor->private->removable_devices_completed))) {
 			processor->private->interrupted = FALSE;
 			tracker_processor_stop (processor);
 			return;
 		}
-
-		/* We use this for removable media */
-		module_name = "files";
-		is_removable_media = TRUE;
 	} else {
 		module_name = processor->private->current_module->data;
 		is_removable_media = FALSE;



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