[tracker/removable-opticals: 2/9] Fixes GB#621110: Remove resources from store if directory no longer indexed after conf change
- From: Aleksander Morgado <aleksm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/removable-opticals: 2/9] Fixes GB#621110: Remove resources from store if directory no longer indexed after conf change
- Date: Thu, 17 Jun 2010 13:38:42 +0000 (UTC)
commit 2d0dfca3311ac2337b69e11e85a05383202767f1
Author: Aleksander Morgado <aleksander lanedo com>
Date: Wed Jun 16 11:26:10 2010 +0200
Fixes GB#621110: Remove resources from store if directory no longer indexed after conf change
.../libtracker-miner/libtracker-miner-sections.txt | 1 +
src/libtracker-miner/tracker-miner-fs.c | 38 ++++++++++++++++++--
src/libtracker-miner/tracker-miner-fs.h | 3 +-
src/miners/fs/tracker-miner-files.c | 5 ++-
4 files changed, 41 insertions(+), 6 deletions(-)
---
diff --git a/docs/reference/libtracker-miner/libtracker-miner-sections.txt b/docs/reference/libtracker-miner/libtracker-miner-sections.txt
index fa5f637..459ea3b 100644
--- a/docs/reference/libtracker-miner/libtracker-miner-sections.txt
+++ b/docs/reference/libtracker-miner/libtracker-miner-sections.txt
@@ -69,6 +69,7 @@ TrackerMinerFS
TrackerMinerFSClass
tracker_miner_fs_directory_add
tracker_miner_fs_directory_remove
+tracker_miner_fs_directory_remove_full
tracker_miner_fs_file_add
tracker_miner_fs_file_notify
tracker_miner_fs_set_throttle
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index 8244304..553da50 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -1496,7 +1496,7 @@ item_remove (TrackerMinerFS *fs,
iri_cache_invalidate (fs, file);
uri = g_file_get_uri (file);
- g_debug ("Removing item: '%s' (Deleted from filesystem)",
+ g_debug ("Removing item: '%s' (Deleted from filesystem or no longer monitored)",
uri);
if (!item_query_exists (fs, file, NULL, &mime)) {
@@ -2271,7 +2271,7 @@ remove_unexisting_file_cb (gpointer key,
TrackerMinerFS *fs = user_data;
GFile *file = key;
- /* If file no longer exists, remove it from the store*/
+ /* If file no longer exists, remove it from the store */
if (!g_file_query_exists (file, NULL)) {
gchar *uri;
@@ -3181,7 +3181,8 @@ check_files_removal (GQueue *queue,
* @fs: a #TrackerMinerFS
* @file: #GFile for the directory to be removed
*
- * Removes a directory from being inspected by @fs.
+ * Removes a directory from being inspected by @fs. Note that only directory
+ * watches are removed.
*
* Returns: %TRUE if the directory was successfully removed.
**/
@@ -3268,6 +3269,37 @@ tracker_miner_fs_directory_remove (TrackerMinerFS *fs,
return return_val;
}
+
+/**
+ * tracker_miner_fs_directory_remove_full:
+ * @fs: a #TrackerMinerFS
+ * @file: #GFile for the directory to be removed
+ *
+ * Removes a directory from being inspected by @fs, and removes all
+ * associated metadata from the store.
+ *
+ * Returns: %TRUE if the directory was successfully removed.
+ **/
+gboolean
+tracker_miner_fs_directory_remove_full (TrackerMinerFS *fs,
+ GFile *file)
+{
+ g_return_val_if_fail (TRACKER_IS_MINER_FS (fs), FALSE);
+ g_return_val_if_fail (G_IS_FILE (file), FALSE);
+
+ /* Tell miner not to keep on inspecting the directory... */
+ if (tracker_miner_fs_directory_remove (fs, file)) {
+ /* And remove all info about the directory from the store... */
+ g_queue_push_tail (fs->private->items_deleted,
+ g_object_ref (file));
+ item_queue_handlers_set_up (fs);
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
/**
* tracker_miner_fs_file_add:
* @fs: a #TrackerMinerFS
diff --git a/src/libtracker-miner/tracker-miner-fs.h b/src/libtracker-miner/tracker-miner-fs.h
index 93c5a78..8860442 100644
--- a/src/libtracker-miner/tracker-miner-fs.h
+++ b/src/libtracker-miner/tracker-miner-fs.h
@@ -100,6 +100,8 @@ void tracker_miner_fs_directory_add (TrackerMinerFS *fs,
gboolean recurse);
gboolean tracker_miner_fs_directory_remove (TrackerMinerFS *fs,
GFile *file);
+gboolean tracker_miner_fs_directory_remove_full (TrackerMinerFS *fs,
+ GFile *file);
void tracker_miner_fs_file_add (TrackerMinerFS *fs,
GFile *file);
void tracker_miner_fs_file_notify (TrackerMinerFS *fs,
@@ -118,7 +120,6 @@ void tracker_miner_fs_set_initial_crawling (TrackerMinerFS *fs,
gboolean do_initial_crawling);
gboolean tracker_miner_fs_get_initial_crawling (TrackerMinerFS *fs);
-
G_END_DECLS
#endif /* __LIBTRACKER_MINER_MINER_FS_H__ */
diff --git a/src/miners/fs/tracker-miner-files.c b/src/miners/fs/tracker-miner-files.c
index 1611a5a..34d736e 100644
--- a/src/miners/fs/tracker-miner-files.c
+++ b/src/miners/fs/tracker-miner-files.c
@@ -1246,10 +1246,11 @@ update_directories_from_new_config (TrackerMinerFS *mf,
if (!tracker_string_in_gslist (path, new_dirs)) {
GFile *file;
- g_message (" Removing directory:'%s'", path);
+ g_message (" Removing directory: '%s'", path);
file = g_file_new_for_path (path);
- tracker_miner_fs_directory_remove (TRACKER_MINER_FS (mf), file);
+ /* Fully remove item (monitors and from store) */
+ tracker_miner_fs_directory_remove_full (TRACKER_MINER_FS (mf), file);
g_object_unref (file);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]