[tracker] tracker-extract: add "wait-for-miner-fs" setting



commit f4e54b67b9220bb903fcec6473e8e14c96bd69fb
Author: Xavier Claessens <xavier claessens collabora co uk>
Date:   Fri Jan 31 16:20:44 2014 -0500

    tracker-extract: add "wait-for-miner-fs" setting
    
    https://bugzilla.gnome.org/show_bug.cgi?id=719802

 .../org.freedesktop.Tracker.Extract.gschema.xml.in |    6 ++++
 src/tracker-extract/tracker-config.c               |   28 ++++++++++++++++++-
 src/tracker-extract/tracker-config.h               |    1 +
 3 files changed, 33 insertions(+), 2 deletions(-)
---
diff --git a/data/gschemas/org.freedesktop.Tracker.Extract.gschema.xml.in 
b/data/gschemas/org.freedesktop.Tracker.Extract.gschema.xml.in
index 17c2456..af8c0f0 100644
--- a/data/gschemas/org.freedesktop.Tracker.Extract.gschema.xml.in
+++ b/data/gschemas/org.freedesktop.Tracker.Extract.gschema.xml.in
@@ -48,5 +48,11 @@ Boston, MA  02110-1301, USA.
       <range min="-1" max="2048"/>
       <default>0</default>
     </key>
+
+    <key name="wait-for-miner-fs" type="b">
+      <_summary>Wait for FS miner to be done before extracting</_summary>
+      <_description>When true, tracker-extract will wait for tracker-miner-fs to be done crawling before 
extracting meta-data. This option is useful on constrained environment where it is important to list files as 
fast as possible and can wait to get meta-data later.</_description>
+      <default>false</default>
+    </key>
   </schema>
 </schemalist>
diff --git a/src/tracker-extract/tracker-config.c b/src/tracker-extract/tracker-config.c
index 69bf841..0d819e8 100644
--- a/src/tracker-extract/tracker-config.c
+++ b/src/tracker-extract/tracker-config.c
@@ -41,7 +41,8 @@ enum {
        PROP_VERBOSITY,
        PROP_SCHED_IDLE,
        PROP_MAX_BYTES,
-       PROP_MAX_MEDIA_ART_WIDTH
+       PROP_MAX_MEDIA_ART_WIDTH,
+       PROP_WAIT_FOR_MINER_FS,
 };
 
 static TrackerConfigMigrationEntry migration[] = {
@@ -100,6 +101,14 @@ tracker_config_class_init (TrackerConfigClass *klass)
                                                           2048,
                                                           0,
                                                           G_PARAM_READWRITE));
+
+       g_object_class_install_property (object_class,
+                                        PROP_WAIT_FOR_MINER_FS,
+                                        g_param_spec_boolean ("wait-for-miner-fs",
+                                                              "Wait for FS miner to be done before 
extracting",
+                                                              "%TRUE to wait for tracker-miner-fs is done 
before extracting. %FAlSE otherwise",
+                                                              FALSE,
+                                                              G_PARAM_READWRITE));
 }
 
 static void
@@ -128,6 +137,7 @@ config_set_property (GObject      *object,
        case PROP_SCHED_IDLE:
        case PROP_MAX_BYTES:
        case PROP_MAX_MEDIA_ART_WIDTH:
+       case PROP_WAIT_FOR_MINER_FS:
                break;
 
        default:
@@ -165,6 +175,11 @@ config_get_property (GObject    *object,
                                 tracker_config_get_max_media_art_width (config));
                break;
 
+       case PROP_WAIT_FOR_MINER_FS:
+               g_value_set_boolean (value,
+                                    tracker_config_get_wait_for_miner_fs (config));
+               break;
+
        default:
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
                break;
@@ -198,12 +213,13 @@ config_constructed (GObject *object)
        g_settings_bind (settings, "sched-idle", object, "sched-idle", G_SETTINGS_BIND_GET);
        g_settings_bind (settings, "max-bytes", object, "max-bytes", G_SETTINGS_BIND_GET);
        g_settings_bind (settings, "max-media-art-width", object, "max-media-art-width", G_SETTINGS_BIND_GET);
+       g_settings_bind (settings, "wait-for-miner-fs", object, "wait-for-miner-fs", G_SETTINGS_BIND_GET);
 
        /* Migrate keyfile-based configuration */
        config_file = tracker_config_file_new ();
 
        if (config_file) {
-               tracker_config_file_migrate (config_file, G_SETTINGS (object), migration);
+               tracker_config_file_migrate (config_file, settings, migration);
                g_object_unref (config_file);
        }
 }
@@ -257,3 +273,11 @@ tracker_config_get_max_media_art_width (TrackerConfig *config)
 
        return g_settings_get_int (G_SETTINGS (config), "max-media-art-width");
 }
+
+gboolean
+tracker_config_get_wait_for_miner_fs (TrackerConfig *config)
+{
+       g_return_val_if_fail (TRACKER_IS_CONFIG (config), FALSE);
+
+       return g_settings_get_boolean (G_SETTINGS (config), "wait-for-miner-fs");
+}
diff --git a/src/tracker-extract/tracker-config.h b/src/tracker-extract/tracker-config.h
index 96b7a4c..b19f01f 100644
--- a/src/tracker-extract/tracker-config.h
+++ b/src/tracker-extract/tracker-config.h
@@ -52,6 +52,7 @@ gint           tracker_config_get_verbosity           (TrackerConfig *config);
 gint           tracker_config_get_sched_idle          (TrackerConfig *config);
 gint           tracker_config_get_max_bytes           (TrackerConfig *config);
 gint           tracker_config_get_max_media_art_width (TrackerConfig *config);
+gboolean       tracker_config_get_wait_for_miner_fs   (TrackerConfig *config);
 
 void           tracker_config_set_verbosity           (TrackerConfig *config,
                                                        gint           value);


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