[four-in-a-row/arnaudb/wip/gtk4: 91/92] Adapt to HeaderBar API.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [four-in-a-row/arnaudb/wip/gtk4: 91/92] Adapt to HeaderBar API.
- Date: Sat, 26 Sep 2020 10:29:08 +0000 (UTC)
commit 6c6a68b2c3e225a863dc1a709f42bc4d6d352e10
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Mon May 4 14:43:07 2020 +0200
Adapt to HeaderBar API.
src/four-in-a-row.vala | 5 ++++-
src/game-window.vala | 23 +++++++++++------------
2 files changed, 15 insertions(+), 13 deletions(-)
---
diff --git a/src/four-in-a-row.vala b/src/four-in-a-row.vala
index 566eaaa..fa84845 100644
--- a/src/four-in-a-row.vala
+++ b/src/four-in-a-row.vala
@@ -746,7 +746,10 @@ private class FourInARow : Gtk.Application
private void set_status_message (string? message)
{
- window.set_subtitle (message);
+ if (message == null)
+ window.set_subtitle ("");
+ else
+ window.set_subtitle ((!) message);
}
private class NextMove
diff --git a/src/game-window.vala b/src/game-window.vala
index 3c699f2..2897d98 100644
--- a/src/game-window.vala
+++ b/src/game-window.vala
@@ -83,9 +83,8 @@ private class GameWindow : AdaptativeWindow, AdaptativeWidget
/* window config */
install_ui_action_entries ();
program_name = name;
- set_title (name);
if (!is_extra_thin)
- headerbar.set_title (name);
+ set_title (name);
info_button.set_menu_model (app_menu);
/* add widgets */
@@ -207,12 +206,12 @@ private class GameWindow : AdaptativeWindow, AdaptativeWidget
// headerbar.set_subtitle (null);
// }
- internal void set_subtitle (string? subtitle)
+ internal void set_subtitle (string subtitle)
{
if (!is_extra_thin)
- headerbar.set_title (subtitle);
+ set_title (subtitle);
last_subtitle = subtitle;
- if (subtitle == null)
+ if (subtitle == "")
actionbar.set_visibility (false);
else
{
@@ -265,7 +264,7 @@ private class GameWindow : AdaptativeWindow, AdaptativeWidget
if (is_extra_thin)
{
- headerbar.set_title (null);
+ set_title ("");
if (game_widget_1 != null)
((!) game_widget_1).hide ();
}
@@ -275,9 +274,9 @@ private class GameWindow : AdaptativeWindow, AdaptativeWidget
((!) game_widget_1).show ();
string? panel_name = stack.get_visible_child_name ();
if (panel_name != null && (!) panel_name == "start-box")
- headerbar.set_title (program_name);
+ set_title (program_name);
else
- headerbar.set_title (last_subtitle);
+ set_title (last_subtitle);
}
}
@@ -285,11 +284,11 @@ private class GameWindow : AdaptativeWindow, AdaptativeWidget
* * Showing the Stack
\*/
- private string? last_subtitle = null;
+ private string last_subtitle = "";
private void show_new_game_screen ()
{
if (!is_extra_thin)
- headerbar.set_title (program_name);
+ set_title (program_name);
actionbar.set_visibility (false);
stack.set_visible_child_name ("start-box");
@@ -306,7 +305,7 @@ private class GameWindow : AdaptativeWindow, AdaptativeWidget
private void show_view ()
{
if (!is_extra_thin)
- headerbar.set_title (last_subtitle);
+ set_title (last_subtitle);
actionbar.set_visibility (true);
stack.set_visible_child_name ("game-box");
@@ -348,7 +347,7 @@ private class GameWindow : AdaptativeWindow, AdaptativeWidget
if (stack_child == null || (!) stack_child != "start-box")
return;
- last_subtitle = null;
+ last_subtitle = "";
game_finished = false;
undo_action.set_enabled (false);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]