[gnome-boxes/remap-keyboard-shortcuts-window] app-window: Let Gtk load the "Keyboard Shortcuts" window



commit 657321979ef7138f5fe78492e453b871716630c1
Author: Felipe Borges <felipeborges gnome org>
Date:   Mon Jan 20 14:54:26 2020 +0100

    app-window: Let Gtk load the "Keyboard Shortcuts" window
    
    With these changes, the shortcut to bring the "Keyboard Shortcuts"
    is now set in Gtk (as of today, it is Ctrl + ? or Ctrl + F1).
    
    We used to set Ctrl + K, but now this shortcut is deprecated.
    
    The logic for loading the shortcuts is described in
    https://gitlab.gnome.org/GNOME/gtk/blob/master/gtk/gtkapplication.c#L104
    
    Fixes #460

 data/gnome-boxes.gresource.xml  |  2 +-
 data/ui/kbd-shortcuts-window.ui |  6 +++---
 data/ui/menus.ui                |  2 +-
 src/app-window.vala             | 14 --------------
 src/app.vala                    |  7 -------
 5 files changed, 5 insertions(+), 26 deletions(-)
---
diff --git a/data/gnome-boxes.gresource.xml b/data/gnome-boxes.gresource.xml
index 96b5b438..09d478be 100644
--- a/data/gnome-boxes.gresource.xml
+++ b/data/gnome-boxes.gresource.xml
@@ -21,7 +21,7 @@
     <file preprocess="xml-stripblanks">ui/empty-boxes.ui</file>
     <file preprocess="xml-stripblanks">ui/icon-view.ui</file>
     <file preprocess="xml-stripblanks">ui/icon-view-child.ui</file>
-    <file preprocess="xml-stripblanks">ui/kbd-shortcuts-window.ui</file>
+    <file preprocess="xml-stripblanks" alias="gtk/help-overlay.ui">ui/kbd-shortcuts-window.ui</file>
     <file preprocess="xml-stripblanks">ui/list-view.ui</file>
     <file preprocess="xml-stripblanks">ui/list-view-row.ui</file>
     <file preprocess="xml-stripblanks">ui/notification.ui</file>
diff --git a/data/ui/kbd-shortcuts-window.ui b/data/ui/kbd-shortcuts-window.ui
index 14fc8477..7c1d2374 100644
--- a/data/ui/kbd-shortcuts-window.ui
+++ b/data/ui/kbd-shortcuts-window.ui
@@ -2,7 +2,7 @@
 <interface>
   <!-- interface-requires gtk+ 3.17 -->
 
-  <template class="BoxesKbdShortcutsWindow" parent="GtkShortcutsWindow">
+  <object class="GtkShortcutsWindow" id="help_overlay">
     <property name="modal">1</property>
 
     <child>
@@ -45,7 +45,7 @@
             <child>
               <object class="GtkShortcutsShortcut">
                 <property name="visible">1</property>
-                <property name="accelerator">&lt;Ctrl&gt;k</property>
+                <property name="accelerator">&lt;Ctrl&gt;F1</property>
                 <property name="title" translatable="yes" context="shortcut window">Keyboard 
shortcuts</property>
               </object>
             </child>
@@ -162,6 +162,6 @@
 
       </object>
     </child>
-  </template>
+  </object>
 
 </interface>
diff --git a/data/ui/menus.ui b/data/ui/menus.ui
index 0f45704c..ca600dd0 100644
--- a/data/ui/menus.ui
+++ b/data/ui/menus.ui
@@ -3,7 +3,7 @@
 <interface>
   <menu id="app-menu">
     <item>
-      <attribute name="action">win.kbd-shortcuts</attribute>
+      <attribute name="action">win.show-help-overlay</attribute>
       <attribute name="label" translatable="yes">Keyboard Shortcuts</attribute>
     </item>
     <item>
diff --git a/src/app-window.vala b/src/app-window.vala
index c645fa4d..ca226a0f 100644
--- a/src/app-window.vala
+++ b/src/app-window.vala
@@ -172,20 +172,6 @@ public AppWindow (Gtk.Application app) {
 
         views = { icon_view, list_view };
 
-        var action = new GLib.SimpleAction ("kbd-shortcuts", null);
-        action.activate.connect (() => {
-            var window = new Boxes.KbdShortcutsWindow ();
-            if (ui_state == UIState.COLLECTION)
-                window.view_name = "overview";
-            else if (ui_state == UIState.WIZARD || ui_state == UIState.PROPERTIES)
-                window.view_name = "wizard";
-            else if (ui_state == UIState.DISPLAY)
-                window.view_name = "display";
-
-            window.show ();
-        });
-        add_action (action);
-
         if (app.application_id == "org.gnome.BoxesDevel") {
             get_style_context ().add_class ("devel");
         }
diff --git a/src/app.vala b/src/app.vala
index 5fe63c9d..19656de5 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -654,10 +654,3 @@ public new void uninhibit () {
         }
     }
 }
-
-[GtkTemplate (ui = "/org/gnome/Boxes/ui/kbd-shortcuts-window.ui")]
-private class Boxes.KbdShortcutsWindow: Gtk.ShortcutsWindow {
-    construct {
-        set_transient_for (App.app.main_window);
-    }
-}


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