[lightsoff/arnaudb/rework-ui: 2/5] Do not use headerbar subtitle.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [lightsoff/arnaudb/rework-ui: 2/5] Do not use headerbar subtitle.
- Date: Mon, 16 Nov 2020 12:03:43 +0000 (UTC)
commit 269ccfc90f0af7cbfec94bb3d4da68bc4fca521b
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Thu Oct 29 16:00:00 2020 +0100
Do not use headerbar subtitle.
data/lightsoff.ui | 14 ++++++++++++--
src/lightsoff-window.vala | 15 +++++----------
2 files changed, 17 insertions(+), 12 deletions(-)
---
diff --git a/data/lightsoff.ui b/data/lightsoff.ui
index 788b488..f9a555b 100644
--- a/data/lightsoff.ui
+++ b/data/lightsoff.ui
@@ -32,7 +32,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="title" translatable="no">Puzzle X</property>
- <property name="subtitle" translatable="no">y moves</property>
+ <property name="has_subtitle">False</property>
<property name="show_close_button">True</property>
<child>
<object class="GtkMenuButton">
@@ -45,6 +45,16 @@
<property name="menu_model">change-level-menu</property>
</object>
</child>
+ <child>
+ <object class="GtkLabel" id="score_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="no">0</property>
+ </object>
+ <packing>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
<child>
<object class="GtkMenuButton" id="menu_button">
<property name="visible">True</property>
@@ -60,7 +70,7 @@
</object>
<packing>
<property name="pack_type">end</property>
- <property name="position">1</property>
+ <property name="position">0</property>
</packing>
</child>
</object>
diff --git a/src/lightsoff-window.vala b/src/lightsoff-window.vala
index 31a74cf..18d7d1c 100644
--- a/src/lightsoff-window.vala
+++ b/src/lightsoff-window.vala
@@ -15,8 +15,9 @@ using Gtk;
[GtkTemplate (ui = "/org/gnome/LightsOff/ui/lightsoff.ui")]
private class LightsoffWindow : ManagedWindow
{
- [GtkChild] private HeaderBar headerbar;
- [GtkChild] private MenuButton menu_button;
+ [GtkChild] private HeaderBar headerbar;
+ [GtkChild] private MenuButton menu_button;
+ [GtkChild] private Label score_label;
private GLib.Settings settings;
private GameView game_view;
@@ -84,20 +85,14 @@ private class LightsoffWindow : ManagedWindow
private void update_subtitle (int moves)
{
- headerbar.subtitle = ngettext ("%d move", "%d moves", moves).printf (moves);
+ score_label.set_label (moves.to_string ());
}
private void update_title (int level)
{
/* Translators: the title of the window, %d is the level number */
headerbar.title = _("Puzzle %d").printf (level);
-
- if (level == 1)
- /* Translators: default subtitle, only displayed when playing level one; used as a game hint */
- headerbar.subtitle = _("Turn off all the lights!");
- else
- /* else show number of moves */
- update_subtitle (0);
+ update_subtitle (0);
}
private void previous_level_cb ()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]