[tracker] libtracker-miner: Check for filtered out files during deletion checks



commit 5e449412f623afb27f27c77e936a2ef2af1a42d0
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue May 3 00:57:26 2016 +0200

    libtracker-miner: Check for filtered out files during deletion checks
    
    When checking the deleted contents of a folder, also find out whether
    those are currently filtered out. Those must be deleted as well.

 src/libtracker-miner/tracker-file-notifier.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-file-notifier.c b/src/libtracker-miner/tracker-file-notifier.c
index 6ce5725..33e3934 100644
--- a/src/libtracker-miner/tracker-file-notifier.c
+++ b/src/libtracker-miner/tracker-file-notifier.c
@@ -583,6 +583,7 @@ sparql_contents_check_deleted (TrackerFileNotifier *notifier,
        while (tracker_sparql_cursor_next (cursor, NULL, NULL)) {
                const gchar *uri;
                gboolean is_folder;
+               GFileType file_type;
 
                /* Sometimes URI can be NULL when nie:url and
                 * nfo:belongsToContainer does not have a strictly 1:1
@@ -598,18 +599,23 @@ sparql_contents_check_deleted (TrackerFileNotifier *notifier,
                file = g_file_new_for_uri (uri);
                iri = tracker_sparql_cursor_get_string (cursor, 1, NULL);
                is_folder = tracker_sparql_cursor_get_boolean (cursor, 3);
+               file_type = is_folder ? G_FILE_TYPE_DIRECTORY : G_FILE_TYPE_UNKNOWN;
+               canonical = tracker_file_system_peek_file (priv->file_system, file);
 
-               if (!tracker_file_system_peek_file (priv->file_system, file)) {
+               if (!canonical) {
                        /* The file exists on the store, but not on the
                         * crawled content, insert temporarily to handle
                         * the delete event.
                         */
                        canonical = _insert_store_info (notifier, file,
-                                                       is_folder ?
-                                                       G_FILE_TYPE_DIRECTORY :
-                                                       G_FILE_TYPE_UNKNOWN,
+                                                       file_type,
                                                        iri, 0);
                        g_signal_emit (notifier, signals[FILE_DELETED], 0, canonical);
+               } else if (!tracker_indexing_tree_file_is_indexable (priv->indexing_tree,
+                                                                    canonical,
+                                                                    file_type)) {
+                       /* File is there, but is not indexable anymore, remove too */
+                       g_signal_emit (notifier, signals[FILE_DELETED], 0, canonical);
                }
 
                g_object_unref (file);


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