[gnome-disk-utility] shortcuts: Add keyboard shortcut for the application menu



commit 1ccfb110c4f7244b762e6e2954c6d222658abf03
Author: Manuel Wassermann <manuel wassermann97 gmail com>
Date:   Tue Jul 13 15:54:15 2021 +0200

    shortcuts: Add keyboard shortcut for the application menu

 src/disks/gduapplication.c |  1 +
 src/disks/gduwindow.c      | 15 +++++++++++++++
 src/disks/ui/disks.ui      |  1 +
 src/disks/ui/shortcuts.ui  | 37 +++++++++++++++++++++++++------------
 4 files changed, 42 insertions(+), 12 deletions(-)
---
diff --git a/src/disks/gduapplication.c b/src/disks/gduapplication.c
index 6d091780..152ca2c7 100644
--- a/src/disks/gduapplication.c
+++ b/src/disks/gduapplication.c
@@ -398,6 +398,7 @@ gdu_application_startup (GApplication *_app)
     "win.go-back",               "Escape", NULL,
     "win.open-drive-menu",       "F10", NULL,
     "win.open-volume-menu",      "<Shift>F10", NULL,
+    "win.open-app-menu",         "F9", NULL,
 
     "win.format-disk",           "<Primary>D", NULL,
     "win.restore-disk-image",    "<Primary>R", NULL,
diff --git a/src/disks/gduwindow.c b/src/disks/gduwindow.c
index 239bd5a6..ca75470e 100644
--- a/src/disks/gduwindow.c
+++ b/src/disks/gduwindow.c
@@ -264,6 +264,7 @@ static void on_devtab_drive_power_off_button_clicked (GtkButton *button, gpointe
 static void on_go_back (GSimpleAction *action, GVariant *parameter, gpointer user_data);
 static void on_drive_menu_open (GSimpleAction *action, GVariant *parameter, gpointer user_data);
 static void on_volume_menu_open (GSimpleAction *action, GVariant *parameter, gpointer user_data);
+static void on_app_menu_open (GSimpleAction *action, GVariant *parameter, gpointer user_data);
 
 static void on_drive_menu_item_view_smart (GSimpleAction *action,
                                            GVariant      *parameter,
@@ -357,6 +358,7 @@ static const GActionEntry actions[] = {
        { "go-back", on_go_back },
        { "open-drive-menu", on_drive_menu_open },
        { "open-volume-menu", on_volume_menu_open },
+       { "open-app-menu", on_app_menu_open },
 
        { "format-disk", on_drive_menu_item_format_disk },
        { "create-disk-image", on_drive_menu_item_create_disk_image },
@@ -3258,6 +3260,19 @@ on_drive_menu_open (GSimpleAction *action,
 
 /* ---------------------------------------------------------------------------------------------------- */
 
+static void
+on_app_menu_open (GSimpleAction *action,
+                    GVariant      *parameter,
+                    gpointer       user_data)
+{
+  GduWindow *window = GDU_WINDOW (user_data);
+
+  update_all (window, FALSE);
+  gtk_popover_popup (GTK_POPOVER (window->app_menu));
+}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
 static void
 on_go_back (GSimpleAction *action,
             GVariant      *parameter,
diff --git a/src/disks/ui/disks.ui b/src/disks/ui/disks.ui
index 005fbcaf..bed0a2f7 100644
--- a/src/disks/ui/disks.ui
+++ b/src/disks/ui/disks.ui
@@ -31,6 +31,7 @@
                       <object class="GtkMenuButton" id="app-menu-button">
                         <property name="visible">True</property>
                         <property name="direction">none</property>
+                        <property name="tooltip-text" translatable="yes">Application Menu</property>
                       </object>
                       <packing>
                         <property name="pack-type">end</property>
diff --git a/src/disks/ui/shortcuts.ui b/src/disks/ui/shortcuts.ui
index a38a0f04..60146377 100644
--- a/src/disks/ui/shortcuts.ui
+++ b/src/disks/ui/shortcuts.ui
@@ -14,43 +14,56 @@
             <child>
               <object class="GtkShortcutsShortcut">
                 <property name="visible">True</property>
-                <property name="title" translatable="yes" context="shortcut window">Create a new empty disk 
image</property>
-                <property name="accelerator">&lt;Primary&gt;n</property>
+                <property name="title" translatable="yes" context="shortcut window">Help</property>
+                <property name="accelerator">F1</property>
               </object>
             </child>
             <child>
               <object class="GtkShortcutsShortcut">
                 <property name="visible">True</property>
-                <property name="title" translatable="yes" context="shortcut window">Attach an existing disk 
image</property>
-                <property name="accelerator">&lt;Primary&gt;a</property>
+                <property name="title" translatable="yes" context="shortcut window">Open the application 
menu</property>
+                <property name="accelerator">F9</property>
               </object>
             </child>
             <child>
               <object class="GtkShortcutsShortcut">
                 <property name="visible">True</property>
-                <property name="title" translatable="yes" context="shortcut window">Unselect current 
disk</property>
-                <property name="accelerator">Escape</property>
+                <property name="title" translatable="yes" context="shortcut window">Keyboard 
shortcuts</property>
+                <property name="accelerator">&lt;Primary&gt;question</property>
               </object>
             </child>
             <child>
               <object class="GtkShortcutsShortcut">
                 <property name="visible">True</property>
-                <property name="title" translatable="yes" context="shortcut window">Help</property>
-                <property name="accelerator">F1</property>
+                <property name="title" translatable="yes" context="shortcut window">Quit</property>
+                <property name="accelerator">&lt;Primary&gt;q</property>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="GtkShortcutsGroup">
+            <property name="visible">True</property>
+            <property name="title" translatable="yes" context="shortcut window">Disks</property>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">True</property>
+                <property name="title" translatable="yes" context="shortcut window">Create a new empty disk 
image</property>
+                <property name="accelerator">&lt;Primary&gt;n</property>
               </object>
             </child>
             <child>
               <object class="GtkShortcutsShortcut">
                 <property name="visible">True</property>
-                <property name="title" translatable="yes" context="shortcut window">Keyboard 
shortcuts</property>
-                <property name="accelerator">&lt;Primary&gt;question</property>
+                <property name="title" translatable="yes" context="shortcut window">Attach an existing disk 
image</property>
+                <property name="accelerator">&lt;Primary&gt;a</property>
               </object>
             </child>
             <child>
               <object class="GtkShortcutsShortcut">
                 <property name="visible">True</property>
-                <property name="title" translatable="yes" context="shortcut window">Quit</property>
-                <property name="accelerator">&lt;Primary&gt;q</property>
+                <property name="title" translatable="yes" context="shortcut window">Unselect current 
disk</property>
+                <property name="accelerator">Escape</property>
               </object>
             </child>
           </object>


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