[tracker-miners/wip/carlosg/shuffle-libtracker-miner: 26/116] libtracker-miner: Fix content filter with default policy=deny



commit 164c31bb4a0f1b2f57472df0580ebd3c75c3b647
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Oct 18 22:45:10 2017 +0200

    libtracker-miner: Fix content filter with default policy=deny
    
    We deemed the directory as bad whenever any file didn't match the
    filter, but files that don't match the filter should not trigger
    it in one way or another.

 src/libtracker-miner/tracker-indexing-tree.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-indexing-tree.c b/src/libtracker-miner/tracker-indexing-tree.c
index d5a098a1b..d56c7f882 100644
--- a/src/libtracker-miner/tracker-indexing-tree.c
+++ b/src/libtracker-miner/tracker-indexing-tree.c
@@ -917,23 +917,31 @@ tracker_indexing_tree_parent_is_indexable (TrackerIndexingTree *tree,
                                            GFile               *parent,
                                            GList               *children)
 {
+       TrackerIndexingTreePrivate *priv;
+       gboolean has_match = FALSE;
+
+       g_return_val_if_fail (TRACKER_IS_INDEXING_TREE (tree), FALSE);
+       g_return_val_if_fail (G_IS_FILE (parent), FALSE);
+
+       priv = tree->priv;
+
        if (!tracker_indexing_tree_file_is_indexable (tree,
                                                      parent,
                                                      G_FILE_TYPE_DIRECTORY)) {
                return FALSE;
        }
 
-       while (children) {
-               if (indexing_tree_file_is_filtered (tree,
-                                                   TRACKER_FILTER_PARENT_DIRECTORY,
-                                                   children->data)) {
-                       return FALSE;
-               }
-
+       while (children && !has_match) {
+               has_match = tracker_indexing_tree_file_matches_filter (tree,
+                                                                      TRACKER_FILTER_PARENT_DIRECTORY,
+                                                                      children->data);
                children = children->next;
        }
 
-       return TRUE;
+       if (priv->policies[TRACKER_FILTER_PARENT_DIRECTORY] == TRACKER_FILTER_POLICY_ACCEPT)
+               return !has_match;
+       else
+               return has_match;
 }
 
 /**


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