[ghex/gtk4-port: 79/91] Add shortcuts to GtkShortcutWindow.




commit cff9adffe3e8f82b2ab90e1d9181452cb113fd73
Author: Logan Rathbone <poprocks gmail com>
Date:   Wed Feb 24 00:59:34 2021 -0500

    Add shortcuts to GtkShortcutWindow.
    
    This shows how many more shortcuts are needed!

 src/ghex-application-window.c |  16 +++++++
 src/help-overlay.ui           | 100 +++++++++++++++++++++++++++++++++++++++---
 2 files changed, 111 insertions(+), 5 deletions(-)
---
diff --git a/src/ghex-application-window.c b/src/ghex-application-window.c
index 621edcbe..b8acec26 100644
--- a/src/ghex-application-window.c
+++ b/src/ghex-application-window.c
@@ -1776,6 +1776,15 @@ ghex_application_window_class_init(GHexApplicationWindowClass *klass)
 
        /* SHORTCUTS */
 
+       /* ensure these are synced with help-overlay.ui */
+
+       /* F1 - show about dialog */
+       gtk_widget_class_add_binding_action (widget_class,
+                       GDK_KEY_F1,
+                       0,
+                       "ghex.about",
+                       NULL);  /* no args. */
+
        /* Ctrl+F - find */
        gtk_widget_class_add_binding_action (widget_class,
                        GDK_KEY_f,
@@ -1811,6 +1820,13 @@ ghex_application_window_class_init(GHexApplicationWindowClass *klass)
                        "ghex.copy-special",
                        NULL);
 
+       /* Ctrl+P - print */
+       gtk_widget_class_add_binding_action (widget_class,
+                       GDK_KEY_p,
+                       GDK_CONTROL_MASK,
+                       "ghex.print",
+                       NULL);
+
        /* Ctrl+W - close tab */
        gtk_widget_class_add_binding (widget_class,
                        GDK_KEY_w,
diff --git a/src/help-overlay.ui b/src/help-overlay.ui
index 22988af6..0d66b682 100644
--- a/src/help-overlay.ui
+++ b/src/help-overlay.ui
@@ -1,29 +1,119 @@
 <!-- vim: ts=2 sw=2
 -->
+
+<!-- ensure these are synced with ghex-application-window.c -->
+
 <interface>
        <object class="GtkShortcutsWindow" id="help_overlay">
                <child>
                        <object class="GtkShortcutsSection">
+                               <property name="max-height">12</property>
+
                                <child>
                                        <object class="GtkShortcutsGroup">
-                                               <property name="title">General</property>
+                                               <property name="title" translatable="true">Find and 
Replace</property>
+                                               
+                                               <child>
+                                                       <object class="GtkShortcutsShortcut">
+                                                               <property 
name="accelerator">&lt;Control&gt;f</property>
+                                                               <property name="title" 
translatable="true">Find</property>
+                                                       </object>
+                                               </child>
+
+                                               <child>
+                                                       <object class="GtkShortcutsShortcut">
+                                                               <property 
name="accelerator">&lt;Control&gt;h</property>
+                                                               <property name="title" 
translatable="true">Find and replace</property>
+                                                       </object>
+                                               </child>
+
+                                               <child>
+                                                       <object class="GtkShortcutsShortcut">
+                                                               <property 
name="accelerator">&lt;Control&gt;j</property>
+                                                               <property name="title" 
translatable="true">Jump to byte</property>
+                                                       </object>
+                                               </child>
+
+                                       </object>
+                               </child> <!-- /Find and Replace -->
+
+                               <child>
+                                       <object class="GtkShortcutsGroup">
+                                               <property name="title" 
translatable="true">Clipboard</property>
+
+                                               <child>
+                                                       <object class="GtkShortcutsShortcut">
+                                                               <property 
name="accelerator">&lt;Control&gt;&lt;Shift&gt;c</property>
+                                                               <property name="title" 
translatable="true">Copy special</property>
+                                                       </object>
+                                               </child>
+
+                                               <child>
+                                                       <object class="GtkShortcutsShortcut">
+                                                               <property 
name="accelerator">&lt;Control&gt;&lt;Shift&gt;v</property>
+                                                               <property name="title" 
translatable="true">Paste special</property>
+                                                       </object>
+                                               </child>
+
+                                       </object>
+                               </child> <!-- /Data Operations -->
+
+                               <child>
+                                       <object class="GtkShortcutsGroup">
+                                               <property name="title" translatable="true">Files</property>
+
+                                               <child>
+                                                       <object class="GtkShortcutsShortcut">
+                                                               <property 
name="accelerator">&lt;Control&gt;w</property>
+                                                               <property name="title" 
translatable="true">Close tab</property>
+                                                       </object>
+                                               </child>
+
+                                               <child>
+                                                       <object class="GtkShortcutsShortcut">
+                                                               <property 
name="accelerator">&lt;Control&gt;s</property>
+                                                               <property name="title" 
translatable="true">Save file</property>
+                                                       </object>
+                                               </child>
+
+                                               <child>
+                                                       <object class="GtkShortcutsShortcut">
+                                                               <property 
name="accelerator">&lt;Control&gt;Page_Down</property>
+                                                               <property name="title" 
translatable="true">Switch to next tab</property>
+                                                       </object>
+                                               </child>
+
+                                               <child>
+                                                       <object class="GtkShortcutsShortcut">
+                                                               <property 
name="accelerator">&lt;Control&gt;Page_Up</property>
+                                                               <property name="title" 
translatable="true">Switch to previous tab</property>
+                                                       </object>
+                                               </child>
+
+                                       </object>
+                               </child> <!-- /Files -->
+
+                               <child>
+                                       <object class="GtkShortcutsGroup">
+                                               <property name="title" translatable="true">General</property>
 
                                                <child>
                                                        <object class="GtkShortcutsShortcut">
                                                                <property name="accelerator">F1</property>
-                                                               <property name="title">Show About 
Dialog</property>
+                                                               <property name="title" 
translatable="true">Show About dialog</property>
                                                        </object>
                                                </child>
 
                                                <child>
                                                        <object class="GtkShortcutsShortcut">
-                                                               <property 
name="accelerator">&lt;Control&gt;f</property>
-                                                               <property name="title">Find</property>
+                                                               <property 
name="accelerator">&lt;Control&gt;p</property>
+                                                               <property name="title" 
translatable="true">Print the hex file</property>
                                                        </object>
                                                </child>
 
                                        </object>
-                               </child>
+                               </child> <!-- /General -->
+
                        </object>
                </child>
        </object>


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