[gnome-tetravex] Add --paused command-line option.



commit 299509ec862779308e573182937d510774b5a838
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Mon Jul 14 02:33:45 2014 +0200

    Add --paused command-line option.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=733126

 src/gnome-tetravex.vala |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/gnome-tetravex.vala b/src/gnome-tetravex.vala
index cfef006..9f18da5 100644
--- a/src/gnome-tetravex.vala
+++ b/src/gnome-tetravex.vala
@@ -13,6 +13,8 @@ public class Tetravex : Gtk.Application
 {
     private const string KEY_GRID_SIZE = "grid-size";
 
+    private static bool start_paused = false;
+
     private Settings settings;
 
     private Puzzle puzzle;
@@ -32,6 +34,7 @@ public class Tetravex : Gtk.Application
     private const OptionEntry[] option_entries =
     {
         { "version", 'v', 0, OptionArg.NONE, null, N_("Print release version and exit"), null },
+        { "paused", 'p', 0, OptionArg.NONE, null, N_("Start the game paused"), null },
         { null }
     };
 
@@ -231,6 +234,9 @@ public class Tetravex : Gtk.Application
             return Posix.EXIT_SUCCESS;
         }
 
+        if (options.contains ("paused"))
+            start_paused = true;
+
         /* Activate */
         return -1;
     }
@@ -257,6 +263,11 @@ public class Tetravex : Gtk.Application
         view.puzzle = puzzle;
         tick_cb ();
 
+        if (start_paused)
+        {
+            puzzle.paused = true;
+            start_paused = false;
+        }
         update_button_states ();
     }
 


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