[gnome-2048/app-menu: 3/3] Move app menu into window



commit b4a740740c1d8c64eda78e6fd120e1426ad0aab3
Author: Jan Tojnar <jtojnar gmail com>
Date:   Thu Oct 4 19:06:05 2018 +0200

    Move app menu into window
    
    GNOME is phasing out the app menu[0], so move its actions into a
    hamburger menu inside the headerbar.
    
    [0] https://wiki.gnome.org/Design/Whiteboards/AppMenuMigration

 data/mainwindow.ui           | 52 ++++++++++++++++++++++++++++++++++++++++++++
 data/menus.ui                | 39 ---------------------------------
 po/POTFILES.in               |  1 -
 src/application.vala         |  4 ++--
 src/gnome-2048.gresource.xml |  3 ---
 5 files changed, 54 insertions(+), 45 deletions(-)
---
diff --git a/data/mainwindow.ui b/data/mainwindow.ui
index 8841cce..f36cf8b 100644
--- a/data/mainwindow.ui
+++ b/data/mainwindow.ui
@@ -47,6 +47,27 @@
             <property name="position">2</property>
           </packing>
         </child>
+        <child>
+          <object class="GtkMenuButton">
+            <property name="visible">True</property>
+            <property name="halign">end</property>
+            <property name="valign">center</property>
+            <property name="menu-model">hamburger-menu</property>
+            <style>
+              <class name="image-button"/>
+            </style>
+            <child>
+              <object class="GtkImage">
+                <property name="visible">True</property>
+                <property name="icon-name">open-menu-symbolic</property>
+                <property name="icon-size">1</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="pack-type">end</property>
+          </packing>
+        </child>
         <child>
           <object class="GtkLabel" id="score">
             <property name="visible">True</property>
@@ -90,4 +111,35 @@
       </object>
     </child>
   </object>
+  <menu id="hamburger-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">Preferences</attribute>
+        <attribute name="action">app.preferences</attribute>
+      </item>
+    </section>
+    <section>
+      <!-- item>
+        <attribute name="label" translatable="yes">Help</attribute>
+        <attribute name="action">app.help</attribute>
+        <attribute name="accel">F1</attribute>
+      </item -->
+      <item>
+        <attribute name="label" translatable="yes">About 2048</attribute>
+        <attribute name="action">app.about</attribute>
+        <attribute name="accel">&lt;Primary&gt;&lt;Shift&gt;F1</attribute>
+      </item>
+    </section>
+  </menu>
 </interface>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 1bc1224..21d5fb0 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -2,7 +2,6 @@
 # Please keep this file in alphabetical order.
 data/congrats.ui
 data/mainwindow.ui
-data/menus.ui
 data/org.gnome.2048.gschema.xml
 data/org.gnome.gnome-2048.appdata.xml.in
 data/org.gnome.gnome-2048.desktop.in
diff --git a/src/application.vala b/src/application.vala
index b365f6f..5bc651c 100644
--- a/src/application.vala
+++ b/src/application.vala
@@ -56,7 +56,7 @@ public class Application : Gtk.Application
     {
         { "undo",           undo_cb           },
 
-        // app-menu
+        // hamburger-menu
         { "new-game",       new_game_cb       },
         { "scores",         scores_cb         },
 
@@ -328,7 +328,7 @@ public class Application : Gtk.Application
     }
 
     /*\
-    * * App-menu (and undo action) callbacks
+    * * Hamburger-menu (and undo action) callbacks
     \*/
 
     private void undo_cb ()
diff --git a/src/gnome-2048.gresource.xml b/src/gnome-2048.gresource.xml
index 4645528..9569158 100644
--- a/src/gnome-2048.gresource.xml
+++ b/src/gnome-2048.gresource.xml
@@ -6,7 +6,4 @@
     <file preprocess="xml-stripblanks">data/congrats.ui</file>
     <!-- file>data/style.css</file -->
   </gresource>
-  <gresource prefix="/org/gnome/gnome-2048/gtk">
-    <file preprocess="xml-stripblanks" alias="menus.ui">data/menus.ui</file>
-  </gresource>
 </gresources>


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