summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntónio Fernandes <antoniof@gnome.org>2020-09-26 19:16:51 +0100
committerAntónio Fernandes <antoniof@gnome.org>2020-10-02 09:36:44 +0100
commit67d42aba75af2bdeee4a50ca49a2a49aaa7a16ef (patch)
tree68ddc90b1db13eab5b2803f5432f554df37e94e6
parent135190900b7f5b9bad0fc41a4aac8b88e0dd4c7f (diff)
downloadnautilus-wip/antoniof/update-starred-uris.tar.gz
tag-manager: Ignore starred files ouside $HOMEwip/antoniof/update-starred-uris
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.
-rw-r--r--src/nautilus-tag-manager.c20
1 files changed, 19 insertions, 1 deletions
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