[tracker/live-config-changes: 6/6] TrackerMinerFiles: Do not trigger multiple rechecks on config file changes.
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/live-config-changes: 6/6] TrackerMinerFiles: Do not trigger multiple rechecks on config file changes.
- Date: Tue, 2 Mar 2010 16:29:56 +0000 (UTC)
commit e71dac69b211aedc9f65c8762d9c94db7da56ab7
Author: Carlos Garnacho <carlos lanedo com>
Date: Tue Mar 2 13:00:57 2010 +0100
TrackerMinerFiles: Do not trigger multiple rechecks on config file changes.
src/tracker-miner-fs/tracker-miner-files.c | 28 ++++++++++++++++++++++++++--
1 files changed, 26 insertions(+), 2 deletions(-)
---
diff --git a/src/tracker-miner-fs/tracker-miner-files.c b/src/tracker-miner-fs/tracker-miner-files.c
index 2bb21e3..83aee39 100644
--- a/src/tracker-miner-fs/tracker-miner-files.c
+++ b/src/tracker-miner-fs/tracker-miner-files.c
@@ -77,6 +77,8 @@ struct TrackerMinerFilesPrivate {
GQuark quark_mount_point_uuid;
GQuark quark_directory_config_root;
+
+ guint force_recheck_id;
};
enum {
@@ -305,6 +307,11 @@ miner_files_finalize (GObject *object)
object);
g_object_unref (priv->volume_monitor);
+ if (priv->force_recheck_id) {
+ g_source_remove (priv->force_recheck_id);
+ priv->force_recheck_id = 0;
+ }
+
G_OBJECT_CLASS (tracker_miner_files_parent_class)->finalize (object);
}
@@ -1110,6 +1117,20 @@ index_single_directories_cb (GObject *gobject,
private->index_single_directories = tracker_gslist_copy_with_string_data (new_dirs);
}
+static gboolean
+miner_files_force_recheck_idle (gpointer user_data)
+{
+ TrackerMinerFiles *miner_files = user_data;
+
+
+ /* Recheck all directories for compliance with the new config */
+ tracker_miner_fs_force_recheck (TRACKER_MINER_FS (miner_files));
+
+ miner_files->private->force_recheck_id = 0;
+
+ return FALSE;
+}
+
static void
ignore_directories_cb (GObject *gobject,
GParamSpec *arg1,
@@ -1117,8 +1138,11 @@ ignore_directories_cb (GObject *gobject,
{
TrackerMinerFiles *miner_files = user_data;
- /* Recheck all directories for compliance with the new config */
- tracker_miner_fs_force_recheck (TRACKER_MINER_FS (miner_files));
+ if (miner_files->private->force_recheck_id == 0) {
+ /* Set idle so multiple changes in the config lead to one recheck */
+ miner_files->private->force_recheck_id =
+ g_idle_add (miner_files_force_recheck_idle, miner_files);
+ }
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]