[nautilus] files-view: Open background menu with keyboard if nothing selected



commit a7b68b3fd89e06040796bf48fa2e8a3b4912cff7
Author: Ignacy Kuchciński <ignacykuchcinski gmail com>
Date:   Thu Feb 24 16:42:58 2022 +0100

    files-view: Open background menu with keyboard if nothing selected
    
    Allow opening background context menu with Menu key or Shift+F10
    keyboard shortcut if nothing is selected.

 src/nautilus-files-view.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 9c39797dc..402e069c3 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -1686,6 +1686,13 @@ action_popup_menu (GSimpleAction *action,
                    gpointer       user_data)
 {
     NautilusFilesView *view = NAUTILUS_FILES_VIEW (user_data);
+    g_autolist (NautilusFile) selection = nautilus_files_view_get_selection (NAUTILUS_VIEW (view));
+
+    if (selection == NULL)
+    {
+        nautilus_files_view_pop_up_background_context_menu (view, 0, 0);
+        return;
+    }
 
     nautilus_files_view_pop_up_selection_context_menu (view, -1, -1);
 }
@@ -7675,9 +7682,6 @@ real_update_actions_state (NautilusFilesView *view)
     action = g_action_map_lookup_action (G_ACTION_MAP (view_action_group),
                                          "preview-selection");
     g_simple_action_set_enabled (G_SIMPLE_ACTION (action), selection_count != 0);
-    action = g_action_map_lookup_action (G_ACTION_MAP (view_action_group),
-                                         "popup-menu");
-    g_simple_action_set_enabled (G_SIMPLE_ACTION (action), selection_count != 0);
 
     /* Drive menu */
     show_mount = (selection != NULL);


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