[lightsoff/appmenu-retirement] Fixed accelerators (#8)



commit 9c2b1fee34a9d8038a523c6cffc2b9fb45380455
Author: Robert Roth <robert roth off gmail com>
Date:   Tue Oct 9 00:15:29 2018 +0300

    Fixed accelerators (#8)

 data/lightsoff-menus.ui |  4 ++--
 src/lightsoff.vala      | 14 ++++++++++++++
 2 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/data/lightsoff-menus.ui b/data/lightsoff-menus.ui
index c7868f3..c6cb65a 100644
--- a/data/lightsoff-menus.ui
+++ b/data/lightsoff-menus.ui
@@ -11,12 +11,12 @@
       <item>
         <attribute name="label" translatable="yes">_Previous puzzle</attribute>
         <attribute name="action">win.previous-level</attribute>
-        <attribute name="accel">&lt;Primary&gt;p</attribute>
+        <attribute name="accel">&lt;Primary&gt;Page_Up</attribute>
       </item>
       <item>
         <attribute name="label" translatable="yes">Ne_xt puzzle</attribute>
         <attribute name="action">win.next-level</attribute>
-        <attribute name="accel">&lt;Primary&gt;x</attribute>
+        <attribute name="accel">&lt;Primary&gt;Page_Down</attribute>
       </item>
     </section>
     <section>
diff --git a/src/lightsoff.vala b/src/lightsoff.vala
index 8f769a3..2391b6b 100644
--- a/src/lightsoff.vala
+++ b/src/lightsoff.vala
@@ -33,6 +33,7 @@ public class LightsOff : Gtk.Application
     private const GLib.ActionEntry[] action_entries =
     {
         { "help",          help_cb     },
+        { "quit",          quit_cb     },
         { "about",         about_cb    }
     };
 
@@ -50,6 +51,13 @@ public class LightsOff : Gtk.Application
 
         add_action_entries (action_entries, this);
 
+        set_accels_for_action ("app.quit", {"<control>Q"});
+        set_accels_for_action ("app.help", {"F1"});
+
+        set_accels_for_action ("win.new-game", {"<control>N"});
+        set_accels_for_action ("win.previous-level", {"<control>Page_Up"});
+        set_accels_for_action ("win.next-level", {"<control>Page_Down"});
+
         window = new LightsoffWindow (gtk);
         add_window (window);
     }
@@ -71,6 +79,12 @@ public class LightsOff : Gtk.Application
         }
     }
 
+    private void quit_cb ()
+    {
+        window.destroy ();
+    }
+
+
     private void about_cb ()
     {
         string[] authors =


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