[tracker] tracker-miner-fs: Handle absolute paths in ignored dirs
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] tracker-miner-fs: Handle absolute paths in ignored dirs
- Date: Thu, 16 Feb 2012 14:19:46 +0000 (UTC)
commit a386e6a653e024d9ed5d22566ac787d48ba75e79
Author: Carlos Garnacho <carlos lanedo com>
Date: Thu Feb 16 15:12:09 2012 +0100
tracker-miner-fs: Handle absolute paths in ignored dirs
Only globbing on basenames was handled, so allow setting absolute
paths to be ignored too, which is nicer to the casual user.
src/libtracker-miner/tracker-indexing-tree.c | 24 +++++++++++++++++++++---
1 files changed, 21 insertions(+), 3 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-indexing-tree.c b/src/libtracker-miner/tracker-indexing-tree.c
index 3f9fbff..9b09baa 100644
--- a/src/libtracker-miner/tracker-indexing-tree.c
+++ b/src/libtracker-miner/tracker-indexing-tree.c
@@ -48,6 +48,7 @@ struct _PatternData
{
GPatternSpec *pattern;
TrackerFilterType type;
+ GFile *file; /* Only filled in in absolute paths */
};
struct _FindNodeData
@@ -115,16 +116,24 @@ pattern_data_new (const gchar *glob_string,
{
PatternData *data;
- data = g_slice_new (PatternData);
+ data = g_slice_new0 (PatternData);
data->pattern = g_pattern_spec_new (glob_string);
data->type = type;
+ if (g_path_is_absolute (glob_string)) {
+ data->file = g_file_new_for_path (glob_string);
+ }
+
return data;
}
static void
pattern_data_free (PatternData *data)
{
+ if (data->file) {
+ g_object_unref (data->file);
+ }
+
g_pattern_spec_free (data->pattern);
g_slice_free (PatternData, data);
}
@@ -568,8 +577,17 @@ tracker_indexing_tree_file_matches_filter (TrackerIndexingTree *tree,
filters = filters->next;
- if (data->type == type &&
- g_pattern_match_string (data->pattern, basename)) {
+ if (data->type != type)
+ continue;
+
+ if (data->file &&
+ (g_file_equal (file, data->file) ||
+ g_file_has_prefix (file, data->file))) {
+ g_free (basename);
+ return TRUE;
+ }
+
+ if (g_pattern_match_string (data->pattern, basename)) {
g_free (basename);
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]