[five-or-more] Moved new game action to menu



commit 2ce437c9d030b237682551a82fe7494f7067d087
Author: Robert Roth <robert roth off gmail com>
Date:   Thu Oct 18 00:56:06 2018 +0300

    Moved new game action to menu

 data/five-or-more.ui | 47 +++++++++++++++--------------------------------
 src/main.vala        |  2 ++
 src/window.vala      |  4 ----
 3 files changed, 17 insertions(+), 36 deletions(-)
---
diff --git a/data/five-or-more.ui b/data/five-or-more.ui
index b8921da..4d650a7 100644
--- a/data/five-or-more.ui
+++ b/data/five-or-more.ui
@@ -2,6 +2,18 @@
 <interface>
   <!-- interface-requires gtk+ 3.10 -->
   <menu id="primary-menu">
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">New Game</attribute>
+        <attribute name="action">app.new-game</attribute>
+        <attribute name="accel">&lt;Primary&gt;n</attribute>
+      </item>
+
+      <item>
+        <attribute name="label" translatable="yes">Scores</attribute>
+        <attribute name="action">app.scores</attribute>
+      </item>
+    </section>
     <section>
       <item>
         <attribute name="label" translatable="yes">_Small</attribute>
@@ -19,12 +31,6 @@
         <attribute name="target">BOARD_SIZE_LARGE</attribute>
       </item>
     </section>
-    <section>
-      <item>
-        <attribute name="label" translatable="yes">Scores</attribute>
-        <attribute name="action">app.scores</attribute>
-      </item>
-    </section>
     <section>
       <item>
         <attribute name="label" translatable="yes">Preferences</attribute>
@@ -66,8 +72,8 @@
             <child>
               <object class="GtkLabel" id="labelNext">
                 <property name="visible">True</property>
+                <property name="ellipsize">PANGO_ELLIPSIZE_END</property>
                 <property name="can_focus">False</property>
-                <property name="margin_end">6</property>
                 <property name="label" translatable="yes">Next:</property>
                 <attributes>
                   <attribute name="weight" value="bold"/>
@@ -99,35 +105,12 @@
       </object>
     </child>
     <child>
-      <object class="GtkBox" id="hbox">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="orientation">horizontal</property>
-        <property name="spacing">12</property>
-        <child>
           <object class="GamesGridFrame" id="grid_frame">
             <property name="visible">True</property>
           </object>
-          <object class="GtkButton" id="new_game_button">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="use_underline">True</property>
-            <property name="label" translatable="yes">_New Game</property>
-            <property name="halign">center</property>
-            <property name="valign">end</property>
-            <property name="action-name">app.new-game</property>
-            <property name="tooltip-text" translatable="yes">Start a new puzzle</property>
-            <property name="width-request">120</property>
-            <property name="height-request">60</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">False</property>
-            <property name="pack_type">end</property>
-          </packing>
-        </child>
-      </object>
     </child>
   </template>
 </interface>
 
+
+
diff --git a/src/main.vala b/src/main.vala
index ae914eb..21f94b7 100644
--- a/src/main.vala
+++ b/src/main.vala
@@ -62,6 +62,8 @@ public class FiveOrMoreApp: Gtk.Application
 
         add_action_entries (action_entries, this);
         set_accels_for_action ("app.new-game", {"<Primary>n"});
+        set_accels_for_action ("app.quit", {"<Primary>q"});
+        set_accels_for_action ("app.help", {"F1"});
         var board_size_action = lookup_action("change-size");
         BoardSize size = (BoardSize)settings.get_int (FiveOrMoreApp.KEY_SIZE);
         (board_size_action as SimpleAction).set_state (new Variant.string(size.to_string()));
diff --git a/src/window.vala b/src/window.vala
index 83dfe7c..84afe24 100644
--- a/src/window.vala
+++ b/src/window.vala
@@ -30,9 +30,6 @@ public class GameWindow : Gtk.ApplicationWindow
     [GtkChild]
     private Gtk.Box preview_hbox;
 
-    [GtkChild]
-    private Gtk.Box hbox;
-
     [GtkChild]
     private Gtk.MenuButton primary_menu_button;
 
@@ -78,7 +75,6 @@ public class GameWindow : Gtk.ApplicationWindow
         game.notify["score"].connect ((s, p) => { set_status_message 
(status[StatusMessage.NONE].printf(game.score)); });
         game.notify["status-message"].connect ((s, p) => { set_status_message 
(status[game.status_message].printf(game.score)); });
         set_status_message (status[game.status_message]);
-        hbox.pack_start (grid_frame);
 
         View game_view = new View (settings, game, theme);
         grid_frame.add (game_view);


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