[iagno] Show game name when playing.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [iagno] Show game name when playing.
- Date: Wed, 4 Dec 2019 09:05:57 +0000 (UTC)
commit 2bd969a1f8b75e8e5dbb8de4c006b108b476fbad
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Wed Dec 4 09:41:21 2019 +0100
Show game name when playing.
src/game-headerbar.vala | 10 ++++++++--
src/game-window.vala | 6 ++++++
src/iagno.vala | 5 +++++
3 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/src/game-headerbar.vala b/src/game-headerbar.vala
index 90c5de0..bd5c77b 100644
--- a/src/game-headerbar.vala
+++ b/src/game-headerbar.vala
@@ -27,8 +27,8 @@ private class GameHeaderBar : BaseHeaderBar, AdaptativeWidget
[GtkChild] private Button new_game_button;
[GtkChild] private Button back_button;
- [CCode (notify = false)] public bool window_has_name { private get; protected construct; default =
false; }
- [CCode (notify = false)] public string window_name { private get; internal construct; default = ""; }
+ [CCode (notify = false)] public bool window_has_name { private get; protected construct ; default =
false; }
+ [CCode (notify = false)] public string window_name { private get; protected construct set; default =
""; }
[CCode (notify = false)] public bool has_sound { private get; protected construct; default = false; }
[CCode (notify = false)] public bool show_undo { private get; protected construct; default = false; }
@@ -167,6 +167,12 @@ private class GameHeaderBar : BaseHeaderBar, AdaptativeWidget
set_history_button_label (Player.NONE);
}
+ internal void update_title (string new_title)
+ {
+ window_name = new_title;
+ set_default_widgets_default_states (this);
+ }
+
/*\
* * hamburger menu
\*/
diff --git a/src/game-window.vala b/src/game-window.vala
index 363cadf..a357cc5 100644
--- a/src/game-window.vala
+++ b/src/game-window.vala
@@ -127,6 +127,7 @@ private class GameWindow : BaseWindow, AdaptativeWidget
private void show_new_game_screen ()
{
hide_notification ();
+ headerbar.update_title (Iagno.PROGRAM_NAME);
bool grabs_focus = headerbar.show_new_game_screen (game_finished);
game_view.show_new_game_box (/* grab focus */ !grabs_focus);
}
@@ -263,6 +264,11 @@ private class GameWindow : BaseWindow, AdaptativeWidget
headerbar.set_history_button_label (player);
}
+ internal void set_title (string game_name)
+ {
+ headerbar.update_title (game_name);
+ }
+
/*\
* * actions helper
\*/
diff --git a/src/iagno.vala b/src/iagno.vala
index 4619bf3..0d3c09c 100644
--- a/src/iagno.vala
+++ b/src/iagno.vala
@@ -667,6 +667,11 @@ private class Iagno : Gtk.Application, BaseApplication
opening = Opening.REVERSI;
bool reverse = settings.get_string ("type") == "reverse";
+ /* Translators: name of one of the games, as displayed in the headerbar when playing */
+ window.set_title (reverse ? _("Reverse Reversi")
+
+ /* Translators: name of one of the games, as displayed in the headerbar when playing */
+ : _("Classic Reversi"));
game = new Game (reverse, opening, (uint8) size /* 4 <= size <= 16 */, print_logs);
game_is_set = true;
game.turn_ended.connect (turn_ended_cb);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]