diff options
author | Sam Thursfield <sam@afuera.me.uk> | 2020-09-02 12:38:48 +0200 |
---|---|---|
committer | Sam Thursfield <sam@afuera.me.uk> | 2020-09-02 18:50:17 +0200 |
commit | bd30a21a0ce1b40ca59814f731bd761670601aaa (patch) | |
tree | 87bbcbd9da8a23f35725772394745e8a9d8db497 /src/nautilus-tag-manager.c | |
parent | 29105fc9f6abf2eca6f986104763d21b9f22f0fb (diff) | |
download | nautilus-bd30a21a0ce1b40ca59814f731bd761670601aaa.tar.gz |
Limit starred files to within user's home directory
Previously starred files were limited to directories indexed by Tracker.
Since the 'Port to Tracker 3' commit this is no longer the case.
However, to avoid unbounded growth in the starred files database we
want to prevent starring of network locations and removable devices
for now as these entries might go stale and we don't have any way
to clean them up.
Diffstat (limited to 'src/nautilus-tag-manager.c')
-rw-r--r-- | src/nautilus-tag-manager.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/nautilus-tag-manager.c b/src/nautilus-tag-manager.c index 2606d0d02..f41b3ec8f 100644 --- a/src/nautilus-tag-manager.c +++ b/src/nautilus-tag-manager.c @@ -41,6 +41,7 @@ struct _NautilusTagManager TrackerSparqlStatement *query_file_is_starred; GHashTable *starred_file_uris; + GFile *home; GCancellable *cancellable; }; @@ -676,4 +677,16 @@ nautilus_tag_manager_init (NautilusTagManager *self) (GDestroyNotify) g_free, /* values are keys */ NULL); + self->home = g_file_new_for_path (g_get_home_dir ()); +} + +gboolean +nautilus_tag_manager_can_star_contents (NautilusTagManager *tag_manager, + GFile *directory) +{ + /* We only allow files to be starred inside the home directory for now. + * This avoids the starred files database growing too big. + * See https://gitlab.gnome.org/GNOME/nautilus/-/merge_requests/553#note_903108 + */ + return g_file_has_prefix (directory, tag_manager->home) || g_file_equal (directory, tag_manager->home); } |