diff options
author | António Fernandes <antoniof@gnome.org> | 2018-03-23 15:26:50 +0000 |
---|---|---|
committer | António Fernandes <antoniof@gnome.org> | 2018-03-23 22:00:37 +0000 |
commit | 2787773c625d647ec603bb63071a8ff0699c6ba9 (patch) | |
tree | db914129df39c9b6da9a61ec853da0644a47ed98 | |
parent | dee6bc2596d5f435af4a2929468612c01a935fc3 (diff) | |
download | nautilus-2787773c625d647ec603bb63071a8ff0699c6ba9.tar.gz |
files-view: Allow trashing/deleting Desktop dir
We disable trashing/deleting the Desktop directory. But we allow
trashing/deleting other XDG user dirs (Documents, Music,...).
If a person doesn't want to use an "icons on desktop" implementation,
this person may want to remove this folder from their Home directory.
To allow it, don't disable trashing/deleting the Desktop directory.
-rw-r--r-- | src/nautilus-files-view.c | 34 |
1 files changed, 11 insertions, 23 deletions
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c index e2e3ddd44..a18cd8cf8 100644 --- a/src/nautilus-files-view.c +++ b/src/nautilus-files-view.c @@ -4618,35 +4618,23 @@ nautilus_files_view_get_content_widget (NautilusFilesView *view) return priv->scrolled_window; } -/* desktop_or_home_dir_in_selection +/* home_dir_in_selection() * - * Return TRUE if either the desktop or the home directory is in the selection. + * Return TRUE if the home directory is in the selection. */ static gboolean -desktop_or_home_dir_in_selection (GList *selection) +home_dir_in_selection (GList *selection) { - gboolean saw_desktop_or_home_dir; - GList *node; - NautilusFile *file; - - saw_desktop_or_home_dir = FALSE; - - for (node = selection; node != NULL; node = node->next) + for (GList *node = selection; node != NULL; node = node->next) { - file = NAUTILUS_FILE (node->data); - - saw_desktop_or_home_dir = - nautilus_file_is_home (file) - || nautilus_file_is_desktop_directory (file); - - if (saw_desktop_or_home_dir) + if (nautilus_file_is_home (NAUTILUS_FILE (node->data))) { - break; + return TRUE; } } - return saw_desktop_or_home_dir; + return FALSE; } static void @@ -7236,7 +7224,7 @@ real_update_actions_state (NautilusFilesView *view) GList *l; gint selection_count; gboolean zoom_level_is_default; - gboolean selection_contains_desktop_or_home_dir; + gboolean selection_contains_home_dir; gboolean selection_contains_recent; gboolean selection_contains_search; gboolean selection_contains_starred; @@ -7276,7 +7264,7 @@ real_update_actions_state (NautilusFilesView *view) selection = nautilus_view_get_selection (NAUTILUS_VIEW (view)); selection_count = g_list_length (selection); - selection_contains_desktop_or_home_dir = desktop_or_home_dir_in_selection (selection); + selection_contains_home_dir = home_dir_in_selection (selection); selection_contains_recent = showing_recent_directory (view); selection_contains_starred = showing_starred_directory (view); selection_contains_search = nautilus_view_is_searching (NAUTILUS_VIEW (view)); @@ -7291,11 +7279,11 @@ real_update_actions_state (NautilusFilesView *view) can_delete_files = can_delete_all (selection) && selection_count != 0 && - !selection_contains_desktop_or_home_dir; + !selection_contains_home_dir; can_trash_files = can_trash_all (selection) && selection_count != 0 && - !selection_contains_desktop_or_home_dir; + !selection_contains_home_dir; can_copy_files = selection_count != 0; can_move_files = can_delete_files && !selection_contains_recent && !selection_contains_starred; |