[Xfce4-commits] [xfce/thunar] 01/01: Replace Trash action with Delete as needed (Bug #15352)

noreply at xfce.org noreply at xfce.org
Mon Jul 1 23:13:30 CEST 2019


This is an automated email from the git hooks/post-receive script.

a   l   e   x       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       x   f   c   e   -   4   .   1   4   
   in repository xfce/thunar.

commit 9ad27be6e40cec1372f9ec1eee9b3262fb4c18bb
Author: Evangelos Foutras <evangelos at foutrelis.com>
Date:   Sun Jun 30 14:14:49 2019 +0300

    Replace Trash action with Delete as needed (Bug #15352)
    
    We keep the grayed out "Move to Trash" action in directories which are
    not writable, but otherwise we show the "Delete" action for files that
    cannot be trashed.
    
    Regardless of the "Move to Trash" action's visibility, it should remain
    sensitive for keyboard shortcuts to work (i.e.: pressing the Delete key).
    
    Follow-up fix for https://bugzilla.xfce.org/show_bug.cgi?id=15352.
---
 thunar/thunar-standard-view.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/thunar/thunar-standard-view.c b/thunar/thunar-standard-view.c
index 111d999..06eb6c3 100644
--- a/thunar/thunar-standard-view.c
+++ b/thunar/thunar-standard-view.c
@@ -4442,6 +4442,7 @@ thunar_standard_view_selection_changed (ThunarStandardView *standard_view)
   gboolean    pastable;
   gboolean    writable;
   gboolean    trashed;
+  gboolean    hide_trash_action;
   gboolean    show_delete_action;
   GList      *lp, *selected_files;
   gint        n_selected_files = 0;
@@ -4486,11 +4487,16 @@ thunar_standard_view_selection_changed (ThunarStandardView *standard_view)
   /* and setup the new selected files list */
   standard_view->priv->selected_files = selected_files;
 
-  /* check whether the folder displayed by the view is writable/in the trash/can be trashed */
+  /* check whether the folder displayed by the view is writable/in the trash */
   current_directory = thunar_navigator_get_current_directory (THUNAR_NAVIGATOR (standard_view));
   writable = (current_directory != NULL && thunar_file_is_writable (current_directory));
   trashed = (current_directory != NULL && thunar_file_is_trashed (current_directory));
 
+  /* if moving to trash is not applicable, replace it with the delete action */
+  hide_trash_action = trashed || !trashable || !thunar_g_vfs_is_uri_scheme_supported ("trash");
+  /* but only if the directory is writable -- keep "move to trash" otherwise */
+  hide_trash_action &= writable;
+
   g_object_get (G_OBJECT (standard_view->preferences), "misc-show-delete-action", &show_delete_action, NULL);
 
   /* check whether the clipboard contains data that can be pasted here */
@@ -4535,8 +4541,8 @@ G_GNUC_END_IGNORE_DEPRECATIONS
 
   /* update the "Move to Trash" action */
   g_object_set (G_OBJECT (standard_view->priv->action_move_to_trash),
-                "sensitive", (n_selected_files > 0) && trashable,
-                "visible", !trashed && thunar_g_vfs_is_uri_scheme_supported ("trash"),
+                "sensitive", (n_selected_files > 0) && writable,
+                "visible", !hide_trash_action,
                 "tooltip", ngettext ("Move the selected file to the Trash",
                                      "Move the selected files to the Trash",
                                      n_selected_files),
@@ -4545,7 +4551,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
   /* update the "Delete" action */
   g_object_set (G_OBJECT (standard_view->priv->action_delete),
                 "sensitive", (n_selected_files > 0) && writable,
-                "visible", trashed || !thunar_g_vfs_is_uri_scheme_supported ("trash") || show_delete_action,
+                "visible", hide_trash_action || show_delete_action,
                 "tooltip", ngettext ("Permanently delete the selected file",
                                      "Permanently delete the selected files",
                                      n_selected_files),

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list