[iagno] Introduce GameHeaderBar.



commit 8d2eebb02c181b42db4034d97ad7ee6213c8ad9f
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Fri Mar 1 18:42:01 2019 +0100

    Introduce GameHeaderBar.
    
    That is needed for subclassing BaseWindow.

 data/iagno.gresource.xml  |   5 +-
 data/ui/game-headerbar.ui | 124 +++++++++++++++++++++++++++++++
 data/ui/iagno.ui          | 103 --------------------------
 src/game-headerbar.vala   | 181 ++++++++++++++++++++++++++++++++++++++++++++++
 src/game-window.vala      | 124 ++++++-------------------------
 src/iagno.vala            |   4 +-
 src/meson.build           |   1 +
 7 files changed, 336 insertions(+), 206 deletions(-)
---
diff --git a/data/iagno.gresource.xml b/data/iagno.gresource.xml
index b45d70d..725ad55 100644
--- a/data/iagno.gresource.xml
+++ b/data/iagno.gresource.xml
@@ -1,8 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <gresources>
   <gresource prefix="/org/gnome/Reversi/ui">
-    <file preprocess="xml-stripblanks" compressed="true" alias="game-window.ui">ui/iagno.ui</file>
-    <file preprocess="xml-stripblanks" compressed="true" alias="iagno-screens.ui">ui/iagno-screens.ui</file>
+    <file preprocess="xml-stripblanks" compressed="true" 
alias="game-headerbar.ui">ui/game-headerbar.ui</file>
+    <file preprocess="xml-stripblanks" compressed="true" alias="game-window.ui"   >ui/iagno.ui</file>
+    <file preprocess="xml-stripblanks" compressed="true" alias="iagno-screens.ui" >ui/iagno-screens.ui</file>
     <file compressed="true">iagno.css</file>
     <file>noise.png</file>
   </gresource>
diff --git a/data/ui/game-headerbar.ui b/data/ui/game-headerbar.ui
new file mode 100644
index 0000000..08f83dc
--- /dev/null
+++ b/data/ui/game-headerbar.ui
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  This file is part of GNOME Reversi (also known as Iagno).
+
+  Copyright 2012 Tiffany Antopolski and Robert Ancell
+  Copyright 2013, 2014, 2015 Michael Catanzaro
+  Copyright 2014, 2015, 2019 Arnaud Bonatti
+
+  GNOME Reversi 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
+  (at your option) any later version.
+
+  GNOME Reversi is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with GNOME Reversi.  If not, see <https://www.gnu.org/licenses/>.
+-->
+<interface>
+  <requires lib="gtk+" version="3.12"/>
+  <menu id="primary-menu">
+    <section>
+      <item>
+        <!-- Translators: hamburger menu entry; sound togglebutton (with a mnemonic that appears pressing 
Alt) -->
+        <attribute name="label" translatable="yes">_Sound</attribute>
+        <attribute name="action">app.sound</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <!-- Translators: hamburger menu entry; open help (with a mnemonic that appears pressing Alt) -->
+        <attribute name="label" translatable="yes">_Help</attribute>
+        <attribute name="action">app.help</attribute>
+      </item>
+      <item>
+        <!-- Translators: hamburger menu entry; open about dialog (with a mnemonic that appears pressing 
Alt) -->
+        <attribute name="label" translatable="yes">_About Iagno</attribute>
+        <attribute name="action">app.about</attribute>
+      </item>
+    </section>
+  </menu>
+  <template class="GameHeaderBar" parent="GtkHeaderBar">
+    <property name="visible">True</property>
+    <property name="show-close-button">True</property>
+    <child>
+      <object class="GtkButton" id="new_game_button">
+        <property name="visible">False</property>
+        <property name="use-underline">True</property>
+        <!-- Translators: during a game, label of the Start Over button (with a mnemonic that appears 
pressing Alt) -->
+        <property name="label" translatable="yes">_New Game</property>
+        <property name="halign">center</property>
+        <property name="valign">center</property>
+        <property name="action-name">ui.new-game</property>
+        <property name="can-default">True</property>
+        <!-- Translators: during a game, tooltip text of the Start Over button -->
+        <property name="tooltip-text" translatable="yes">Start a new game</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkButton" id="back_button">
+        <property name="visible">False</property>
+        <property name="halign">center</property>
+        <property name="valign">center</property>
+        <!-- Translators: when configuring a new game, if the user has a started game, tooltip text of the 
Go back button -->
+        <property name="tooltip-text" translatable="yes">Go back to the current game</property>
+        <property name="use-underline">True</property>
+        <property name="action-name">ui.back</property>
+        <property name="focus-on-click">False</property>
+        <style>
+          <class name="image-button"/>
+        </style>
+        <child>
+          <object class="GtkImage">
+            <property name="icon-name">go-previous-symbolic</property>
+            <property name="visible">True</property>
+            <property name="icon-size">1</property>
+          </object>
+        </child>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuButton" id="history_button">
+        <property name="visible">False</property>
+        <property name="valign">center</property>
+        <property name="can-focus">True</property>
+        <property name="focus-on-click">False</property>
+        <child>
+          <object class="GtkImage">
+            <property name="visible">True</property>
+            <property name="icon-name">document-open-recent-symbolic</property> <!-- or 
content-loading-symbolic -->
+            <property name="icon-size">1</property>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="pack-type">end</property>
+        <property name="position">2</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkMenuButton" id="info_button">
+        <property name="visible">True</property>
+        <property name="valign">center</property>
+        <property name="can-focus">True</property>
+        <property name="menu-model">primary-menu</property>
+        <property name="focus-on-click">False</property>
+        <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>
+        <property name="position">1</property>
+      </packing>
+    </child>
+  </template>
+</interface>
diff --git a/data/ui/iagno.ui b/data/ui/iagno.ui
index 66de515..1c79eb6 100644
--- a/data/ui/iagno.ui
+++ b/data/ui/iagno.ui
@@ -21,110 +21,7 @@
 -->
 <interface>
   <requires lib="gtk+" version="3.12"/>
-  <menu id="primary-menu">
-    <section>
-      <item>
-        <!-- Translators: hamburger menu entry; sound togglebutton (with a mnemonic that appears pressing 
Alt) -->
-        <attribute name="label" translatable="yes">_Sound</attribute>
-        <attribute name="action">app.sound</attribute>
-      </item>
-    </section>
-    <section>
-      <item>
-        <!-- Translators: hamburger menu entry; open help (with a mnemonic that appears pressing Alt) -->
-        <attribute name="label" translatable="yes">_Help</attribute>
-        <attribute name="action">app.help</attribute>
-      </item>
-      <item>
-        <!-- Translators: hamburger menu entry; open about dialog (with a mnemonic that appears pressing 
Alt) -->
-        <attribute name="label" translatable="yes">_About Iagno</attribute>
-        <attribute name="action">app.about</attribute>
-      </item>
-    </section>
-  </menu>
   <template class="GameWindow" parent="GtkApplicationWindow">
-    <!-- <initial-focus name="view"/> -->
-    <child type="titlebar">
-      <object class="GtkHeaderBar" id="headerbar">
-        <property name="visible">True</property>
-        <property name="show-close-button">True</property>
-        <child>
-          <object class="GtkButton" id="new_game_button">
-            <property name="visible">False</property>
-            <property name="use-underline">True</property>
-            <!-- Translators: during a game, label of the New Game button (with a mnemonic that appears 
pressing Alt) -->
-            <property name="label" translatable="yes">_New Game</property>
-            <property name="halign">center</property>
-            <property name="valign">center</property>
-            <property name="action-name">ui.new-game</property>
-            <property name="can-default">True</property>
-            <!-- Translators: during a game, tooltip text of the New Game button -->
-            <property name="tooltip-text" translatable="yes">Start a new game</property>
-          </object>
-        </child>
-        <child>
-          <object class="GtkButton" id="back_button">
-            <property name="visible">False</property>
-            <property name="halign">center</property>
-            <property name="valign">center</property>
-            <!-- Translators: when configuring a new game, if the user has a started game, tooltip text of 
the Go back button -->
-            <property name="tooltip-text" translatable="yes">Go back to the current game</property>
-            <property name="use-underline">True</property>
-            <property name="action-name">ui.back</property>
-            <property name="focus-on-click">False</property>
-            <style>
-              <class name="image-button"/>
-            </style>
-            <child>
-              <object class="GtkImage">
-                <property name="icon-name">go-previous-symbolic</property>
-                <property name="visible">True</property>
-                <property name="icon-size">1</property>
-              </object>
-            </child>
-          </object>
-        </child>
-        <child>
-          <object class="GtkMenuButton" id="history_button">
-            <property name="visible">False</property>
-            <property name="valign">center</property>
-            <property name="can-focus">True</property>
-            <property name="focus-on-click">False</property>
-            <child>
-              <object class="GtkImage">
-                <property name="visible">True</property>
-                <property name="icon-name">document-open-recent-symbolic</property> <!-- or 
content-loading-symbolic -->
-                <property name="icon-size">1</property>
-              </object>
-            </child>
-          </object>
-          <packing>
-            <property name="pack-type">end</property>
-            <property name="position">2</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkMenuButton" id="info_button">
-            <property name="visible">True</property>
-            <property name="valign">center</property>
-            <property name="can-focus">True</property>
-            <property name="menu-model">primary-menu</property>
-            <property name="focus-on-click">False</property>
-            <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>
-            <property name="position">1</property>
-          </packing>
-        </child>
-      </object>
-    </child>
     <child>
       <object class="GtkOverlay">
         <property name="visible">True</property>
diff --git a/src/game-headerbar.vala b/src/game-headerbar.vala
new file mode 100644
index 0000000..87a37eb
--- /dev/null
+++ b/src/game-headerbar.vala
@@ -0,0 +1,181 @@
+/* -*- Mode: vala; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+   This file is part of GNOME Reversi, also known as Iagno.
+
+   Copyright 2019 Arnaud Bonatti
+
+   GNOME Reversi 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
+   (at your option) any later version.
+
+   GNOME Reversi is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with GNOME Reversi.  If not, see <https://www.gnu.org/licenses/>.
+*/
+
+using Gtk;
+
+[GtkTemplate (ui = "/org/gnome/Reversi/ui/game-headerbar.ui")]
+private class GameHeaderBar : HeaderBar
+{
+    [CCode (notify = false)] public string window_name   { private get; internal  construct; default = ""; }
+
+    [CCode (notify = false)] public bool show_undo { private get; protected construct; default = false; }
+ // [CCode (notify = false)] public bool show_redo { private get; protected construct; default = false; }
+ // [CCode (notify = false)] public bool show_hint { private get; protected construct; default = false; }    
// TODO something
+
+    [CCode (notify = false)] public bool has_help { private get; protected construct; default = false; }
+    [CCode (notify = false)] public bool has_keyboard_shortcuts { private get; protected construct; default 
= false; }
+
+    [GtkChild] private Button new_game_button;
+    [GtkChild] private Button back_button;
+
+    construct
+    {
+        configure_history_button ();
+
+        if (window_name != "")
+         // window_has_name = true;
+            set_title (window_name);
+    }
+
+    internal GameHeaderBar (string              _window_name,
+                            GameWindowFlags     flags,
+                            GLib.Menu?          appearance_menu)
+    {
+        Object (has_keyboard_shortcuts: GameWindowFlags.SHORTCUTS in flags,
+                has_help:               GameWindowFlags.SHOW_HELP in flags, // TODO rename show_help
+             // show_hint:              GameWindowFlags.SHOW_HINT in flags,
+             // show_redo:              GameWindowFlags.SHOW_REDO in flags,
+                show_undo:              GameWindowFlags.SHOW_UNDO in flags,
+                window_name:            _window_name);
+
+        GLib.MenuModel hamburger_menu = (!) info_button.get_menu_model ();
+        if (appearance_menu != null)
+        {
+            GLib.Menu first_section = (GLib.Menu) (!) hamburger_menu.get_item_link (0, "section");
+            /* Translators: hamburger menu entry; "Appearance" submenu (with a mnemonic that appears 
pressing Alt) */
+            first_section.prepend_submenu (_("A_ppearance"), (!) appearance_menu);
+        }
+        ((GLib.Menu) hamburger_menu).freeze ();
+    }
+
+    internal bool back_button_is_focus ()
+    {
+        return back_button.is_focus;
+    }
+
+    internal void finish_game ()
+    {
+        if (!history_button.active)
+            new_game_button.grab_focus ();
+        else
+            new_game_button.grab_default ();    // FIXME: grab_focus, but without closing the popover...
+        set_history_button_label (Player.NONE);
+    }
+
+    /*\
+    * * showing the stack
+    \*/
+
+    internal bool show_new_game_screen (bool game_finished)
+    {
+        set_subtitle (null);      // TODO save / restore?
+
+        new_game_button.hide ();
+        history_button.hide ();
+
+        bool grab_focus = !game_finished && back_button.visible;
+        if (grab_focus)
+            back_button.grab_focus ();
+        return grab_focus;
+    }
+
+    internal void show_view (bool game_finished)
+    {
+        back_button.hide ();        // TODO transition?
+        new_game_button.show ();
+        history_button.show ();
+
+        if (game_finished)
+            new_game_button.grab_focus ();
+    }
+
+    /*\
+    * * switching the stack
+    \*/
+
+    internal void new_game ()
+    {
+        back_button.show ();
+    }
+
+    /*\
+    * * hamburger menu
+    \*/
+
+    [GtkChild] private MenuButton info_button;
+
+    internal void toggle_hamburger ()
+    {
+        info_button.active = !info_button.active;
+    }
+
+    /*\
+    * * history menu
+    \*/
+
+    [GtkChild] private MenuButton history_button;
+
+    private GLib.Menu history_menu;
+    private GLib.Menu finish_menu;
+
+    private string history_button_light_label;
+    private string history_button_dark_label;
+
+    private void configure_history_button ()
+    {
+        history_menu = new GLib.Menu ();
+        /* Translators: history menu entry (with a mnemonic that appears pressing Alt) */
+        history_menu.append (_("_Undo last move"), "ui.undo");
+        history_menu.freeze ();
+
+        finish_menu = new GLib.Menu ();
+        /* Translators: history menu entry, when game is finished, after final animation; undoes the 
animation (with a mnemonic that appears pressing Alt) */
+        finish_menu.append (_("_Show final board"), "ui.undo");
+        finish_menu.freeze ();
+
+        bool dir_is_ltr = get_locale_direction () == TextDirection.LTR;
+        history_button_light_label = dir_is_ltr ? "‎⮚ ⚪" : /* yes */ "‏⮘ ⚪";    /* both have an LTR/RTL mark 
*/
+        history_button_dark_label  = dir_is_ltr ? "‎⮚ ⚫" : /* yes */ "‏⮘ ⚫";    /* both have an LTR/RTL mark 
*/
+
+        history_button_new_game ();
+    }
+
+    internal inline void update_history_button (bool finish_animation)
+    {
+        history_button.set_menu_model (finish_animation ? finish_menu : history_menu);
+    }
+
+    internal inline void history_button_new_game ()
+    {
+        set_history_button_label (Player.DARK);
+        update_history_button (/* final animation */ false);
+    }
+
+    internal void set_history_button_label (Player player)
+    {
+        switch (player)
+        {
+            case Player.LIGHT:  history_button.set_label (history_button_light_label);  return;
+            case Player.DARK:   history_button.set_label (history_button_dark_label);   return;
+            case Player.NONE:   history_button.set_label (_("Finished!"));              return;
+            default: assert_not_reached ();
+        }
+    }
+}
diff --git a/src/game-window.vala b/src/game-window.vala
index 000dad5..f3d9319 100644
--- a/src/game-window.vala
+++ b/src/game-window.vala
@@ -22,6 +22,8 @@ using Gtk;
 
 [Flags]
 private enum GameWindowFlags {
+    SHORTCUTS,
+    SHOW_HELP,
     SHOW_UNDO,
  // SHOW_REDO,
  // SHOW_HINT,
@@ -41,16 +43,13 @@ private class GameWindow : ApplicationWindow
     private bool game_finished = false;
 
     /* private widgets */
-    [GtkChild] private HeaderBar headerbar;
     [GtkChild] private Stack stack;
     [GtkChild] private Box new_game_box;
     [GtkChild] private Box view_box;
-
-    private Button? start_game_button = null;
-    [GtkChild] private Button new_game_button;
-    [GtkChild] private Button back_button;
     [GtkChild] private Button unfullscreen_button;
 
+    private GameHeaderBar headerbar;
+    private Button? start_game_button = null;
     private Widget view;
 
     /* signals */
@@ -78,16 +77,12 @@ private class GameWindow : ApplicationWindow
         /* window config */
         install_ui_action_entries ();
         set_title (name);
-        headerbar.set_title (name);
 
-        GLib.MenuModel hamburger_menu = (!) info_button.get_menu_model ();
-        if (appearance_menu != null)
-        {
-            GLib.Menu first_section = (GLib.Menu) (!) hamburger_menu.get_item_link (0, "section");
-            /* Translators: hamburger menu entry; "Appearance" submenu (with a mnemonic that appears 
pressing Alt) */
-            first_section.prepend_submenu (_("A_ppearance"), (!) appearance_menu);
-        }
-        ((GLib.Menu) hamburger_menu).freeze ();
+        headerbar = new GameHeaderBar (name, flags, appearance_menu);
+        headerbar.show ();
+        set_titlebar (headerbar);
+
+        ((GameView) view).notify_final_animation.connect ((undoing) => { headerbar.update_history_button 
(!undoing); });
 
         set_default_size (width, height);
         if (maximized)
@@ -114,8 +109,6 @@ private class GameWindow : ApplicationWindow
             start_game_button = _start_game_button;
         }
 
-        configure_history_button ();
-
         view_box.add (view);
         stack.set_visible_child (view_box);
         view.halign = Align.FILL;
@@ -242,11 +235,12 @@ private class GameWindow : ApplicationWindow
     internal void finish_game ()
     {
         game_finished = true;
-        if (!history_button.active)
-            new_game_button.grab_focus ();
-        else
-            new_game_button.grab_default ();
-        set_history_button_label (Player.NONE);
+        headerbar.finish_game ();
+    }
+
+    internal void set_history_button_label (Player player)
+    {
+        headerbar.set_history_button_label (player);
     }
 
     /* internal void about ()
@@ -260,28 +254,19 @@ private class GameWindow : ApplicationWindow
 
     private void show_new_game_screen ()
     {
-        headerbar.set_subtitle (null);      // TODO save / restore?
-
         stack.set_visible_child (new_game_box);
-        new_game_button.hide ();
-        history_button.hide ();
 
-        if (!game_finished && back_button.visible)
-            back_button.grab_focus ();
-        else if (start_game_button != null)
+        bool headerbar_grabbed_focus = headerbar.show_new_game_screen (game_finished);
+        if (!headerbar_grabbed_focus && start_game_button != null)
             ((!) start_game_button).grab_focus ();
     }
 
     private void show_view ()
     {
         stack.set_visible_child (view_box);
-        back_button.hide ();        // TODO transition?
-        new_game_button.show ();
-        history_button.show ();
 
-        if (game_finished)
-            new_game_button.grab_focus ();
-        else
+        headerbar.show_view (game_finished);
+        if (!game_finished)
             view.grab_focus ();
     }
 
@@ -300,7 +285,7 @@ private class GameWindow : ApplicationWindow
         stack.set_transition_type (StackTransitionType.SLIDE_LEFT);
         stack.set_transition_duration (800);
 
-        back_button.show ();
+        headerbar.new_game ();
         back_action.set_enabled (true);
 
         show_new_game_screen ();
@@ -317,7 +302,7 @@ private class GameWindow : ApplicationWindow
         undo_action.set_enabled (false);
      // redo_action.set_enabled (false);
 
-        history_button_new_game ();
+        headerbar.history_button_new_game ();
 
         play ();        // FIXME lag (see in Taquin…)
 
@@ -357,7 +342,7 @@ private class GameWindow : ApplicationWindow
 
         game_finished = false;
 
-        if (!back_button.is_focus)
+        if (!headerbar.back_button_is_focus ())
             view.grab_focus();
      // redo_action.set_enabled (true);
         undo ();
@@ -369,7 +354,7 @@ private class GameWindow : ApplicationWindow
         if (stack_child == null || (!) stack_child != view_box)
             return;
 
-        if (!back_button.is_focus)
+        if (!headerbar.back_button_is_focus ())
             view.grab_focus();
         undo_action.set_enabled (true);
         redo ();
@@ -383,69 +368,8 @@ private class GameWindow : ApplicationWindow
         hint ();
     } */
 
-    /*\
-    * * hamburger menu
-    \*/
-
-    [GtkChild] private MenuButton info_button;
-
     private void toggle_hamburger (/* SimpleAction action, Variant? variant */)
     {
-        info_button.active = !info_button.active;
-    }
-
-    /*\
-    * * history menu
-    \*/
-
-    [GtkChild] private MenuButton history_button;
-
-    private GLib.Menu history_menu;
-    private GLib.Menu finish_menu;
-
-    private string history_button_light_label;
-    private string history_button_dark_label;
-
-    private void configure_history_button ()
-    {
-        history_menu = new GLib.Menu ();
-        /* Translators: history menu entry (with a mnemonic that appears pressing Alt) */
-        history_menu.append (_("_Undo last move"), "ui.undo");
-        history_menu.freeze ();
-
-        finish_menu = new GLib.Menu ();
-        /* Translators: history menu entry, when game is finished, after final animation; undoes the 
animation (with a mnemonic that appears pressing Alt) */
-        finish_menu.append (_("_Show final board"), "ui.undo");
-        finish_menu.freeze ();
-
-        bool dir_is_ltr = get_locale_direction () == TextDirection.LTR;
-        history_button_light_label = dir_is_ltr ? "‎⮚ ⚪" : /* yes */ "‏⮘ ⚪";    /* both have an LTR/RTL mark 
*/
-        history_button_dark_label  = dir_is_ltr ? "‎⮚ ⚫" : /* yes */ "‏⮘ ⚫";    /* both have an LTR/RTL mark 
*/
-
-        ((GameView) view).notify_final_animation.connect ((undoing) => { update_history_button (!undoing); 
});
-
-        history_button_new_game ();
-    }
-
-    private inline void update_history_button (bool finish_animation)
-    {
-        history_button.set_menu_model (finish_animation ? finish_menu : history_menu);
-    }
-
-    private inline void history_button_new_game ()
-    {
-        set_history_button_label (Player.DARK);
-        update_history_button (/* final animation */ false);
-    }
-
-    internal void set_history_button_label (Player player)
-    {
-        switch (player)
-        {
-            case Player.LIGHT:  history_button.set_label (history_button_light_label);  return;
-            case Player.DARK:   history_button.set_label (history_button_dark_label);   return;
-            case Player.NONE:   history_button.set_label (_("Finished!"));              return;
-            default: assert_not_reached ();
-        }
+        headerbar.toggle_hamburger ();
     }
 }
diff --git a/src/iagno.vala b/src/iagno.vala
index 0f69507..f340a83 100644
--- a/src/iagno.vala
+++ b/src/iagno.vala
@@ -284,7 +284,9 @@ private class Iagno : Gtk.Application
                                  settings.get_int ("window-height"),
                                  settings.get_boolean ("window-is-maximized"),
                                  start_now,
-                                 GameWindowFlags.SHOW_UNDO | GameWindowFlags.SHOW_START_BUTTON,
+                                 GameWindowFlags.SHOW_START_BUTTON
+                                 | GameWindowFlags.SHOW_HELP
+                                 | GameWindowFlags.SHOW_UNDO,
                                  (Box) builder.get_object ("new-game-screen"),
                                  view,
                                  appearance_menu);
diff --git a/src/meson.build b/src/meson.build
index d1a3946..28d7e28 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -21,6 +21,7 @@ executable(meson.project_name(),
         'vapi/config.vapi',
         'computer-player.vala',
         'computer-reversi.vala',
+        'game-headerbar.vala',
         'game-view.vala',
         'game-window.vala',
         'game.vala',


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