[iagno] Fix bug.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [iagno] Fix bug.
- Date: Wed, 12 Feb 2020 12:03:28 +0000 (UTC)
commit e093fa9abce287f3dd7d75e56b9722b39ea57fda
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Wed Feb 12 12:03:14 2020 +0100
Fix bug.
Escape was not working in view.
src/base-window.vala | 12 ++++++++++++
src/game-window.vala | 2 ++
2 files changed, 14 insertions(+)
---
diff --git a/src/base-window.vala b/src/base-window.vala
index fe6369d..8edd584 100644
--- a/src/base-window.vala
+++ b/src/base-window.vala
@@ -100,11 +100,19 @@ private class BaseWindow : AdaptativeWindow, AdaptativeWidget
* * action entries
\*/
+ protected SimpleAction escape_action;
+
private void install_action_entries ()
{
SimpleActionGroup action_group = new SimpleActionGroup ();
action_group.add_action_entries (action_entries, this);
insert_action_group ("base", action_group);
+
+ GLib.Action? tmp_action = action_group.lookup_action ("escape");
+ if (tmp_action == null)
+ assert_not_reached ();
+ escape_action = (SimpleAction) (!) tmp_action;
+ escape_action.set_enabled (false);
}
private const GLib.ActionEntry [] action_entries =
@@ -401,6 +409,7 @@ private class BaseWindow : AdaptativeWindow, AdaptativeWidget
if (in_window_about)
{
in_window_about = false;
+ escape_action.set_enabled (escape_action_enabled);
headerbar.show_default_view ();
main_view.show_default_view ();
}
@@ -500,11 +509,14 @@ private class BaseWindow : AdaptativeWindow, AdaptativeWidget
main_view.create_about_list (ref artists, ref authors, ref
comments, ref copyright, ref documenters, ref logo_icon_name, ref program_name, ref translator_credits, ref
version, ref website, ref website_label);
}
+ private bool escape_action_enabled = false;
private inline void show_about_view ()
requires (in_window_about == false)
{
close_in_window_panels ();
+ escape_action_enabled = escape_action.enabled;
+ escape_action.set_enabled (true);
in_window_about = true;
headerbar.show_about_view ();
main_view.show_about_view ();
diff --git a/src/game-window.vala b/src/game-window.vala
index 73753ec..c234e12 100644
--- a/src/game-window.vala
+++ b/src/game-window.vala
@@ -147,6 +147,7 @@ private class GameWindow : BaseWindow, AdaptativeWidget
{
bool grabs_focus = headerbar.show_view (game_finished);
game_view.show_game_content (/* grab focus */ !grabs_focus);
+ escape_action.set_enabled (false);
}
/*\
@@ -289,6 +290,7 @@ private class GameWindow : BaseWindow, AdaptativeWidget
headerbar.new_game ();
back_action_disabled = false;
+ escape_action.set_enabled (true);
show_new_game_screen ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]