diff options
author | António Fernandes <antoniof@gnome.org> | 2018-01-04 01:58:37 +0000 |
---|---|---|
committer | António Fernandes <antoniof@gnome.org> | 2018-01-04 18:32:50 +0000 |
commit | 90799c2af799af79843baeaf36e9e29a65f5160f (patch) | |
tree | 1522d2e302817993a8fe12fa65e6f15e50e4e7a9 | |
parent | 9238456bcbfbda9d25cc2f8e55b4fe6e7f14e887 (diff) | |
download | nautilus-90799c2af799af79843baeaf36e9e29a65f5160f.tar.gz |
bookmark-list: Disable bookmarking recent:// and trash://
These locations are listed in the sidebar already. Bookmarking duplicates them.
We already disable bookmarking Home, Favories, XDG User Firs, and Other Locations.
Do the same thing for Recent and Trash.
As a side effect, this will disable bookmarking child folders inside Trash.
Fixes: #189
-rw-r--r-- | src/nautilus-bookmark-list.c | 10 | ||||
-rw-r--r-- | src/nautilus-file-utilities.c | 19 | ||||
-rw-r--r-- | src/nautilus-file-utilities.h | 2 |
3 files changed, 31 insertions, 0 deletions
diff --git a/src/nautilus-bookmark-list.c b/src/nautilus-bookmark-list.c index 926d949fe..1cae8f628 100644 --- a/src/nautilus-bookmark-list.c +++ b/src/nautilus-bookmark-list.c @@ -643,6 +643,16 @@ nautilus_bookmark_list_can_bookmark_location (NautilusBookmarkList *list, return FALSE; } + if (nautilus_is_recent_directory (location)) + { + return FALSE; + } + + if (nautilus_is_trash_directory (location)) + { + return FALSE; + } + if (nautilus_is_favorite_directory (location)) { return FALSE; diff --git a/src/nautilus-file-utilities.c b/src/nautilus-file-utilities.c index ba67b8559..55040aa91 100644 --- a/src/nautilus-file-utilities.c +++ b/src/nautilus-file-utilities.c @@ -540,6 +540,16 @@ nautilus_is_search_directory (GFile *dir) } gboolean +nautilus_is_recent_directory (GFile *dir) +{ + g_autofree gchar *uri = NULL; + + uri = g_file_get_uri (dir); + + return eel_uri_is_recent (uri); +} + +gboolean nautilus_is_favorite_directory (GFile *dir) { g_autofree gchar *uri = NULL; @@ -553,6 +563,15 @@ nautilus_is_favorite_directory (GFile *dir) } gboolean +nautilus_is_trash_directory (GFile *dir) +{ + g_autofree gchar *uri = NULL; + + uri = g_file_get_uri (dir); + return eel_uri_is_trash (uri); +} + +gboolean nautilus_is_other_locations_directory (GFile *dir) { g_autofree gchar *uri = NULL; diff --git a/src/nautilus-file-utilities.h b/src/nautilus-file-utilities.h index 415f01b3e..790c9bbf4 100644 --- a/src/nautilus-file-utilities.h +++ b/src/nautilus-file-utilities.h @@ -43,7 +43,9 @@ gboolean nautilus_is_home_directory_file (GFile *dir, const char *filename); gboolean nautilus_is_in_system_dir (GFile *location); gboolean nautilus_is_search_directory (GFile *dir); +gboolean nautilus_is_recent_directory (GFile *dir); gboolean nautilus_is_favorite_directory (GFile *dir); +gboolean nautilus_is_trash_directory (GFile *dir); gboolean nautilus_is_other_locations_directory (GFile *dir); GMount * nautilus_get_mounted_mount_for_root (GFile *location); |