[gnome-taquin] Update title on back.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-taquin] Update title on back.
- Date: Thu, 5 Dec 2019 22:58:38 +0000 (UTC)
commit 68dbe330a256502d8f471d8244b6cc62fed5f9e1
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Thu Dec 5 23:57:01 2019 +0100
Update title on back.
src/game-window.vala | 2 +-
src/taquin-main.vala | 22 +++++++++++++++++-----
2 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/src/game-window.vala b/src/game-window.vala
index fcae467..5e4c430 100644
--- a/src/game-window.vala
+++ b/src/game-window.vala
@@ -132,7 +132,7 @@ private class GameWindow : BaseWindow, AdaptativeWidget
back ();
}
- internal void set_title (string game_name)
+ internal void update_title (string game_name)
{
headerbar.update_title (game_name);
}
diff --git a/src/taquin-main.vala b/src/taquin-main.vala
index 3d60cd3..2481f0c 100644
--- a/src/taquin-main.vala
+++ b/src/taquin-main.vala
@@ -199,6 +199,7 @@ private class Taquin : Gtk.Application, BaseApplication
null, // appearance menu
night_light_monitor);
window.play.connect (start_game);
+ window.back.connect (back_cb);
window.undo.connect (undo_cb);
window.restart.connect (restart_cb);
@@ -316,11 +317,7 @@ private class Taquin : Gtk.Application, BaseApplication
GameType type = (GameType) settings.get_enum ("type");
int8 size = (int8) settings.get_int ("size"); /* 2 <= size <= 9 */
game = new Game (type, size);
- /* Translators: name of one of the games, as displayed in the headerbar when playing */
- window.set_title (type == GameType.FIFTEEN ? _("15-Puzzle")
-
- /* Translators: name of one of the games, as displayed in the headerbar when playing */
- : _("16-Puzzle"));
+ set_window_title (type == GameType.FIFTEEN);
view.game = (!) game;
window.move_done (0);
move_done = false;
@@ -342,6 +339,15 @@ private class Taquin : Gtk.Application, BaseApplication
((!) game).move.connect (move_cb);
}
+ private void set_window_title (bool fifteen)
+ {
+ /* Translators: name of one of the games, as displayed in the headerbar when playing */
+ window.update_title (fifteen ? _("15-Puzzle")
+
+ /* Translators: name of one of the games, as displayed in the headerbar when playing */
+ : _("16-Puzzle"));
+ }
+
/*\
* * Signals from window
\*/
@@ -354,6 +360,12 @@ private class Taquin : Gtk.Application, BaseApplication
move_done = false;
}
+ private void back_cb ()
+ requires (game != null)
+ {
+ set_window_title (((!) game).game_type == GameType.FIFTEEN);
+ }
+
private void undo_cb ()
requires (game != null)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]