[gnome-builder] libide/gui: setup action for keyboard shortcuts



commit 7282760e93eca2b0a4a3f098384de7164dce7fe5
Author: Christian Hergert <chergert redhat com>
Date:   Thu Jul 28 16:18:49 2022 -0700

    libide/gui: setup action for keyboard shortcuts
    
    Still needs an implementation, but this gets the plumbing in place.

 src/libide/greeter/gtk/menus.ui          |  2 +-
 src/libide/gui/gtk/menus.ui              |  2 +-
 src/libide/gui/ide-preferences-window.ui | 16 +-----------
 src/libide/gui/ide-workspace-actions.c   | 42 --------------------------------
 src/libide/gui/ide-workspace.c           | 12 +++++++++
 5 files changed, 15 insertions(+), 59 deletions(-)
---
diff --git a/src/libide/greeter/gtk/menus.ui b/src/libide/greeter/gtk/menus.ui
index 50c6d548f..8bfb5b274 100644
--- a/src/libide/greeter/gtk/menus.ui
+++ b/src/libide/greeter/gtk/menus.ui
@@ -31,7 +31,7 @@
       <item>
         <attribute name="id">ide-greeter-workspace-menu-shortcuts</attribute>
         <attribute name="label" translatable="yes">Keyboard Shortcuts</attribute>
-        <attribute name="action">win.show-help-overlay</attribute>
+        <attribute name="action">workspace.show-help-overlay</attribute>
         <attribute name="accel">&lt;primary&gt;question</attribute>
       </item>
       <item>
diff --git a/src/libide/gui/gtk/menus.ui b/src/libide/gui/gtk/menus.ui
index f82f415de..a2faf0c12 100644
--- a/src/libide/gui/gtk/menus.ui
+++ b/src/libide/gui/gtk/menus.ui
@@ -31,7 +31,7 @@
         <attribute name="id">ide-primary-workspace-menu-shortcuts</attribute>
         <attribute name="label" translatable="yes">Keyboard Shortcuts</attribute>
         <attribute name="description" translatable="yes">Find keyboard shortcuts</attribute>
-        <attribute name="action">win.show-help-overlay</attribute>
+        <attribute name="action">workspace.show-help-overlay</attribute>
         <attribute name="accel">&lt;primary&gt;question</attribute>
         <attribute name="verb-icon">preferences-desktop-keyboard-shortcuts-symbolic</attribute>
       </item>
diff --git a/src/libide/gui/ide-preferences-window.ui b/src/libide/gui/ide-preferences-window.ui
index 15419075f..394267fc2 100644
--- a/src/libide/gui/ide-preferences-window.ui
+++ b/src/libide/gui/ide-preferences-window.ui
@@ -33,7 +33,7 @@
                 <child type="end">
                   <object class="GtkMenuButton" id="primary_button">
                     <property name="icon-name">open-menu-symbolic</property>
-                    <property name="menu-model">primary_menu</property>
+                    <property name="visible">false</property>
                   </object>
                 </child>
               </object>
@@ -81,18 +81,4 @@
       </object>
     </child>
   </template>
-  <menu id="primary_menu">
-    <section>
-      <item>
-        <attribute name="label" translatable="yes">Keyboard Shortcuts</attribute>
-        <attribute name="action">win.show-help-overlay</attribute>
-        <attribute name="accel">&lt;ctrl&gt;question</attribute>
-      </item>
-      <item>
-        <attribute name="label" translatable="yes">Help</attribute>
-        <attribute name="action">app.help</attribute>
-        <attribute name="accel">F1</attribute>
-      </item>
-    </section>
-  </menu>
 </interface>
diff --git a/src/libide/gui/ide-workspace.c b/src/libide/gui/ide-workspace.c
index 311716328..4ed470978 100644
--- a/src/libide/gui/ide-workspace.c
+++ b/src/libide/gui/ide-workspace.c
@@ -505,6 +505,17 @@ ide_workspace_action_close (gpointer    instance,
   gtk_window_close (GTK_WINDOW (self));
 }
 
+static void
+ide_workspace_action_help_overlay (gpointer    instance,
+                                   const char *action_name,
+                                   GVariant   *param)
+{
+  IdeWorkspace *self = instance;
+
+  g_assert (IDE_IS_WORKSPACE (self));
+
+}
+
 static void
 ide_workspace_constructed (GObject *object)
 {
@@ -632,6 +643,7 @@ ide_workspace_class_init (IdeWorkspaceClass *klass)
 
   ide_action_mixin_init (&klass->action_mixin, object_class);
   ide_action_mixin_install_action (&klass->action_mixin, "close", NULL, ide_workspace_action_close);
+  ide_action_mixin_install_action (&klass->action_mixin, "show-help-overlay", NULL, 
ide_workspace_action_help_overlay);
 }
 
 static void


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