From 2747ec9933884569d7c69ec02cb9dca69017f4ff Mon Sep 17 00:00:00 2001 From: Theo Linkspfeifer Date: Mon, 22 Apr 2019 21:50:22 +0200 Subject: [PATCH 1/1] Add additional check for DEL key in tree view (Bug #15095) --- thunar/thunar-tree-view.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/thunar/thunar-tree-view.c b/thunar/thunar-tree-view.c index ed3410f6..19c6b1b0 100644 --- a/thunar/thunar-tree-view.c +++ b/thunar/thunar-tree-view.c @@ -1230,6 +1230,7 @@ thunar_tree_view_row_collapsed (GtkTreeView *tree_view, static gboolean thunar_tree_view_delete_selected_files (ThunarTreeView *view) { + ThunarFile *file; GtkAccelKey key; _thunar_return_val_if_fail (THUNAR_IS_TREE_VIEW (view), FALSE); @@ -1241,8 +1242,17 @@ thunar_tree_view_delete_selected_files (ThunarTreeView *view) && (key.accel_key != 0 || key.accel_mods != 0)) return FALSE; - /* ask the user whether to delete the folder... */ - thunar_tree_view_action_move_to_trash (view); + /* determine the selected file */ + file = thunar_tree_view_get_selected_file (view); + + if (thunar_file_can_be_trashed (file)) + { + /* ask the user whether to delete the folder... */ + thunar_tree_view_action_move_to_trash (view); + } + + /* release the file */ + g_object_unref (G_OBJECT (file)); /* ...and we're done */ return TRUE; -- 2.20.1