[tracker/follow-symlinks: 4/7] tracker-miner-fs: Support indexing symlinks if configured to
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/follow-symlinks: 4/7] tracker-miner-fs: Support indexing symlinks if configured to
- Date: Thu, 4 Sep 2014 16:31:40 +0000 (UTC)
commit 7e446e3baf482d04855826bd0e404e811c23db52
Author: Martyn Russell <martyn lanedo com>
Date: Thu Sep 4 14:10:39 2014 +0100
tracker-miner-fs: Support indexing symlinks if configured to
https://bugzilla.gnome.org/show_bug.cgi?id=726264
src/miners/fs/tracker-config.c | 22 ++++++++++++++++++++++
src/miners/fs/tracker-config.h | 1 +
src/miners/fs/tracker-miner-files.c | 28 ++++++++++++++++++++++++++++
3 files changed, 51 insertions(+), 0 deletions(-)
---
diff --git a/src/miners/fs/tracker-config.c b/src/miners/fs/tracker-config.c
index 2333a90..c122a36 100644
--- a/src/miners/fs/tracker-config.c
+++ b/src/miners/fs/tracker-config.c
@@ -47,6 +47,7 @@
#define DEFAULT_CRAWLING_INTERVAL -1 /* 0->365 / -1 / -2 */
#define DEFAULT_REMOVABLE_DAYS_THRESHOLD 3 /* 1->365 / 0 */
#define DEFAULT_ENABLE_WRITEBACK FALSE
+#define DEFAULT_FOLLOW_SYMLINKS FALSE
typedef struct {
/* NOTE: Only used with TRACKER_USE_CONFIG_FILES env var. */
@@ -121,6 +122,7 @@ enum {
PROP_IGNORED_DIRECTORIES_WITH_CONTENT,
PROP_IGNORED_FILES,
PROP_CRAWLING_INTERVAL,
+ PROP_FOLLOW_SYMLINKS,
PROP_REMOVABLE_DAYS_THRESHOLD,
/* Writeback */
@@ -145,6 +147,7 @@ static TrackerConfigMigrationEntry migration[] = {
{ G_TYPE_POINTER, "Indexing", "IgnoredDirectoriesWithContent", "ignored-directories-with-content",
FALSE, FALSE },
{ G_TYPE_POINTER, "Indexing", "IgnoredFiles", "ignored-files",
FALSE, FALSE },
{ G_TYPE_INT, "Indexing", "CrawlingInterval", "crawling-interval",
FALSE, FALSE },
+ { G_TYPE_BOOLEAN, "Indexing", "FollowSymlinks", "follow-symlinks",
FALSE, FALSE },
{ G_TYPE_INT, "Indexing", "RemovableDaysThreshold", "removable-days-threshold",
FALSE, FALSE },
{ G_TYPE_BOOLEAN, "Writeback", "EnableWriteback", "enable-writeback",
FALSE, FALSE },
{ 0 }
@@ -308,6 +311,13 @@ tracker_config_class_init (TrackerConfigClass *klass)
DEFAULT_CRAWLING_INTERVAL,
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
+ PROP_FOLLOW_SYMLINKS,
+ g_param_spec_boolean ("follow-symlinks",
+ "Follow symlinks",
+ "Set to true to follow file system symlinks",
+ DEFAULT_FOLLOW_SYMLINKS,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
PROP_REMOVABLE_DAYS_THRESHOLD,
g_param_spec_int ("removable-days-threshold",
"Removable days threshold",
@@ -481,6 +491,9 @@ config_get_property (GObject *object,
case PROP_CRAWLING_INTERVAL:
g_value_set_int (value, tracker_config_get_crawling_interval (config));
break;
+ case PROP_FOLLOW_SYMLINKS:
+ g_value_set_boolean (value, tracker_config_get_follow_symlinks (config));
+ break;
case PROP_REMOVABLE_DAYS_THRESHOLD:
g_value_set_int (value, tracker_config_get_removable_days_threshold (config));
break;
@@ -734,6 +747,7 @@ config_constructed (GObject *object)
g_settings_bind (settings, "throttle", object, "throttle", G_SETTINGS_BIND_GET);
g_settings_bind (settings, "low-disk-space-limit", object, "low-disk-space-limit",
G_SETTINGS_BIND_GET);
g_settings_bind (settings, "crawling-interval", object, "crawling-interval", G_SETTINGS_BIND_GET);
+ g_settings_bind (settings, "follow-symlinks", object, "follow-symlinks", G_SETTINGS_BIND_GET);
g_settings_bind (settings, "low-disk-space-limit", object, "low-disk-space-limit",
G_SETTINGS_BIND_GET);
g_settings_bind (settings, "removable-days-threshold", object, "removable-days-threshold",
G_SETTINGS_BIND_GET);
g_settings_bind (settings, "enable-monitors", object, "enable-monitors", G_SETTINGS_BIND_GET);
@@ -947,6 +961,14 @@ tracker_config_get_crawling_interval (TrackerConfig *config)
return g_settings_get_int (G_SETTINGS (config), "crawling-interval");
}
+gboolean
+tracker_config_get_follow_symlinks (TrackerConfig *config)
+{
+ g_return_val_if_fail (TRACKER_IS_CONFIG (config), DEFAULT_FOLLOW_SYMLINKS);
+
+ return g_settings_get_boolean (G_SETTINGS (config), "follow-symlinks");
+}
+
gint
tracker_config_get_removable_days_threshold (TrackerConfig *config)
{
diff --git a/src/miners/fs/tracker-config.h b/src/miners/fs/tracker-config.h
index 856a5a1..d19a12d 100644
--- a/src/miners/fs/tracker-config.h
+++ b/src/miners/fs/tracker-config.h
@@ -66,6 +66,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);
+gboolean tracker_config_get_follow_symlinks (TrackerConfig *config);
gint tracker_config_get_removable_days_threshold (TrackerConfig *config);
gboolean tracker_config_get_enable_writeback (TrackerConfig *config);
diff --git a/src/miners/fs/tracker-miner-files.c b/src/miners/fs/tracker-miner-files.c
index 7a03a0e..8ec366b 100644
--- a/src/miners/fs/tracker-miner-files.c
+++ b/src/miners/fs/tracker-miner-files.c
@@ -427,6 +427,10 @@ miner_files_initable_init (GInitable *initable,
flags |= TRACKER_DIRECTORY_FLAG_CHECK_MTIME;
}
+ if (tracker_config_get_follow_symlinks (mf->private->config)) {
+ flags |= TRACKER_DIRECTORY_FLAG_FOLLOW_SYMLINKS;
+ }
+
tracker_indexing_tree_add (indexing_tree, file, flags);
g_object_unref (file);
}
@@ -482,6 +486,10 @@ miner_files_initable_init (GInitable *initable,
flags |= TRACKER_DIRECTORY_FLAG_CHECK_MTIME;
}
+ if (tracker_config_get_follow_symlinks (mf->private->config)) {
+ flags |= TRACKER_DIRECTORY_FLAG_FOLLOW_SYMLINKS;
+ }
+
tracker_indexing_tree_add (indexing_tree, file, flags);
g_object_unref (file);
}
@@ -1049,6 +1057,10 @@ init_mount_points (TrackerMinerFiles *miner_files)
flags |= TRACKER_DIRECTORY_FLAG_MONITOR;
}
+ if (tracker_config_get_follow_symlinks
(miner_files->private->config)) {
+ flags |= TRACKER_DIRECTORY_FLAG_FOLLOW_SYMLINKS;
+ }
+
/* Add the current mount point as reported to have incorrect
* state. We will force mtime checks on this mount points,
* even if no-mtime-check-needed was set. */
@@ -1223,6 +1235,10 @@ mount_point_added_cb (TrackerStorage *storage,
flags |= TRACKER_DIRECTORY_FLAG_MONITOR;
}
+ if (tracker_config_get_follow_symlinks (miner->private->config)) {
+ flags |= TRACKER_DIRECTORY_FLAG_FOLLOW_SYMLINKS;
+ }
+
if (g_file_equal (config_file, mount_point_file) ||
g_file_has_prefix (config_file, mount_point_file)) {
/* If the config path is contained inside the mount path,
@@ -1258,6 +1274,10 @@ mount_point_added_cb (TrackerStorage *storage,
flags |= TRACKER_DIRECTORY_FLAG_MONITOR;
}
+ if (tracker_config_get_follow_symlinks (miner->private->config)) {
+ flags |= TRACKER_DIRECTORY_FLAG_FOLLOW_SYMLINKS;
+ }
+
config_file = g_file_new_for_path (l->data);
if (g_file_equal (config_file, mount_point_file) ||
g_file_has_prefix (config_file, mount_point_file)) {
@@ -1654,6 +1674,10 @@ update_directories_from_new_config (TrackerMinerFS *mf,
flags |= TRACKER_DIRECTORY_FLAG_CHECK_MTIME;
}
+ if (tracker_config_get_follow_symlinks (priv->config)) {
+ flags |= TRACKER_DIRECTORY_FLAG_FOLLOW_SYMLINKS;
+ }
+
/* Second add directories which are new */
for (sl = new_dirs; sl; sl = sl->next) {
const gchar *path;
@@ -2787,6 +2811,10 @@ miner_files_add_removable_or_optical_directory (TrackerMinerFiles *mf,
flags |= TRACKER_DIRECTORY_FLAG_MONITOR;
}
+ if (tracker_config_get_follow_symlinks (mf->private->config)) {
+ flags |= TRACKER_DIRECTORY_FLAG_FOLLOW_SYMLINKS;
+ }
+
g_object_set_qdata_full (G_OBJECT (mount_point_file),
mf->private->quark_mount_point_uuid,
g_strdup (uuid),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]