[hitori] Retire app menu



commit 5f5a86ee4b80c857564c34836d810b9075915eaa
Author: Jonathan Kang <jonathankang gnome org>
Date:   Tue Nov 6 21:52:51 2018 +0800

    Retire app menu
    
    Application menus have been a source of usability issues since they
    were introduced, despite attempts to improve them. We are therefore
    aiming to end their use by 3.32.0.
    
    https://wiki.gnome.org/Initiatives/GnomeGoals/AppMenuRetirement
    https://gitlab.gnome.org/GNOME/Initiatives/issues/4
    https://gitlab.gnome.org/GNOME/hitori/issues/9

 Makefile.am              |  1 -
 data/hitori-menus.ui     | 64 ----------------------------------------
 data/hitori.ui           | 77 ++++++++++++++++++++++++++++++++++++++++++++++++
 po/POTFILES.in           |  1 -
 src/hitori.gresource.xml |  3 --
 src/interface.c          | 11 +------
 6 files changed, 78 insertions(+), 79 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 5e5a189..8b26641 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -85,7 +85,6 @@ EXTRA_DIST += src/hitori.gresource.xml
 
 # UI & CSS files
 ui_data = \
-       data/hitori-menus.ui \
        data/hitori.ui \
        $(NULL)
 dist_noinst_DATA = \
diff --git a/data/hitori.ui b/data/hitori.ui
index 64ae01d..c53515a 100644
--- a/data/hitori.ui
+++ b/data/hitori.ui
@@ -2,6 +2,61 @@
 <!--*- mode: xml -*-->
 <interface>
        <requires lib="gtk+" version="3.12"/>
+       <menu id="primary-menu">
+               <section>
+                       <item>
+                               <attribute name="action">app.new-game</attribute>
+                               <attribute name="label" translatable="yes">_New Game</attribute>
+                               <attribute name="accel">&lt;Primary&gt;n</attribute>
+                       </item>
+                       <submenu id="board_size_menu">
+                               <attribute name="label" translatable="yes">Board _Size</attribute>
+                               <section>
+                                       <item>
+                                               <attribute name="action">app.board-size</attribute>
+                                               <attribute name="label" translatable="yes">5×5</attribute>
+                                               <attribute name="target">5</attribute>
+                                       </item>
+                                       <item>
+                                               <attribute name="action">app.board-size</attribute>
+                                               <attribute name="label" translatable="yes">6×6</attribute>
+                                               <attribute name="target">6</attribute>
+                                       </item>
+                                       <item>
+                                               <attribute name="action">app.board-size</attribute>
+                                               <attribute name="label" translatable="yes">7×7</attribute>
+                                               <attribute name="target">7</attribute>
+                                       </item>
+                                       <item>
+                                               <attribute name="action">app.board-size</attribute>
+                                               <attribute name="label" translatable="yes">8×8</attribute>
+                                               <attribute name="target">8</attribute>
+                                       </item>
+                                       <item>
+                                               <attribute name="action">app.board-size</attribute>
+                                               <attribute name="label" translatable="yes">9×9</attribute>
+                                               <attribute name="target">9</attribute>
+                                       </item>
+                                       <item>
+                                               <attribute name="action">app.board-size</attribute>
+                                               <attribute name="label" translatable="yes">10×10</attribute>
+                                               <attribute name="target">10</attribute>
+                                       </item>
+                               </section>
+                       </submenu>
+               </section>
+               <section>
+                       <item>
+                               <attribute name="action">app.help</attribute>
+                               <attribute name="label" translatable="yes">_Help</attribute>
+                               <attribute name="accel">F1</attribute>
+                       </item>
+                       <item>
+                               <attribute name="action">app.about</attribute>
+                               <attribute name="label" translatable="yes">_About Hitori</attribute>
+                       </item>
+               </section>
+       </menu>
        <object class="GtkApplicationWindow" id="hitori_main_window">
                <property name="resizable">False</property>
                <signal name="destroy" handler="hitori_destroy_cb"/>
@@ -63,6 +118,28 @@
                                                </child>
                                        </object>
                                </child>
+                               <child>
+                                       <object class="GtkMenuButton" id="primary_menu">
+                                               <property name="visible">True</property>
+                                               <property name="valign">center</property>
+                                               <property name="can_focus">True</property>
+                                               <property name="focus_on_click">False</property>
+                                               <property name="menu_model">primary-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="GtkButton" id="hint_button">
                                                <property name="visible">True</property>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index cf446cc..7cfb5d0 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,7 +1,6 @@
 # List of source files containing translatable strings.
 data/org.gnome.Hitori.desktop.in
 data/org.gnome.Hitori.appdata.xml.in
-data/hitori-menus.ui
 data/hitori.ui
 data/org.gnome.hitori.gschema.xml
 src/interface.c
diff --git a/src/hitori.gresource.xml b/src/hitori.gresource.xml
index 22cdfa0..9ad813a 100644
--- a/src/hitori.gresource.xml
+++ b/src/hitori.gresource.xml
@@ -4,7 +4,4 @@
     <file preprocess="xml-stripblanks" alias="hitori.ui">./data/hitori.ui</file>
     <file alias="hitori.css">./data/hitori.css</file>
   </gresource>
-  <gresource prefix="/org/gnome/Hitori/gtk">
-    <file preprocess="xml-stripblanks" alias="menus.ui">./data/hitori-menus.ui</file>
-  </gresource>
 </gresources>
diff --git a/src/interface.c b/src/interface.c
index e402bb7..0dc8c77 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -2,7 +2,7 @@
 /*
  * Hitori
  * Copyright (C) Philip Withnall 2007-2009 <philip tecnocode co uk>
- * 
+ *
  * Hitori is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
@@ -46,7 +46,6 @@ static void new_game_cb (GSimpleAction *action, GVariant *parameter, gpointer us
 static void hint_cb (GSimpleAction *action, GVariant *parameter, gpointer user_data);
 static void undo_cb (GSimpleAction *action, GVariant *parameter, gpointer user_data);
 static void redo_cb (GSimpleAction *action, GVariant *parameter, gpointer user_data);
-static void quit_cb (GSimpleAction *action, GVariant *parameter, gpointer user_data);
 static void help_cb (GSimpleAction *action, GVariant *parameter, gpointer user_data);
 static void about_cb (GSimpleAction *action, GVariant *parameter, gpointer user_data);
 static void board_size_change_cb (GObject *object, GParamSpec *pspec, gpointer user_data);
@@ -55,7 +54,6 @@ static GActionEntry app_entries[] = {
        { "new-game", new_game_cb, NULL, NULL, NULL },
        { "about", about_cb, NULL, NULL, NULL },
        { "help", help_cb, NULL, NULL, NULL },
-       { "quit", quit_cb, NULL, NULL, NULL },
 };
 
 static GActionEntry win_entries[] = {
@@ -621,13 +619,6 @@ redo_cb (GSimpleAction *action, GVariant *parameter, gpointer user_data)
        gtk_widget_queue_draw (self->drawing_area);
 }
 
-static void
-quit_cb (GSimpleAction *action, GVariant *parameters, gpointer user_data)
-{
-       HitoriApplication *self = HITORI_APPLICATION (user_data);
-       hitori_quit (self);
-}
-
 static void
 help_cb (GSimpleAction *action, GVariant *parameters, gpointer user_data)
 {


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