[tracker] tracker-miner-fs, applications: If locale change detected always do mtime checks during crawling



commit 8465baae320b25a300ab803ccdf3a5c99e10d3f7
Author: Aleksander Morgado <aleksander lanedo com>
Date:   Thu Mar 10 14:36:47 2011 +0100

    tracker-miner-fs,applications: If locale change detected always do mtime checks during crawling
    
    Fixes NB#235118

 src/miners/fs/tracker-main.c               |   11 ++++++++-
 src/miners/fs/tracker-miner-applications.c |   34 ++++++++++++++-------------
 src/miners/fs/tracker-miner-applications.h |    6 ++--
 3 files changed, 31 insertions(+), 20 deletions(-)
---
diff --git a/src/miners/fs/tracker-main.c b/src/miners/fs/tracker-main.c
index 18a70e5..4df4b8a 100644
--- a/src/miners/fs/tracker-main.c
+++ b/src/miners/fs/tracker-main.c
@@ -678,7 +678,16 @@ main (gint argc, gchar *argv[])
 		return EXIT_FAILURE;
 	}
 	tracker_miner_fs_set_initial_crawling (TRACKER_MINER_FS (miner_applications), do_crawling);
-	tracker_miner_fs_set_mtime_checking (TRACKER_MINER_FS (miner_applications), do_mtime_checking);
+
+	/* If a locale change was detected, always do mtime checks */
+	if (tracker_miner_applications_detect_locale_changed (miner_applications)) {
+		if (!do_mtime_checking)
+			g_debug ("Forcing mtime check in applications miner as locale change was detected");
+		tracker_miner_fs_set_mtime_checking (TRACKER_MINER_FS (miner_applications), TRUE);
+	} else {
+		tracker_miner_fs_set_mtime_checking (TRACKER_MINER_FS (miner_applications), do_mtime_checking);
+	}
+
 	g_signal_connect (miner_applications, "finished",
 	                  G_CALLBACK (miner_finished_cb),
 	                  NULL);
diff --git a/src/miners/fs/tracker-miner-applications.c b/src/miners/fs/tracker-miner-applications.c
index e3e015e..d867318 100644
--- a/src/miners/fs/tracker-miner-applications.c
+++ b/src/miners/fs/tracker-miner-applications.c
@@ -869,26 +869,28 @@ miner_applications_reset (TrackerMiner *miner)
 	g_object_unref (sparql);
 }
 
-TrackerMiner *
-tracker_miner_applications_new (GError **error)
+gboolean
+tracker_miner_applications_detect_locale_changed (TrackerMiner *miner)
 {
-	TrackerMiner *miner;
-
-	miner = g_initable_new (TRACKER_TYPE_MINER_APPLICATIONS,
-	                        NULL,
-	                        error,
-	                        "name", "Applications",
-	                        "processing-pool-wait-limit", 10,
-	                        "processing-pool-ready-limit", 100,
-	                        NULL);
-	if (miner &&
-	    tracker_miner_applications_locale_changed ()) {
-		/* Before returning the newly created miner, check if we need
-		 * to reset it */
+	gboolean changed;
+
+	changed = tracker_miner_applications_locale_changed ();
+	if (changed) {
 		g_message ("Locale change detected, so resetting miner to "
 		           "remove all previously created items...");
 		miner_applications_reset (miner);
 	}
+	return changed;
+}
 
-	return miner;
+TrackerMiner *
+tracker_miner_applications_new (GError **error)
+{
+	return g_initable_new (TRACKER_TYPE_MINER_APPLICATIONS,
+	                       NULL,
+	                       error,
+	                       "name", "Applications",
+	                       "processing-pool-wait-limit", 10,
+	                       "processing-pool-ready-limit", 100,
+	                       NULL);
 }
diff --git a/src/miners/fs/tracker-miner-applications.h b/src/miners/fs/tracker-miner-applications.h
index 7ff1692..7f7d8a6 100644
--- a/src/miners/fs/tracker-miner-applications.h
+++ b/src/miners/fs/tracker-miner-applications.h
@@ -42,9 +42,9 @@ struct _TrackerMinerApplicationsClass {
 	TrackerMinerFSClass parent_class;
 };
 
-GType          tracker_miner_applications_get_type (void) G_GNUC_CONST;
-
-TrackerMiner * tracker_miner_applications_new (GError **error);
+GType         tracker_miner_applications_get_type              (void) G_GNUC_CONST;
+TrackerMiner *tracker_miner_applications_new                   (GError       **error);
+gboolean      tracker_miner_applications_detect_locale_changed (TrackerMiner  *miner);
 
 G_END_DECLS
 



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