[nautilus] files-view: Allow numpad Delete to send items to trash



commit 790c3677884585c17a5ec054133584b1e1f8d8d0
Author: António Fernandes <AntonioJPFernandes gmail com>
Date:   Sun Aug 20 01:19:15 2017 +0100

    files-view: Allow numpad Delete to send items to trash
    
    The Delete key is the keyboard accelerator to send items to Trash (or delete
    permanently when Trash is not available). The numpad Delete key is unused.
    
    So, let the numpad Delete key act as accelerator for the same actions. Also,
    for consistency, allow it to combo with <shift> for deleting permanently.
    
    Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=750491

 src/nautilus-files-view.c |   24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index b5402a8..a79ecf2 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -9481,6 +9481,18 @@ nautilus_files_view_init (NautilusFilesView *view)
         "<control>plus",
         NULL
     };
+      const gchar *move_to_trash_accels[] =
+    {
+        "Delete",
+        "KP_Delete",
+        NULL
+    };
+      const gchar *delete_permanently_accels[] =
+    {
+        "<shift>Delete",
+        "<shift>KP_Delete",
+        NULL
+    };
 
     nautilus_profile_start (NULL);
 
@@ -9670,14 +9682,14 @@ nautilus_files_view_init (NautilusFilesView *view)
     nautilus_application_set_accelerators (app, "view.open-with-default-application", open_accels);
     nautilus_application_set_accelerator (app, "view.open-item-new-tab", "<control>Return");
     nautilus_application_set_accelerator (app, "view.open-item-new-window", "<Shift>Return");
-    nautilus_application_set_accelerator (app, "view.move-to-trash", "Delete");
-    nautilus_application_set_accelerator (app, "view.delete-from-trash", "Delete");
-    nautilus_application_set_accelerator (app, "view.delete-permanently-shortcut", "<shift>Delete");
-    /* When trash is not available, allow the "Delete" key to delete permanently, that is, when
+    nautilus_application_set_accelerators (app, "view.move-to-trash", move_to_trash_accels);
+    nautilus_application_set_accelerators (app, "view.delete-from-trash", move_to_trash_accels);
+    nautilus_application_set_accelerators (app, "view.delete-permanently-shortcut", 
delete_permanently_accels);
+    /* When trash is not available, allow the "Delete" keys to delete permanently, that is, when
      * the menu item is available, since we never make both the trash and delete-permanently-menu-item
      * actions active */
-    nautilus_application_set_accelerator (app, "view.delete-permanently-menu-item", "Delete");
-    nautilus_application_set_accelerator (app, "view.permanent-delete-permanently-menu-item", 
"<shift>Delete");
+    nautilus_application_set_accelerators (app, "view.delete-permanently-menu-item", move_to_trash_accels);
+    nautilus_application_set_accelerators (app, "view.permanent-delete-permanently-menu-item", 
delete_permanently_accels);
     nautilus_application_set_accelerators (app, "view.properties", open_properties);
     nautilus_application_set_accelerator (app, "view.open-item-location", "<control><alt>o");
     nautilus_application_set_accelerator (app, "view.rename", "F2");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]