[gnome-2048/arnaudb/wip/gtk4: 28/36] Do not use headerbar subtitle.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-2048/arnaudb/wip/gtk4: 28/36] Do not use headerbar subtitle.
- Date: Tue, 14 Jul 2020 11:00:44 +0000 (UTC)
commit 5037c353da1d8787ecffc668072d0a7e58b86c56
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Mon Jul 13 16:53:33 2020 +0200
Do not use headerbar subtitle.
data/mainwindow.ui | 6 ++++++
src/game-headerbar.vala | 13 -------------
src/game-window.vala | 7 ++++---
3 files changed, 10 insertions(+), 16 deletions(-)
---
diff --git a/data/mainwindow.ui b/data/mainwindow.ui
index a278fab..bd0bb36 100644
--- a/data/mainwindow.ui
+++ b/data/mainwindow.ui
@@ -37,6 +37,12 @@
</child>
</object>
</child>
+ <child type="overlay">
+ <object class="GtkLabel" id="_gameover_label">
+ <property name="visible">False</property>
+ <property name="label" translatable="yes">Game Over</property>
+ </object>
+ </child>
<child type="overlay">
<object class="GtkButton" id="_unfullscreen_button">
<property name="visible">False</property>
diff --git a/src/game-headerbar.vala b/src/game-headerbar.vala
index 50e1fe5..4793915 100644
--- a/src/game-headerbar.vala
+++ b/src/game-headerbar.vala
@@ -59,19 +59,6 @@ private class GameHeaderBar : Widget
* * texts
\*/
- internal void clear_subtitle ()
- {
- _headerbar.set_subtitle (null);
- _headerbar.set_has_subtitle (false);
- }
-
- internal void finished ()
- {
- _headerbar.set_has_subtitle (true);
- /* Translators: subtitle of the headerbar, when the user cannot move anymore */
- _headerbar.subtitle = _("Game Over");
- }
-
internal void set_score (Object game, ParamSpec unused)
{
_score.label = ((Game) game).score.to_string ();
diff --git a/src/game-window.vala b/src/game-window.vala
index 4cfca67..d12a569 100644
--- a/src/game-window.vala
+++ b/src/game-window.vala
@@ -31,6 +31,7 @@ private class GameWindow : ApplicationWindow
private Game _game;
[GtkChild] private Button _unfullscreen_button;
+ [GtkChild] private Label _gameover_label;
public uint8 cli_cols { private get; protected construct; default = 0; }
public uint8 cli_rows { private get; protected construct; default = 0; }
@@ -95,7 +96,7 @@ private class GameWindow : ApplicationWindow
_game = new Game (ref _settings);
_game.notify ["score"].connect (_header_bar.set_score);
_game.finished.connect ((show_scores) => {
- _header_bar.finished ();
+ _gameover_label.show ();
if (show_scores)
_show_best_scores ();
@@ -257,14 +258,14 @@ private class GameWindow : ApplicationWindow
if (!_settings.get_boolean ("allow-undo")) // for the keyboard shortcut
return;
- _header_bar.clear_subtitle ();
+ _gameover_label.hide ();
_game.undo ();
_game.grab_focus ();
}
private void new_game_cb (/* SimpleAction action, Variant? variant */)
{
- _header_bar.clear_subtitle ();
+ _gameover_label.hide ();
_game.new_game (ref _settings);
_game.grab_focus ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]