[Tracker] [PATCH 1/2] miner-fs: added removable devices days threshold to config
- From: lionel g landwerlin linux intel com
- To: tracker-list gnome org
- Subject: [Tracker] [PATCH 1/2] miner-fs: added removable devices days threshold to config
- Date: Thu, 27 Jan 2011 11:14:58 +0000
From: Lionel Landwerlin <lionel g landwerlin linux intel com>
Signed-off-by: Lionel Landwerlin <lionel g landwerlin linux intel com>
---
src/miners/fs/tracker-config.c | 55 ++++++++++++++++++++++++++++++++++++++-
src/miners/fs/tracker-config.h | 3 ++
2 files changed, 56 insertions(+), 2 deletions(-)
diff --git a/src/miners/fs/tracker-config.c b/src/miners/fs/tracker-config.c
index f81f16d..bfcf600 100644
--- a/src/miners/fs/tracker-config.c
+++ b/src/miners/fs/tracker-config.c
@@ -50,6 +50,7 @@
#define DEFAULT_INDEX_ON_BATTERY_FIRST_TIME TRUE
#define DEFAULT_LOW_DISK_SPACE_LIMIT 1 /* 0->100 / -1 */
#define DEFAULT_CRAWLING_INTERVAL 0 /* 0->365 / -1 */
+#define DEFAULT_REMOVABLE_DAYS_THRESHOLD 3 /* 0->365 / -1 */
typedef struct {
/* General */
@@ -74,6 +75,7 @@ typedef struct {
GSList *ignored_directories_with_content;
GSList *ignored_files;
gint crawling_interval;
+ gint removable_days_threshold;
/* Convenience data */
GSList *ignored_directory_patterns;
@@ -129,7 +131,8 @@ enum {
PROP_IGNORED_DIRECTORIES,
PROP_IGNORED_DIRECTORIES_WITH_CONTENT,
PROP_IGNORED_FILES,
- PROP_CRAWLING_INTERVAL
+ PROP_CRAWLING_INTERVAL,
+ PROP_REMOVABLE_DAYS_THRESHOLD
};
static ObjectToKeyFile conversions[] = {
@@ -151,6 +154,7 @@ static ObjectToKeyFile conversions[] = {
{ G_TYPE_POINTER, "ignored-directories-with-content", GROUP_INDEXING, "IgnoredDirectoriesWithContent"
},
{ G_TYPE_POINTER, "ignored-files", GROUP_INDEXING, "IgnoredFiles" },
{ G_TYPE_INT, "crawling-interval", GROUP_INDEXING, "CrawlingInterval" }
+ { G_TYPE_INT, "removable-days-threshold", GROUP_INDEXING, "RemovableDaysThreshold" }
};
G_DEFINE_TYPE (TrackerConfig, tracker_config, TRACKER_TYPE_CONFIG_FILE);
@@ -299,6 +303,17 @@ tracker_config_class_init (TrackerConfigClass *klass)
365,
DEFAULT_CRAWLING_INTERVAL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+ g_object_class_install_property (object_class,
+ PROP_REMOVABLE_DAYS_THRESHOLD,
+ g_param_spec_int ("removable-days-threshold",
+ "Removable days threshold",
+ " Threshold in days after which files from
removables devices"
+ " will be removed from database if not mounted. 0
means never, "
+ " maximum is 2000.",
+ 3,
+ 2000,
+ DEFAULT_REMOVABLE_DAYS_THRESHOLD,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
g_type_class_add_private (object_class, sizeof (TrackerConfigPrivate));
}
@@ -380,7 +395,10 @@ config_set_property (GObject *object,
tracker_config_set_crawling_interval (TRACKER_CONFIG (object),
g_value_get_int (value));
break;
-
+ case PROP_REMOVABLE_DAYS_THRESHOLD:
+ tracker_config_set_removable_days_threshold (TRACKER_CONFIG (object),
+ g_value_get_int (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
@@ -448,6 +466,9 @@ config_get_property (GObject *object,
case PROP_CRAWLING_INTERVAL:
g_value_set_int (value, priv->crawling_interval);
break;
+ case PROP_REMOVABLE_DAYS_THRESHOLD:
+ g_value_set_int (value, priv->removable_days_threshold);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
@@ -1237,6 +1258,18 @@ tracker_config_get_crawling_interval (TrackerConfig *config)
return priv->crawling_interval;
}
+gint
+tracker_config_get_removable_day_threshold (TrackerConfig *config)
+{
+ TrackerConfigPrivate *priv;
+
+ g_return_val_if_fail (TRACKER_IS_CONFIG (config), 0);
+
+ priv = TRACKER_CONFIG_GET_PRIVATE (config);
+
+ return priv->removable_days_threshold;
+}
+
void
tracker_config_set_verbosity (TrackerConfig *config,
gint value)
@@ -1633,6 +1666,24 @@ tracker_config_set_crawling_interval (TrackerConfig *config,
g_object_notify (G_OBJECT (config), "crawling-interval");
}
+void
+tracker_config_set_crawling_interval (TrackerConfig *config,
+ gint value)
+{
+ TrackerConfigPrivate *priv;
+
+ g_return_if_fail (TRACKER_IS_CONFIG (config));
+
+ if (!tracker_keyfile_object_validate_int (config, "removable-days-threshold", value)) {
+ return;
+ }
+
+ priv = TRACKER_CONFIG_GET_PRIVATE (config);
+
+ priv->removable_days_threshold = value;
+ g_object_notify (G_OBJECT (config), "removable-days-threshold");
+}
+
/*
* Convenience functions
*/
diff --git a/src/miners/fs/tracker-config.h b/src/miners/fs/tracker-config.h
index bc696f6..cc48746 100644
--- a/src/miners/fs/tracker-config.h
+++ b/src/miners/fs/tracker-config.h
@@ -69,6 +69,7 @@ GSList * tracker_config_get_ignored_directories (TrackerConfi
GSList * tracker_config_get_ignored_directories_with_content (TrackerConfig *config);
GSList * tracker_config_get_ignored_files (TrackerConfig *config);
gint tracker_config_get_crawling_interval (TrackerConfig *config);
+gint tracker_config_get_removable_days_threshold (TrackerConfig *config);
void tracker_config_set_verbosity (TrackerConfig *config,
gint value);
@@ -102,6 +103,8 @@ void tracker_config_set_ignored_files (TrackerConfi
GSList *files);
void tracker_config_set_crawling_interval (TrackerConfig *config,
gint interval);
+gint tracker_config_set_removable_days_threshold (TrackerConfig *config,
+ gint value);
/*
* Convenience functions:
--
1.7.2.3
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]