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



commit eb6f8c06eb47fdf57b39c5f3fe890954647e5bde
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://gitlab.gnome.org/GNOME/Initiatives/wikis/App-Menu-Retirement

 data/mainwindow.ui           | 50 ++++++++++++++++++++++++++++++++++++++++++++
 data/menus.ui                | 39 ----------------------------------
 po/POTFILES.in               |  1 -
 src/application.vala         |  4 ++--
 src/gnome-2048.gresource.xml |  3 ---
 5 files changed, 52 insertions(+), 45 deletions(-)
---
diff --git a/data/mainwindow.ui b/data/mainwindow.ui
index a0cb087..e3afd5a 100644
--- a/data/mainwindow.ui
+++ b/data/mainwindow.ui
@@ -51,6 +51,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>
@@ -94,4 +115,33 @@
       </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>
+      <!-- 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]