From c64cac619f31001719d668c8c19c8db0fda70743 Mon Sep 17 00:00:00 2001 From: Theo Linkspfeifer Date: Tue, 23 Apr 2019 00:49:13 +0200 Subject: [PATCH 1/1] Add additional check for DEL key in tree view (Bug #15095) --- thunar/thunar-tree-view.c | 53 +++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/thunar/thunar-tree-view.c b/thunar/thunar-tree-view.c index ed3410f6..bb264278 100644 --- a/thunar/thunar-tree-view.c +++ b/thunar/thunar-tree-view.c @@ -1242,7 +1242,10 @@ thunar_tree_view_delete_selected_files (ThunarTreeView *view) return FALSE; /* ask the user whether to delete the folder... */ - thunar_tree_view_action_move_to_trash (view); + if (thunar_g_vfs_is_uri_scheme_supported ("trash")) + thunar_tree_view_action_move_to_trash (view); + else + thunar_tree_view_action_delete (view); /* ...and we're done */ return TRUE; @@ -1828,18 +1831,21 @@ thunar_tree_view_action_move_to_trash (ThunarTreeView *view) file = thunar_tree_view_get_selected_file (view); if (G_LIKELY (file != NULL)) { - /* fake a file list */ - file_list.data = file; - file_list.next = NULL; - file_list.prev = NULL; - - /* check if we should permanently delete the files (user holds shift) */ - permanently = (gtk_get_current_event_state (&state) && (state & GDK_SHIFT_MASK) != 0); - - /* delete the file */ - application = thunar_application_get (); - thunar_application_unlink_files (application, GTK_WIDGET (view), &file_list, permanently); - g_object_unref (G_OBJECT (application)); + if (thunar_file_can_be_trashed (file)) + { + /* fake a file list */ + file_list.data = file; + file_list.next = NULL; + file_list.prev = NULL; + + /* check if we should permanently delete the files (user holds shift) */ + permanently = (gtk_get_current_event_state (&state) && (state & GDK_SHIFT_MASK) != 0); + + /* delete the file */ + application = thunar_application_get (); + thunar_application_unlink_files (application, GTK_WIDGET (view), &file_list, permanently); + g_object_unref (G_OBJECT (application)); + } /* release the file */ g_object_unref (G_OBJECT (file)); @@ -1861,15 +1867,18 @@ thunar_tree_view_action_delete (ThunarTreeView *view) file = thunar_tree_view_get_selected_file (view); if (G_LIKELY (file != NULL)) { - /* fake a file list */ - file_list.data = file; - file_list.next = NULL; - file_list.prev = NULL; - - /* delete the file */ - application = thunar_application_get (); - thunar_application_unlink_files (application, GTK_WIDGET (view), &file_list, TRUE); - g_object_unref (G_OBJECT (application)); + if (thunar_file_can_be_trashed (file)) + { + /* fake a file list */ + file_list.data = file; + file_list.next = NULL; + file_list.prev = NULL; + + /* delete the file */ + application = thunar_application_get (); + thunar_application_unlink_files (application, GTK_WIDGET (view), &file_list, TRUE); + g_object_unref (G_OBJECT (application)); + } /* release the file */ g_object_unref (G_OBJECT (file)); -- 2.20.1