summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntónio Fernandes <antoniof@gnome.org>2018-03-23 15:26:50 +0000
committerCarlos Soriano <csoriano1618@gmail.com>2018-04-09 19:04:47 +0000
commitc9d73d5a715c7a8f52e2b1b4ec6548619ed163a1 (patch)
tree207e549c037655f3c1894d63a7dae1cf59c66432
parentd4ab68d33609c8a882696b62970f501ec17dc06b (diff)
downloadnautilus-c9d73d5a715c7a8f52e2b1b4ec6548619ed163a1.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. (cherry picked from commit 2787773c625d647ec603bb63071a8ff0699c6ba9)
-rw-r--r--src/nautilus-files-view.c34
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;