[tracker] libtracker-miner: Allow to invalidate files iri recursively
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] libtracker-miner: Allow to invalidate files iri recursively
- Date: Mon, 15 Feb 2016 17:04:21 +0000 (UTC)
commit de017390435c8242225bb348acabee897c406e2c
Author: Haithem BEN GHORBAL <haithem benghorbal gmail com>
Date: Thu Feb 11 13:46:57 2016 +0100
libtracker-miner: Allow to invalidate files iri recursively
This will be useful for delete operations.
src/libtracker-miner/tracker-file-notifier.c | 37 +++++++++++++++++++++----
src/libtracker-miner/tracker-file-notifier.h | 3 +-
src/libtracker-miner/tracker-miner-fs.c | 2 +-
3 files changed, 34 insertions(+), 8 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-file-notifier.c b/src/libtracker-miner/tracker-file-notifier.c
index f95cea4..6356804 100644
--- a/src/libtracker-miner/tracker-file-notifier.c
+++ b/src/libtracker-miner/tracker-file-notifier.c
@@ -1782,9 +1782,24 @@ tracker_file_notifier_get_file_iri (TrackerFileNotifier *notifier,
return iri;
}
+static gboolean
+file_notifier_invalidate_file_iri_foreach (GFile *file,
+ gpointer user_data)
+{
+ TrackerFileSystem *file_system = user_data;
+
+ tracker_file_system_set_property (file_system,
+ file,
+ quark_property_iri,
+ NULL);
+
+ return FALSE;
+}
+
void
tracker_file_notifier_invalidate_file_iri (TrackerFileNotifier *notifier,
- GFile *file)
+ GFile *file,
+ gboolean recursive)
{
TrackerFileNotifierPrivate *priv;
GFile *canonical;
@@ -1801,11 +1816,21 @@ tracker_file_notifier_invalidate_file_iri (TrackerFileNotifier *notifier,
return;
}
- /* Set a NULL iri, so we make sure to look it up afterwards */
- tracker_file_system_set_property (priv->file_system,
- canonical,
- quark_property_iri,
- NULL);
+ if (!recursive) {
+ /* Set a NULL iri, so we make sure to look it up afterwards */
+ tracker_file_system_set_property (priv->file_system,
+ canonical,
+ quark_property_iri,
+ NULL);
+ return;
+ }
+
+ tracker_file_system_traverse (priv->file_system,
+ canonical,
+ G_PRE_ORDER,
+ file_notifier_invalidate_file_iri_foreach,
+ -1,
+ priv->file_system);
}
GFileType
diff --git a/src/libtracker-miner/tracker-file-notifier.h b/src/libtracker-miner/tracker-file-notifier.h
index e365774..e8ef3a6 100644
--- a/src/libtracker-miner/tracker-file-notifier.h
+++ b/src/libtracker-miner/tracker-file-notifier.h
@@ -91,7 +91,8 @@ const gchar * tracker_file_notifier_get_file_iri (TrackerFileNotifier *notif
gboolean force);
void tracker_file_notifier_invalidate_file_iri (TrackerFileNotifier *notifier,
- GFile *file);
+ GFile *file,
+ gboolean recursive);
GFileType tracker_file_notifier_get_file_type (TrackerFileNotifier *notifier,
GFile *file);
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index b3fa7fc..6ce7c0a 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -1335,7 +1335,7 @@ sparql_buffer_task_finished_cb (GObject *object,
task_file = tracker_task_get_file (task);
- tracker_file_notifier_invalidate_file_iri (priv->file_notifier, task_file);
+ tracker_file_notifier_invalidate_file_iri (priv->file_notifier, task_file, FALSE);
if (item_queue_is_blocked_by_file (fs, task_file)) {
g_object_unref (priv->item_queue_blocker);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]