[gnome-taquin] Sync code with Reversi.



commit 94547e4846d63e510345a08973478aae316e3a92
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Wed Feb 12 12:55:02 2020 +0100

    Sync code with Reversi.

 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 b515552..0fa6b9e 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 105e6af..eedbebc 100644
--- a/src/game-window.vala
+++ b/src/game-window.vala
@@ -164,6 +164,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);
     }
 
     /*\
@@ -332,6 +333,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]