[tracker] tracker-fts: added config module
- From: Martyn James Russell <mr src gnome org>
- To: svn-commits-list gnome org
- Subject: [tracker] tracker-fts: added config module
- Date: Mon, 20 Jul 2009 11:14:06 +0000 (UTC)
commit 1769b7ce7b34832bf7d01216e71703ab8d5c34d5
Author: Martyn Russell <martyn imendio com>
Date: Mon Jul 20 12:10:18 2009 +0100
tracker-fts: added config module
Removed the FTS config options from tracker-store too
src/tracker-fts/Makefile.am | 2 +
src/tracker-fts/tracker-fts-config.c | 430 ++++++++++++++++++++++++++++++++++
src/tracker-fts/tracker-fts-config.h | 65 +++++
src/tracker-fts/tracker-fts.c | 11 +-
src/tracker-store/tracker-config.c | 163 -------------
src/tracker-store/tracker-config.h | 9 -
6 files changed, 502 insertions(+), 178 deletions(-)
---
diff --git a/src/tracker-fts/Makefile.am b/src/tracker-fts/Makefile.am
index a6718fc..686ea87 100644
--- a/src/tracker-fts/Makefile.am
+++ b/src/tracker-fts/Makefile.am
@@ -18,6 +18,8 @@ tracker_fts_modules_LTLIBRARIES = tracker-fts.la
tracker_fts_la_SOURCES = \
tracker-fts.c \
tracker-fts.h \
+ tracker-fts-config.c \
+ tracker-fts-config.h \
tracker-fts-hash.c \
tracker-fts-hash.h
diff --git a/src/tracker-fts/tracker-fts-config.c b/src/tracker-fts/tracker-fts-config.c
new file mode 100644
index 0000000..b5b2485
--- /dev/null
+++ b/src/tracker-fts/tracker-fts-config.c
@@ -0,0 +1,430 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2009, Nokia (urho konttori nokia com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+
+#include <string.h>
+#include <stdlib.h>
+
+#include <glib.h>
+#include <gio/gio.h>
+
+#include <libtracker-common/tracker-config-utils.h>
+
+#include "tracker-fts-config.h"
+
+#define TRACKER_FTS_CONFIG_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TRACKER_TYPE_FTS_CONFIG, TrackerFTSConfigPrivate))
+
+/* GKeyFile defines */
+#define GROUP_INDEXING "Indexing"
+
+/* Default values */
+#define DEFAULT_MIN_WORD_LENGTH 3 /* 0->30 */
+#define DEFAULT_MAX_WORD_LENGTH 30 /* 0->200 */
+#define DEFAULT_MAX_WORDS_TO_INDEX 10000
+
+typedef struct {
+ /* Indexing */
+ gint min_word_length;
+ gint max_word_length;
+ gint max_words_to_index;
+} TrackerFTSConfigPrivate;
+
+typedef struct {
+ GType type;
+ gchar *property;
+ gchar *group;
+ gchar *key;
+} ObjectToKeyFile;
+
+static void config_set_property (GObject *object,
+ guint param_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void config_get_property (GObject *object,
+ guint param_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void config_finalize (GObject *object);
+static void config_constructed (GObject *object);
+static void config_create_with_defaults (TrackerFTSConfig *config,
+ GKeyFile *key_file,
+ gboolean overwrite);
+static void config_load (TrackerFTSConfig *config);
+
+enum {
+ PROP_0,
+
+ /* Indexing */
+ PROP_MIN_WORD_LENGTH,
+ PROP_MAX_WORD_LENGTH,
+
+ /* Performance */
+ PROP_MAX_WORDS_TO_INDEX,
+};
+
+static ObjectToKeyFile conversions[] = {
+ { G_TYPE_INT, "min-word-length", GROUP_INDEXING, "MinWordLength" },
+ { G_TYPE_INT, "max-word-length", GROUP_INDEXING, "MaxWordLength" },
+ { G_TYPE_INT, "max-words-to-index", GROUP_INDEXING, "MaxWordsToIndex" },
+};
+
+G_DEFINE_TYPE (TrackerFTSConfig, tracker_fts_config, TRACKER_TYPE_CONFIG_MANAGER);
+
+static void
+tracker_fts_config_class_init (TrackerFTSConfigClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->set_property = config_set_property;
+ object_class->get_property = config_get_property;
+ object_class->finalize = config_finalize;
+ object_class->constructed = config_constructed;
+
+ /* Indexing */
+ g_object_class_install_property (object_class,
+ PROP_MIN_WORD_LENGTH,
+ g_param_spec_int ("min-word-length",
+ "Minimum word length",
+ " Set the minimum length of words to index (0->30, default=3)",
+ 0,
+ 30,
+ DEFAULT_MIN_WORD_LENGTH,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+ g_object_class_install_property (object_class,
+ PROP_MAX_WORD_LENGTH,
+ g_param_spec_int ("max-word-length",
+ "Maximum word length",
+ " Set the maximum length of words to index (0->200, default=30)",
+ 0,
+ 200, /* Is this a reasonable limit? */
+ DEFAULT_MAX_WORD_LENGTH,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+ g_object_class_install_property (object_class,
+ PROP_MAX_WORDS_TO_INDEX,
+ g_param_spec_int ("max-words-to-index",
+ "Maximum words to index",
+ " Maximum unique words to index from a file's content (default=10000)",
+ 0,
+ G_MAXINT,
+ DEFAULT_MAX_WORDS_TO_INDEX,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
+ g_type_class_add_private (object_class, sizeof (TrackerFTSConfigPrivate));
+}
+
+static void
+tracker_fts_config_init (TrackerFTSConfig *object)
+{
+}
+
+static void
+config_set_property (GObject *object,
+ guint param_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (param_id) {
+ /* Indexing */
+ case PROP_MIN_WORD_LENGTH:
+ tracker_fts_config_set_min_word_length (TRACKER_FTS_CONFIG (object),
+ g_value_get_int (value));
+ break;
+ case PROP_MAX_WORD_LENGTH:
+ tracker_fts_config_set_max_word_length (TRACKER_FTS_CONFIG (object),
+ g_value_get_int (value));
+ break;
+ case PROP_MAX_WORDS_TO_INDEX:
+ tracker_fts_config_set_max_words_to_index (TRACKER_FTS_CONFIG (object),
+ g_value_get_int (value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ break;
+ };
+}
+
+static void
+config_get_property (GObject *object,
+ guint param_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ TrackerFTSConfigPrivate *priv;
+
+ priv = TRACKER_FTS_CONFIG_GET_PRIVATE (object);
+
+ switch (param_id) {
+ /* Indexing */
+ case PROP_MIN_WORD_LENGTH:
+ g_value_set_int (value, priv->min_word_length);
+ break;
+ case PROP_MAX_WORD_LENGTH:
+ g_value_set_int (value, priv->max_word_length);
+ break;
+ case PROP_MAX_WORDS_TO_INDEX:
+ g_value_set_int (value, priv->max_words_to_index);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ break;
+ };
+}
+
+static void
+config_finalize (GObject *object)
+{
+ /* For now we do nothing here, we left this override in for
+ * future expansion.
+ */
+
+ (G_OBJECT_CLASS (tracker_fts_config_parent_class)->finalize) (object);
+}
+
+static void
+config_constructed (GObject *object)
+{
+ (G_OBJECT_CLASS (tracker_fts_config_parent_class)->constructed) (object);
+
+ config_load (TRACKER_FTS_CONFIG (object));
+}
+
+static void
+config_create_with_defaults (TrackerFTSConfig *config,
+ GKeyFile *key_file,
+ gboolean overwrite)
+{
+ gint i;
+
+ g_message ("Loading defaults into GKeyFile...");
+
+ for (i = 0; i < G_N_ELEMENTS (conversions); i++) {
+ gboolean has_key;
+
+ has_key = g_key_file_has_key (key_file,
+ conversions[i].group,
+ conversions[i].key,
+ NULL);
+ if (!overwrite && has_key) {
+ continue;
+ }
+
+ switch (conversions[i].type) {
+ case G_TYPE_INT:
+ g_key_file_set_integer (key_file,
+ conversions[i].group,
+ conversions[i].key,
+ tracker_config_default_int (config,
+ conversions[i].property));
+ break;
+
+ default:
+ g_assert_not_reached ();
+ break;
+ }
+
+ g_key_file_set_comment (key_file,
+ conversions[i].group,
+ conversions[i].key,
+ tracker_config_blurb (config,
+ conversions[i].property),
+ NULL);
+ }
+}
+
+static void
+config_load (TrackerFTSConfig *config)
+{
+ TrackerConfigManager *manager;
+ gint i;
+
+ manager = TRACKER_CONFIG_MANAGER (config);
+ config_create_with_defaults (config, manager->key_file, FALSE);
+
+ if (!manager->file_exists) {
+ tracker_config_manager_save (manager);
+ }
+
+ for (i = 0; i < G_N_ELEMENTS (conversions); i++) {
+ gboolean has_key;
+
+ has_key = g_key_file_has_key (manager->key_file,
+ conversions[i].group,
+ conversions[i].key,
+ NULL);
+
+ switch (conversions[i].type) {
+ case G_TYPE_INT:
+ tracker_config_load_int (G_OBJECT (manager),
+ conversions[i].property,
+ manager->key_file,
+ conversions[i].group,
+ conversions[i].key);
+ break;
+
+ default:
+ g_assert_not_reached ();
+ break;
+ }
+ }
+}
+
+static gboolean
+config_save (TrackerFTSConfig *config)
+{
+ TrackerConfigManager *manager;
+ gint i;
+
+ manager = TRACKER_CONFIG_MANAGER (config);
+
+ if (!manager->key_file) {
+ g_critical ("Could not save config, GKeyFile was NULL, has the config been loaded?");
+
+ return FALSE;
+ }
+
+ g_message ("Setting details to GKeyFile object...");
+
+ for (i = 0; i < G_N_ELEMENTS (conversions); i++) {
+ switch (conversions[i].type) {
+ case G_TYPE_INT:
+ tracker_config_save_int (manager,
+ conversions[i].property,
+ manager->key_file,
+ conversions[i].group,
+ conversions[i].key);
+ break;
+
+ default:
+ g_assert_not_reached ();
+ break;
+ }
+ }
+
+ return tracker_config_manager_save (TRACKER_CONFIG_MANAGER (config));
+}
+
+TrackerFTSConfig *
+tracker_fts_config_new (void)
+{
+ return g_object_new (TRACKER_TYPE_FTS_CONFIG,
+ "domain", "tracker-fts",
+ NULL);
+}
+
+gboolean
+tracker_fts_config_save (TrackerFTSConfig *config)
+{
+ g_return_val_if_fail (TRACKER_IS_FTS_CONFIG (config), FALSE);
+
+ return config_save (config);
+}
+
+gint
+tracker_fts_config_get_min_word_length (TrackerFTSConfig *config)
+{
+ TrackerFTSConfigPrivate *priv;
+
+ g_return_val_if_fail (TRACKER_IS_FTS_CONFIG (config), DEFAULT_MIN_WORD_LENGTH);
+
+ priv = TRACKER_FTS_CONFIG_GET_PRIVATE (config);
+
+ return priv->min_word_length;
+}
+
+gint
+tracker_fts_config_get_max_word_length (TrackerFTSConfig *config)
+{
+ TrackerFTSConfigPrivate *priv;
+
+ g_return_val_if_fail (TRACKER_IS_FTS_CONFIG (config), DEFAULT_MAX_WORD_LENGTH);
+
+ priv = TRACKER_FTS_CONFIG_GET_PRIVATE (config);
+
+ return priv->max_word_length;
+}
+
+gint
+tracker_fts_config_get_max_words_to_index (TrackerFTSConfig *config)
+{
+ TrackerFTSConfigPrivate *priv;
+
+ g_return_val_if_fail (TRACKER_IS_FTS_CONFIG (config), DEFAULT_MAX_WORDS_TO_INDEX);
+
+ priv = TRACKER_FTS_CONFIG_GET_PRIVATE (config);
+
+ return priv->max_words_to_index;
+}
+
+void
+tracker_fts_config_set_min_word_length (TrackerFTSConfig *config,
+ gint value)
+{
+ TrackerFTSConfigPrivate *priv;
+
+ g_return_if_fail (TRACKER_IS_FTS_CONFIG (config));
+
+ if (!tracker_config_validate_int (config, "min-word-length", value)) {
+ return;
+ }
+
+ priv = TRACKER_FTS_CONFIG_GET_PRIVATE (config);
+
+ priv->min_word_length = value;
+ g_object_notify (G_OBJECT (config), "min-word-length");
+}
+
+void
+tracker_fts_config_set_max_word_length (TrackerFTSConfig *config,
+ gint value)
+{
+ TrackerFTSConfigPrivate *priv;
+
+ g_return_if_fail (TRACKER_IS_FTS_CONFIG (config));
+
+ if (!tracker_config_validate_int (config, "max-word-length", value)) {
+ return;
+ }
+
+ priv = TRACKER_FTS_CONFIG_GET_PRIVATE (config);
+
+ priv->max_word_length = value;
+ g_object_notify (G_OBJECT (config), "max-word-length");
+}
+
+void
+tracker_fts_config_set_max_words_to_index (TrackerFTSConfig *config,
+ gint value)
+{
+ TrackerFTSConfigPrivate *priv;
+
+ g_return_if_fail (TRACKER_IS_FTS_CONFIG (config));
+
+ if (!tracker_config_validate_int (config, "max-words-to-index", value)) {
+ return;
+ }
+
+ priv = TRACKER_FTS_CONFIG_GET_PRIVATE (config);
+
+ priv->max_words_to_index = value;
+ g_object_notify (G_OBJECT (config), "max-words-to-index");
+}
diff --git a/src/tracker-fts/tracker-fts-config.h b/src/tracker-fts/tracker-fts-config.h
new file mode 100644
index 0000000..3687870
--- /dev/null
+++ b/src/tracker-fts/tracker-fts-config.h
@@ -0,0 +1,65 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2009, Nokia (urho konttori nokia com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __TRACKER_FTS_CONFIG_H__
+#define __TRACKER_FTS_CONFIG_H__
+
+#include <glib-object.h>
+
+#include <libtracker-common/tracker-config-manager.h>
+
+G_BEGIN_DECLS
+
+#define TRACKER_TYPE_FTS_CONFIG (tracker_fts_config_get_type ())
+#define TRACKER_FTS_CONFIG(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TRACKER_TYPE_FTS_CONFIG, TrackerFTSConfig))
+#define TRACKER_FTS_CONFIG_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TRACKER_TYPE_FTS_CONFIG, TrackerFTSConfigClass))
+#define TRACKER_IS_FTS_CONFIG(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TRACKER_TYPE_FTS_CONFIG))
+#define TRACKER_IS_FTS_CONFIG_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TRACKER_TYPE_FTS_CONFIG))
+#define TRACKER_FTS_CONFIG_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TRACKER_TYPE_FTS_CONFIG, TrackerFTSConfigClass))
+
+typedef struct TrackerFTSConfig TrackerFTSConfig;
+typedef struct TrackerFTSConfigClass TrackerFTSConfigClass;
+
+struct TrackerFTSConfig {
+ TrackerConfigManager parent;
+};
+
+struct TrackerFTSConfigClass {
+ TrackerConfigManagerClass parent_class;
+};
+
+GType tracker_fts_config_get_type (void) G_GNUC_CONST;
+
+TrackerFTSConfig *tracker_fts_config_new (void);
+gboolean tracker_fts_config_save (TrackerFTSConfig *config);
+gint tracker_fts_config_get_min_word_length (TrackerFTSConfig *config);
+gint tracker_fts_config_get_max_word_length (TrackerFTSConfig *config);
+gint tracker_fts_config_get_max_words_to_index (TrackerFTSConfig *config);
+void tracker_fts_config_set_min_word_length (TrackerFTSConfig *config,
+ gint value);
+void tracker_fts_config_set_max_word_length (TrackerFTSConfig *config,
+ gint value);
+void tracker_fts_config_set_max_words_to_index (TrackerFTSConfig *config,
+ gint value);
+
+G_END_DECLS
+
+#endif /* __TRACKER_FTS_CONFIG_H__ */
+
diff --git a/src/tracker-fts/tracker-fts.c b/src/tracker-fts/tracker-fts.c
index 7655e42..fdc937b 100644
--- a/src/tracker-fts/tracker-fts.c
+++ b/src/tracker-fts/tracker-fts.c
@@ -282,9 +282,8 @@
#include <libtracker-common/tracker-common.h>
#include <libtracker-db/tracker-db-manager.h>
-#include <tracker-store/tracker-config.h>
-
#include "tracker-fts.h"
+#include "tracker-fts-config.h"
#include "tracker-fts-hash.h"
SQLITE_EXTENSION_INIT1
@@ -3402,13 +3401,13 @@ static int constructVtab(
/* set up our parser */
- TrackerConfig *config = tracker_config_new ();
+ TrackerFTSConfig *config = tracker_fts_config_new ();
TrackerLanguage *language = tracker_language_new (NULL);
- int min_len = tracker_config_get_min_word_length (config);
- int max_len = tracker_config_get_max_word_length (config);
- v->max_words = tracker_config_get_max_words_to_index (config);
+ int min_len = tracker_fts_config_get_min_word_length (config);
+ int max_len = tracker_fts_config_get_max_word_length (config);
+ v->max_words = tracker_fts_config_get_max_words_to_index (config);
v->parser = tracker_parser_new (language, max_len, min_len);
diff --git a/src/tracker-store/tracker-config.c b/src/tracker-store/tracker-config.c
index ee77c12..81a2345 100644
--- a/src/tracker-store/tracker-config.c
+++ b/src/tracker-store/tracker-config.c
@@ -39,9 +39,6 @@
/* Default values */
#define DEFAULT_VERBOSITY 2
#define DEFAULT_LOW_MEMORY_MODE FALSE
-#define DEFAULT_MIN_WORD_LENGTH 3 /* 0->30 */
-#define DEFAULT_MAX_WORD_LENGTH 30 /* 0->200 */
-#define DEFAULT_MAX_WORDS_TO_INDEX 10000
/* typedef struct TrackerConfigPrivate TrackerConfigPrivate; */
@@ -49,11 +46,6 @@ typedef struct {
/* General */
gint verbosity;
gboolean low_memory_mode;
-
- /* Indexing */
- gint min_word_length;
- gint max_word_length;
- gint max_words_to_index;
} TrackerConfigPrivate;
typedef struct {
@@ -84,21 +76,11 @@ enum {
/* General */
PROP_VERBOSITY,
PROP_LOW_MEMORY_MODE,
-
- /* Indexing */
- PROP_MIN_WORD_LENGTH,
- PROP_MAX_WORD_LENGTH,
-
- /* Performance */
- PROP_MAX_WORDS_TO_INDEX,
};
static ObjectToKeyFile conversions[] = {
{ G_TYPE_INT, "verbosity", GROUP_GENERAL, "Verbosity" },
{ G_TYPE_BOOLEAN, "low-memory-mode", GROUP_GENERAL, "LowMemoryMode" },
- { G_TYPE_INT, "min-word-length", GROUP_INDEXING, "MinWordLength" },
- { G_TYPE_INT, "max-word-length", GROUP_INDEXING, "MaxWordLength" },
- { G_TYPE_INT, "max-words-to-index", GROUP_INDEXING, "MaxWordsToIndex" },
};
G_DEFINE_TYPE (TrackerConfig, tracker_config, TRACKER_TYPE_CONFIG_MANAGER);
@@ -131,35 +113,6 @@ tracker_config_class_init (TrackerConfigClass *klass)
DEFAULT_LOW_MEMORY_MODE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
- /* Indexing */
- g_object_class_install_property (object_class,
- PROP_MIN_WORD_LENGTH,
- g_param_spec_int ("min-word-length",
- "Minimum word length",
- " Set the minimum length of words to index (0->30, default=3)",
- 0,
- 30,
- DEFAULT_MIN_WORD_LENGTH,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
- g_object_class_install_property (object_class,
- PROP_MAX_WORD_LENGTH,
- g_param_spec_int ("max-word-length",
- "Maximum word length",
- " Set the maximum length of words to index (0->200, default=30)",
- 0,
- 200, /* Is this a reasonable limit? */
- DEFAULT_MAX_WORD_LENGTH,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
- g_object_class_install_property (object_class,
- PROP_MAX_WORDS_TO_INDEX,
- g_param_spec_int ("max-words-to-index",
- "Maximum words to index",
- " Maximum unique words to index from a file's content (default=10000)",
- 0,
- G_MAXINT,
- DEFAULT_MAX_WORDS_TO_INDEX,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
-
g_type_class_add_private (object_class, sizeof (TrackerConfigPrivate));
}
@@ -185,20 +138,6 @@ config_set_property (GObject *object,
g_value_get_boolean (value));
break;
- /* Indexing */
- case PROP_MIN_WORD_LENGTH:
- tracker_config_set_min_word_length (TRACKER_CONFIG (object),
- g_value_get_int (value));
- break;
- case PROP_MAX_WORD_LENGTH:
- tracker_config_set_max_word_length (TRACKER_CONFIG (object),
- g_value_get_int (value));
- break;
- case PROP_MAX_WORDS_TO_INDEX:
- tracker_config_set_max_words_to_index (TRACKER_CONFIG (object),
- g_value_get_int (value));
- break;
-
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
@@ -224,17 +163,6 @@ config_get_property (GObject *object,
g_value_set_boolean (value, priv->low_memory_mode);
break;
- /* Indexing */
- case PROP_MIN_WORD_LENGTH:
- g_value_set_int (value, priv->min_word_length);
- break;
- case PROP_MAX_WORD_LENGTH:
- g_value_set_int (value, priv->max_word_length);
- break;
- case PROP_MAX_WORDS_TO_INDEX:
- g_value_set_int (value, priv->max_words_to_index);
- break;
-
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
@@ -436,43 +364,6 @@ tracker_config_get_low_memory_mode (TrackerConfig *config)
return priv->low_memory_mode;
}
-
-gint
-tracker_config_get_min_word_length (TrackerConfig *config)
-{
- TrackerConfigPrivate *priv;
-
- g_return_val_if_fail (TRACKER_IS_CONFIG (config), DEFAULT_MIN_WORD_LENGTH);
-
- priv = TRACKER_CONFIG_GET_PRIVATE (config);
-
- return priv->min_word_length;
-}
-
-gint
-tracker_config_get_max_word_length (TrackerConfig *config)
-{
- TrackerConfigPrivate *priv;
-
- g_return_val_if_fail (TRACKER_IS_CONFIG (config), DEFAULT_MAX_WORD_LENGTH);
-
- priv = TRACKER_CONFIG_GET_PRIVATE (config);
-
- return priv->max_word_length;
-}
-
-gint
-tracker_config_get_max_words_to_index (TrackerConfig *config)
-{
- TrackerConfigPrivate *priv;
-
- g_return_val_if_fail (TRACKER_IS_CONFIG (config), DEFAULT_MAX_WORDS_TO_INDEX);
-
- priv = TRACKER_CONFIG_GET_PRIVATE (config);
-
- return priv->max_words_to_index;
-}
-
void
tracker_config_set_verbosity (TrackerConfig *config,
gint value)
@@ -504,57 +395,3 @@ tracker_config_set_low_memory_mode (TrackerConfig *config,
priv->low_memory_mode = value;
g_object_notify (G_OBJECT (config), "low-memory-mode");
}
-
-void
-tracker_config_set_min_word_length (TrackerConfig *config,
- gint value)
-{
- TrackerConfigPrivate *priv;
-
- g_return_if_fail (TRACKER_IS_CONFIG (config));
-
- if (!tracker_config_validate_int (config, "min-word-length", value)) {
- return;
- }
-
- priv = TRACKER_CONFIG_GET_PRIVATE (config);
-
- priv->min_word_length = value;
- g_object_notify (G_OBJECT (config), "min-word-length");
-}
-
-void
-tracker_config_set_max_word_length (TrackerConfig *config,
- gint value)
-{
- TrackerConfigPrivate *priv;
-
- g_return_if_fail (TRACKER_IS_CONFIG (config));
-
- if (!tracker_config_validate_int (config, "max-word-length", value)) {
- return;
- }
-
- priv = TRACKER_CONFIG_GET_PRIVATE (config);
-
- priv->max_word_length = value;
- g_object_notify (G_OBJECT (config), "max-word-length");
-}
-
-void
-tracker_config_set_max_words_to_index (TrackerConfig *config,
- gint value)
-{
- TrackerConfigPrivate *priv;
-
- g_return_if_fail (TRACKER_IS_CONFIG (config));
-
- if (!tracker_config_validate_int (config, "max-words-to-index", value)) {
- return;
- }
-
- priv = TRACKER_CONFIG_GET_PRIVATE (config);
-
- priv->max_words_to_index = value;
- g_object_notify (G_OBJECT (config), "max-words-to-index");
-}
diff --git a/src/tracker-store/tracker-config.h b/src/tracker-store/tracker-config.h
index f6b8521..81dacca 100644
--- a/src/tracker-store/tracker-config.h
+++ b/src/tracker-store/tracker-config.h
@@ -51,20 +51,11 @@ TrackerConfig *tracker_config_new (void);
gboolean tracker_config_save (TrackerConfig *config);
gint tracker_config_get_verbosity (TrackerConfig *config);
gboolean tracker_config_get_low_memory_mode (TrackerConfig *config);
-gint tracker_config_get_min_word_length (TrackerConfig *config);
-gint tracker_config_get_max_word_length (TrackerConfig *config);
-gint tracker_config_get_max_words_to_index (TrackerConfig *config);
void tracker_config_set_verbosity (TrackerConfig *config,
gint value);
void tracker_config_set_low_memory_mode (TrackerConfig *config,
gboolean value);
-void tracker_config_set_min_word_length (TrackerConfig *config,
- gint value);
-void tracker_config_set_max_word_length (TrackerConfig *config,
- gint value);
-void tracker_config_set_max_words_to_index (TrackerConfig *config,
- gint value);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]