[gnome-boxes] Add keyboard shortcuts help window



commit 45dd8f32276099430663882ef925c9a37143d9f9
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Mon Dec 7 18:03:37 2015 +0000

    Add keyboard shortcuts help window
    
    Using the new Gtk+ API, let's provide a keyboard shortcuts help window.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=757835

 data/gnome-boxes.gresource.xml  |    1 +
 data/ui/kbd-shortcuts-window.ui |  164 +++++++++++++++++++++++++++++++++++++++
 src/app.vala                    |   12 +++
 3 files changed, 177 insertions(+), 0 deletions(-)
---
diff --git a/data/gnome-boxes.gresource.xml b/data/gnome-boxes.gresource.xml
index c935191..d4c71bc 100644
--- a/data/gnome-boxes.gresource.xml
+++ b/data/gnome-boxes.gresource.xml
@@ -14,6 +14,7 @@
     <file preprocess="xml-stripblanks">ui/empty-boxes.ui</file>
     <file preprocess="xml-stripblanks">ui/editable-entry.ui</file>
     <file preprocess="xml-stripblanks">ui/resource-graph.ui</file>
+    <file preprocess="xml-stripblanks">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
new file mode 100644
index 0000000..73f455c
--- /dev/null
+++ b/data/ui/kbd-shortcuts-window.ui
@@ -0,0 +1,164 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.17 -->
+
+  <template class="BoxesKbdShortcutsWindow" parent="GtkShortcutsWindow">
+    <property name="modal">1</property>
+
+    <child>
+      <object class="GtkShortcutsSection">
+        <property name="visible">1</property>
+        <property name="section-name">shortcuts</property>
+        <property name="max-height">12</property>
+
+        <!-- Overview shortcuts -->
+        <child>
+          <object class="GtkShortcutsGroup">
+            <property name="visible">1</property>
+            <property name="title" translatable="yes">Overview</property>
+
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator">F1</property>
+                <property name="title" translatable="yes">Help</property>
+              </object>
+            </child>
+
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator">&lt;Ctrl&gt;n &lt;Alt&gt;n</property>
+                <property name="title" translatable="yes">Create a new box</property>
+              </object>
+            </child>
+
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator">&lt;Ctrl&gt;f</property>
+                <property name="title" translatable="yes">Search</property>
+              </object>
+            </child>
+
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator">&lt;Ctrl&gt;q &lt;Alt&gt;a</property>
+                <property name="title" translatable="yes">Close Window/Quit Boxes</property>
+              </object>
+            </child>
+          </object>
+        </child>
+
+        <!-- Wizard and Properties shortcuts -->
+        <child>
+          <object class="GtkShortcutsGroup">
+            <property name="visible">1</property>
+            <property name="title" translatable="yes">Box Creation and Properties</property>
+
+            <!-- LTR -->
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="direction">ltr</property>
+                <property name="accelerator">&lt;Alt&gt;Right</property>
+                <property name="title" translatable="yes">Switch to the next page</property>
+              </object>
+            </child>
+
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="direction">ltr</property>
+                <property name="accelerator">&lt;Alt&gt;Left</property>
+                <property name="title" translatable="yes">Switch to the previous page</property>
+              </object>
+            </child>
+
+            <!-- RTL -->
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="direction">rtl</property>
+                <property name="accelerator">&lt;Alt&gt;Left</property>
+                <property name="title" translatable="yes">Switch to the next page</property>
+              </object>
+            </child>
+
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="direction">rtl</property>
+                <property name="accelerator">&lt;Alt&gt;Right</property>
+                <property name="title" translatable="yes">Switch to the previous page</property>
+              </object>
+            </child>
+
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator">Escape</property>
+                <property name="title" translatable="yes">Close window</property>
+              </object>
+            </child>
+          </object>
+        </child>
+
+        <!-- Display shortcuts -->
+        <child>
+          <object class="GtkShortcutsGroup">
+            <property name="visible">1</property>
+            <property name="title" translatable="yes">Box Display</property>
+
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator">Control_L+Alt_L</property>
+                <property name="title" translatable="yes">Grab/Ungrab keyboard</property>
+              </object>
+            </child>
+
+            <!-- LTR -->
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="direction">ltr</property>
+                <property name="accelerator">&lt;Alt&gt;Left</property>
+                <property name="title" translatable="yes">Back to overview</property>
+              </object>
+            </child>
+
+            <!-- RTL -->
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="direction">rtl</property>
+                <property name="accelerator">&lt;Alt&gt;Right</property>
+                <property name="title" translatable="yes">Back to overview</property>
+              </object>
+            </child>
+
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator">&lt;Ctrl&gt;q &lt;Alt&gt;a</property>
+                <property name="title" translatable="yes">Close window/Quit Boxes</property>
+              </object>
+            </child>
+
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator">F11</property>
+                <property name="title" translatable="yes">Fullscreen/Restore from fullscreen</property>
+              </object>
+            </child>
+          </object>
+        </child>
+
+      </object>
+    </child>
+  </template>
+
+</interface>
diff --git a/src/app.vala b/src/app.vala
index 51e66ca..9be0d31 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -80,6 +80,14 @@ private class Boxes.App: Gtk.Application {
         action.activate.connect ((param) => { open_name (param.get_string ()); });
         add_action (action);
 
+        action = new GLib.SimpleAction ("kbd_shortcuts", null);
+        action.activate.connect (() => {
+            var window = new Boxes.KbdShortcutsWindow ();
+
+            window.show ();
+        });
+        add_action (action);
+
         action = new GLib.SimpleAction ("about", null);
         action.activate.connect (() => {
             string[] authors = {
@@ -119,6 +127,7 @@ private class Boxes.App: Gtk.Application {
 
         var menu = new GLib.Menu ();
         menu.append (_("Help"), "app.help");
+        menu.append (_("Keyboard shortcuts"), "app.kbd_shortcuts");
         menu.append (_("About"), "app.about");
         menu.append (_("Quit"), "app.quit");
 
@@ -594,3 +603,6 @@ private class Boxes.App: Gtk.Application {
         return initial_windows_count != windows.length ();
     }
 }
+
+[GtkTemplate (ui = "/org/gnome/Boxes/ui/kbd-shortcuts-window.ui")]
+private class Boxes.KbdShortcutsWindow: Gtk.ShortcutsWindow {}


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