[iagno] Make options skip the new-game screen.



commit da69e0a07fceeb89198497dd58798bc2591d8093
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Wed Sep 24 23:28:36 2014 +0200

    Make options skip the new-game screen.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=664976

 src/iagno.vala |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/src/iagno.vala b/src/iagno.vala
index 1cc475e..f1afa6e 100644
--- a/src/iagno.vala
+++ b/src/iagno.vala
@@ -18,6 +18,7 @@ public class Iagno : Gtk.Application
     private static bool fast_mode;
     private static int computer_level = 0;
     private static int size = 8;
+    private static bool begin_with_new_game_screen = false;
 
     /* Seconds */
     private static const double QUICK_MOVE_DELAY = 0.4;
@@ -143,12 +144,14 @@ public class Iagno : Gtk.Application
         }
 
         /* The game mode is set for the next game. */
-        if (options.contains ("second"))
-            settings.set_string ("play-as", "second");
-        if (options.contains ("first"))
-            settings.set_string ("play-as", "first");
         if (options.contains ("two-players"))
             settings.set_string ("play-as", "two-players");
+        else if (options.contains ("first"))
+            settings.set_string ("play-as", "first");
+        else if (options.contains ("second"))
+            settings.set_string ("play-as", "second");
+        else
+            begin_with_new_game_screen = true;
 
         /* Activate */
         return -1;
@@ -197,7 +200,10 @@ public class Iagno : Gtk.Application
             level_box.sensitive = (mode == "two-players") ? false : true;
         });
 
-        show_new_game_screen ();
+        if (begin_with_new_game_screen)
+            show_new_game_screen ();
+        else
+            start_game ();
     }
 
     private void change_mode_cb (SimpleAction action, Variant? variant)


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