[tracker/miner-fs-refactor: 27/127] tracker-miner-fs: Use filter policies in TrackerMinerApplications



commit 44b5a3ecfe83fbdf2655d27f728d3512567b36b4
Author: Carlos Garnacho <carlos lanedo com>
Date:   Thu Sep 8 17:33:52 2011 +0200

    tracker-miner-fs: Use filter policies in TrackerMinerApplications
    
    Now all files are rejected, unless they match the *.desktop|*.directory
    filter

 src/miners/fs/tracker-miner-applications.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/miners/fs/tracker-miner-applications.c b/src/miners/fs/tracker-miner-applications.c
index 9c68f54..f438564 100644
--- a/src/miners/fs/tracker-miner-applications.c
+++ b/src/miners/fs/tracker-miner-applications.c
@@ -226,9 +226,24 @@ miner_applications_initable_init (GInitable     *initable,
 	TrackerMinerFS *fs;
 	TrackerMinerApplications *app;
 	GError *inner_error = NULL;
+	TrackerIndexingTree *indexing_tree;
 
 	fs = TRACKER_MINER_FS (initable);
 	app = TRACKER_MINER_APPLICATIONS (initable);
+	indexing_tree = tracker_miner_fs_get_indexing_tree (fs);
+
+	/* Set up files filter, deny every file, but
+	 * those with a .desktop/directory extension
+	 */
+	tracker_indexing_tree_set_default_policy (indexing_tree,
+						  TRACKER_FILTER_FILE,
+						  TRACKER_FILTER_POLICY_DENY);
+	tracker_indexing_tree_add_filter (indexing_tree,
+					  TRACKER_FILTER_FILE,
+					  "*.desktop");
+	tracker_indexing_tree_add_filter (indexing_tree,
+					  TRACKER_FILTER_FILE,
+					  "*.directory");
 
 	/* Chain up parent's initable callback before calling child's one */
 	if (!miner_applications_initable_parent_iface->init (initable, cancellable, &inner_error)) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]