[gnome-mines] Partially revert "Remove repeat size"



commit 5bbc22ecdf48a85e68ffc901a97531732162a985
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Sat Feb 8 20:12:59 2014 -0600

    Partially revert "Remove repeat size"
    
    This reverts commit 3ce764452dd67bace2319f3d49e592c4a38b3f81.
    
    However, we are not going to include this in the app menu. It'll be a
    hidden shortcut until we implement the final design.
    
    Conflicts:
        src/gnome-mines.vala
    
    https://bugzilla.gnome.org/show_bug.cgi?id=722450

 src/gnome-mines.vala |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/src/gnome-mines.vala b/src/gnome-mines.vala
index 1a7cf60..dec3069 100644
--- a/src/gnome-mines.vala
+++ b/src/gnome-mines.vala
@@ -60,6 +60,7 @@ public class Mines : Gtk.Application
     private Gtk.SpinButton n_mines_spin;
     private Gtk.SpinButton p_mines_spin;
     private SimpleAction new_game_action;
+    private SimpleAction repeat_size_action;
     private SimpleAction pause_action;
     private SimpleAction hint_action;
     private Gtk.AspectFrame new_game_screen;
@@ -69,6 +70,7 @@ public class Mines : Gtk.Application
     private const GLib.ActionEntry[] action_entries =
     {
         { "new-game",      new_game_cb                                            },
+        { "repeat-size",   repeat_size_cb                                         },
         { "hint",          hint_cb                                                },
         { "pause",         toggle_pause_cb                                        },
         { "scores",        scores_cb                                              },
@@ -96,6 +98,8 @@ public class Mines : Gtk.Application
         add_action_entries (action_entries, this);
         new_game_action = lookup_action ("new-game") as SimpleAction;
         new_game_action.set_enabled (false);
+        repeat_size_action = lookup_action ("repeat-size") as SimpleAction;
+        repeat_size_action.set_enabled (false);
         hint_action = lookup_action ("hint") as SimpleAction;
         hint_action.set_enabled (false);
         pause_action = lookup_action ("pause") as SimpleAction;
@@ -115,6 +119,7 @@ public class Mines : Gtk.Application
         set_app_menu (menu);
 
         add_accelerator ("<Primary>n", "app.new-game", null);
+        add_accelerator ("<Primary>r", "app.repeat-size", null);
         add_accelerator ("Pause", "app.pause", null);
         add_accelerator ("F1", "app.help", null);
         add_accelerator ("<Primary>w", "app.quit", null);
@@ -486,6 +491,7 @@ public class Mines : Gtk.Application
         play_pause_image.icon_name = "view-refresh-symbolic";
 
         new_game_action.set_enabled (false);
+        repeat_size_action.set_enabled (false);
         hint_action.set_enabled (false);
         pause_action.set_enabled (false);
         buttons_box.hide ();
@@ -544,6 +550,7 @@ public class Mines : Gtk.Application
         update_flag_label ();
 
         new_game_action.set_enabled (true);
+        repeat_size_action.set_enabled (true);
         pause_action.set_enabled (true);
         hint_action.set_enabled (true);
 
@@ -562,6 +569,12 @@ public class Mines : Gtk.Application
             show_new_game_screen ();
     }
 
+    private void repeat_size_cb ()
+    {
+        if (can_start_new_game ())
+            start_game ();
+    }
+
     private void toggle_pause_cb ()
     {
         if (minefield.paused && !pause_requested)


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