[lightsoff/arnaudb/rework-ui: 2/9] Do not use headerbar subtitle.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [lightsoff/arnaudb/rework-ui: 2/9] Do not use headerbar subtitle.
- Date: Sat, 21 Nov 2020 12:04:43 +0000 (UTC)
commit 31987137edb68061c3e69a2fb1aabb787d94876b
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 f1e9e23..fa5d558 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">
@@ -46,6 +46,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>
@@ -62,7 +72,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]