[nautilus/wip/antoniof/update-starred-uris] tag-manager: Ignore starred files ouside $HOME
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/antoniof/update-starred-uris] tag-manager: Ignore starred files ouside $HOME
- Date: Fri, 2 Oct 2020 08:36:52 +0000 (UTC)
commit 67d42aba75af2bdeee4a50ca49a2a49aaa7a16ef
Author: António Fernandes <antoniof gnome org>
Date: Sat Sep 26 19:16:51 2020 +0100
tag-manager: Ignore starred files ouside $HOME
At the moment we restrict starring to within Home, but the database
might include URIs from outside of it. Such may happen after a file
move operation, as per the previous commit.
Keeping the moved URIs in the database is useful in case the move is
undone, because we change the URI back. But otherwise, the non-home
URIs remain in the database indefinitely.
So, let's filter them out when listing the starred files.
src/nautilus-tag-manager.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
---
diff --git a/src/nautilus-tag-manager.c b/src/nautilus-tag-manager.c
index 5486c5cb7..2362640fe 100644
--- a/src/nautilus-tag-manager.c
+++ b/src/nautilus-tag-manager.c
@@ -224,7 +224,25 @@ get_query_status (TrackerSparqlCursor *cursor,
GList *
nautilus_tag_manager_get_starred_files (NautilusTagManager *self)
{
- return g_hash_table_get_keys (self->starred_file_uris);
+ GList *starred_file_uris;
+
+ starred_file_uris = g_hash_table_get_keys (self->starred_file_uris);
+
+ /* Filter out files ouside $HOME, because we don't support starring these
+ * yet. See comment on nautilus_tag_manager_can_star_contents() */
+ for (GList *l = starred_file_uris; l != NULL; l = l->next)
+ {
+ g_autoptr (GFile) file = g_file_new_for_uri (l->data);
+
+ if (!g_file_has_prefix (file, self->home))
+ {
+ GList *skip = l;
+ l = l->prev;
+ starred_file_uris = g_list_delete_link (starred_file_uris, skip);
+ }
+ }
+
+ return starred_file_uris;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]