[gnome-mines] Disable size accels on the custom game screen (bgo#766145)



commit 2af3c41d4c2f4abc00d2b3db1fa6f6e40a62090f
Author: Robert Roth <robert roth off gmail com>
Date:   Sun Jun 12 21:27:44 2016 +0300

    Disable size accels on the custom game screen (bgo#766145)
    
    https://bugzilla.gnome.org/show_bug.cgi?id=766145

 src/gnome-mines.vala |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/src/gnome-mines.vala b/src/gnome-mines.vala
index 5e4d951..ddc1dee 100644
--- a/src/gnome-mines.vala
+++ b/src/gnome-mines.vala
@@ -79,6 +79,7 @@ public class Mines : Gtk.Application
     private SimpleAction new_game_action;
     private SimpleAction repeat_size_action;
     private SimpleAction pause_action;
+    private SimpleAction[] size_actions = new SimpleAction[4];
     private Gtk.AspectFrame new_game_screen;
     private Gtk.AspectFrame custom_game_screen;
     private Gtk.CssProvider theme_provider;
@@ -205,6 +206,12 @@ public class Mines : Gtk.Application
         repeat_size_action.set_enabled (false);
         pause_action = lookup_action ("pause") as SimpleAction;
         pause_action.set_enabled (false);
+
+        size_actions[0] = lookup_action ("small-size") as SimpleAction;
+        size_actions[1] = lookup_action ("medium-size") as SimpleAction;
+        size_actions[2] = lookup_action ("large-size") as SimpleAction;
+        size_actions[3] = lookup_action ("custom-size") as SimpleAction;
+
         add_action (settings.create_action (KEY_USE_OVERMINE_WARNING));
         add_action (settings.create_action (KEY_USE_QUESTION_MARKS));
 
@@ -583,7 +590,7 @@ public class Mines : Gtk.Application
     {
         if (minefield != null)
             return;
-
+        size_actions_toggle (false);
         stack.visible_child_name = "custom_game";
     }
 
@@ -628,9 +635,18 @@ public class Mines : Gtk.Application
         repeat_size_action.set_enabled (false);
         pause_action.set_enabled (false);
 
+        size_actions_toggle (true);
         stack.visible_child_name = "new_game";
     }
 
+    private void size_actions_toggle (bool enabled)
+    {
+        for (int i=0; i < size_actions.length; i++)
+        {
+            size_actions[i].set_enabled (enabled);
+        }
+    }
+
     private void start_game ()
     {
         window_skip_configure = true;
@@ -916,6 +932,7 @@ public class Mines : Gtk.Application
         if (mode != settings.get_int (KEY_MODE))
             settings.set_int (KEY_MODE, mode);
 
+        size_actions_toggle (false);
         start_game ();
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]