[gnote] Add shortcut for shortcuts window



commit d64f691adf6f58143a046f25010a0b12d1c6fb1e
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sun May 8 21:53:31 2022 +0300

    Add shortcut for shortcuts window
    
    Fixes https://gitlab.gnome.org/GNOME/gnote/-/issues/123

 data/shortcuts-gnote.ui | 7 +++++++
 src/recentchanges.cpp   | 7 +++++++
 2 files changed, 14 insertions(+)
---
diff --git a/data/shortcuts-gnote.ui b/data/shortcuts-gnote.ui
index 1546debf..47248cce 100644
--- a/data/shortcuts-gnote.ui
+++ b/data/shortcuts-gnote.ui
@@ -18,6 +18,13 @@
                 <property name="title" translatable="yes" context="shortcut window">Show help</property>
               </object>
             </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator">&lt;Ctrl&gt;question</property>
+                <property name="title" translatable="yes" context="shortcut window">Shortcuts</property>
+              </object>
+            </child>
             <child>
               <object class="GtkShortcutsShortcut">
                 <property name="visible">1</property>
diff --git a/src/recentchanges.cpp b/src/recentchanges.cpp
index ac7264cb..e642cb1b 100644
--- a/src/recentchanges.cpp
+++ b/src/recentchanges.cpp
@@ -158,6 +158,13 @@ namespace gnote {
                                 GDK_KEY_Page_Down, Gdk::CONTROL_MASK, (Gtk::AccelFlags)0);
     m_keybinder.add_accelerator(sigc::mem_fun(*this, &NoteRecentChanges::previous_tab),
                                 GDK_KEY_Page_Up, Gdk::CONTROL_MASK, (Gtk::AccelFlags)0);
+    {
+      auto show_shortcuts = m_gnote.action_manager().get_app_action("help-shortcuts");
+      if(show_shortcuts) {
+        m_keybinder.add_accelerator([show_shortcuts=std::move(show_shortcuts)]{ show_shortcuts->activate(); 
},
+                                    GDK_KEY_question, Gdk::CONTROL_MASK, (Gtk::AccelFlags)0);
+      }
+    }
   }
 
 


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