[tracker] tracker-miner-fs: allow overriding initial-sleep from command line
- From: Martyn James Russell <mr src gnome org>
- To: svn-commits-list gnome org
- Subject: [tracker] tracker-miner-fs: allow overriding initial-sleep from command line
- Date: Mon, 27 Jul 2009 18:17:34 +0000 (UTC)
commit e5b72c4687994607029f1bbd3721768356c104e6
Author: Martyn Russell <martyn imendio com>
Date: Mon Jul 27 19:11:12 2009 +0100
tracker-miner-fs: allow overriding initial-sleep from command line
src/tracker-miner-fs/tracker-indexer.c | 48 ++++++++++++++++++++++++++++---
src/tracker-miner-fs/tracker-indexer.h | 5 ++-
src/tracker-miner-fs/tracker-main.c | 17 ++++++++++-
3 files changed, 62 insertions(+), 8 deletions(-)
---
diff --git a/src/tracker-miner-fs/tracker-indexer.c b/src/tracker-miner-fs/tracker-indexer.c
index 9623770..f3ba724 100644
--- a/src/tracker-miner-fs/tracker-indexer.c
+++ b/src/tracker-miner-fs/tracker-indexer.c
@@ -180,6 +180,7 @@ enum TrackerIndexerState {
enum {
PROP_0,
+ PROP_CONFIG,
PROP_STORAGE,
PROP_RUNNING,
};
@@ -710,7 +711,13 @@ tracker_indexer_class_init (TrackerIndexerClass *class)
g_param_spec_pointer ("storage",
"Storage HAL object",
"The object used for storage knowledge",
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property (object_class,
+ PROP_CONFIG,
+ g_param_spec_pointer ("config",
+ "Config object",
+ "The object used for config knowledge",
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (object_class,
PROP_RUNNING,
@@ -734,6 +741,24 @@ indexer_set_property (GObject *object,
indexer = TRACKER_INDEXER (object);
switch (param_id) {
+ case PROP_CONFIG: {
+ gpointer p;
+
+ p = g_value_get_pointer (value);
+
+ if (indexer->private->config) {
+ g_object_unref (indexer->private->config);
+ }
+
+ if (p) {
+ indexer->private->config = g_object_ref (p);
+ } else {
+ indexer->private->config = NULL;
+ }
+
+ break;
+ }
+
case PROP_STORAGE: {
gpointer p;
@@ -769,7 +794,19 @@ indexer_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
+ TrackerIndexer *indexer;
+
+ indexer = TRACKER_INDEXER (object);
+
switch (prop_id) {
+ case PROP_CONFIG:
+ g_value_set_pointer (value, indexer->private->config);
+ break;
+
+ case PROP_STORAGE:
+ g_value_set_pointer (value, indexer->private->storage);
+ break;
+
case PROP_RUNNING:
g_value_set_boolean (value,
tracker_indexer_get_running (TRACKER_INDEXER (object)));
@@ -787,6 +824,8 @@ indexer_constructed (GObject *object)
indexer = TRACKER_INDEXER (object);
+ set_up_throttle (indexer);
+
tracker_status_init (indexer->private->config,
indexer->private->power);
@@ -1011,7 +1050,6 @@ tracker_indexer_init (TrackerIndexer *indexer)
priv->dir_queue = g_queue_new ();
priv->file_queue = g_queue_new ();
priv->modules_queue = g_queue_new ();
- priv->config = tracker_config_new ();
priv->client = tracker_connect (TRUE, -1);
@@ -1020,8 +1058,6 @@ tracker_indexer_init (TrackerIndexer *indexer)
g_signal_connect (priv->power, "notify::on-battery",
G_CALLBACK (notify_on_battery_cb),
indexer);
-
- set_up_throttle (indexer);
#endif /* HAVE_HAL || HAVE_DEVKIT_POWER */
/* Set up volume monitor */
@@ -1727,9 +1763,11 @@ process_func (gpointer data)
}
TrackerIndexer *
-tracker_indexer_new (TrackerStorage *storage)
+tracker_indexer_new (TrackerConfig *config,
+ TrackerStorage *storage)
{
return g_object_new (TRACKER_TYPE_INDEXER,
+ "config", config,
"storage", storage,
NULL);
}
diff --git a/src/tracker-miner-fs/tracker-indexer.h b/src/tracker-miner-fs/tracker-indexer.h
index 80f5624..75fa60b 100644
--- a/src/tracker-miner-fs/tracker-indexer.h
+++ b/src/tracker-miner-fs/tracker-indexer.h
@@ -28,6 +28,8 @@
#include <libtracker-common/tracker-storage.h>
+#include "tracker-config.h"
+
#define TRACKER_DAEMON_SERVICE "org.freedesktop.Tracker"
#define TRACKER_INDEXER_SERVICE "org.freedesktop.Tracker.Indexer"
#define TRACKER_INDEXER_PATH "/org/freedesktop/Tracker/Indexer"
@@ -83,7 +85,8 @@ struct TrackerIndexerClass {
GType tracker_indexer_get_type (void) G_GNUC_CONST;
-TrackerIndexer *tracker_indexer_new (TrackerStorage *storage);
+TrackerIndexer *tracker_indexer_new (TrackerConfig *config,
+ TrackerStorage *storage);
gboolean tracker_indexer_get_running (TrackerIndexer *indexer);
void tracker_indexer_set_running (TrackerIndexer *indexer,
gboolean running);
diff --git a/src/tracker-miner-fs/tracker-main.c b/src/tracker-miner-fs/tracker-main.c
index 4e22893..da71ad2 100644
--- a/src/tracker-miner-fs/tracker-main.c
+++ b/src/tracker-miner-fs/tracker-main.c
@@ -70,6 +70,7 @@ static GMainLoop *main_loop;
static gboolean version;
static gint verbosity = -1;
+static gint initial_sleep = -1;
static gboolean process_all;
static gchar **modules;
@@ -81,7 +82,12 @@ static GOptionEntry entries[] = {
{ "verbosity", 'v', 0,
G_OPTION_ARG_INT, &verbosity,
N_("Logging, 0 = errors only, "
- "1 = minimal, 2 = detailed and 3 = debug (default = 0)"),
+ "1 = minimal, 2 = detailed and 3 = debug (default = config)"),
+ NULL },
+ { "initial-sleep", 's', 0,
+ G_OPTION_ARG_INT, &initial_sleep,
+ N_("Initial sleep time in seconds, "
+ "0->1000 (default = config)"),
NULL },
{ "process-all", 'p', 0,
G_OPTION_ARG_NONE, &process_all,
@@ -97,6 +103,8 @@ sanity_check_option_values (TrackerConfig *config)
g_message ("General options:");
g_message (" Verbosity ............................ %d",
tracker_config_get_verbosity (config));
+ g_message (" Initial Sleep ........................ %d",
+ tracker_config_get_initial_sleep (config));
g_message ("Indexer options:");
g_message (" Throttle level ....................... %d",
@@ -270,6 +278,11 @@ main (gint argc, gchar *argv[])
if (verbosity > -1) {
tracker_config_set_verbosity (config, verbosity);
}
+
+ if (initial_sleep > -1) {
+ tracker_config_set_initial_sleep (config, initial_sleep);
+ }
+
/* Make sure we initialize DBus, this shows we are started
* successfully when called upon from the daemon.
*/
@@ -308,7 +321,7 @@ main (gint argc, gchar *argv[])
storage = NULL;
#endif
- indexer = tracker_indexer_new (storage);
+ indexer = tracker_indexer_new (config, storage);
miner = tracker_miner_new (indexer);
/* Make Tracker available for introspection */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]