[iagno] Add --version command line argument



commit 3c09aa4c027ebc813459f9414a879200ff9ecb90
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Sat Jan 25 12:53:11 2014 -0600

    Add --version command line argument

 src/iagno.vala |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/iagno.vala b/src/iagno.vala
index d071494..b0d0faf 100644
--- a/src/iagno.vala
+++ b/src/iagno.vala
@@ -16,6 +16,7 @@ public class Iagno : Gtk.Application
     private bool is_fullscreen;
     private bool is_maximized;
     private static bool fast_mode;
+    private static bool show_version;
 
     /* Widgets */
     private Gtk.Window window;
@@ -157,8 +158,6 @@ public class Iagno : Gtk.Application
         var image = new Gtk.Image.from_icon_name ("view-refresh-symbolic", Gtk.IconSize.DIALOG);
         image.show ();
         new_game_button.add (image);
-        new_game_button.valign = Gtk.Align.END;
-        new_game_button.halign = Gtk.Align.CENTER;
         new_game_button.relief = Gtk.ReliefStyle.NONE;
         new_game_button.action_name = "app.new-game";
         side_box.pack_end (new_game_button, false, true, 10);
@@ -632,6 +631,9 @@ public class Iagno : Gtk.Application
         { "fast-mode", 'f', 0, OptionArg.NONE, ref fast_mode,
           /* Help string for command line --fast-mode flag */
           N_("Disable delay before AI moves"), null},
+        { "version", 'v', 0, OptionArg.NONE, ref show_version,
+          /* Help string for command line --version flag */
+          N_("Show release version"), null},
         { null }
     };
 
@@ -656,6 +658,13 @@ public class Iagno : Gtk.Application
             return Posix.EXIT_FAILURE;
         }
 
+        if (show_version)
+        {
+            /* Note, not translated so can be easily parsed */
+            stderr.printf ("iagno %s\n", VERSION);
+            return Posix.EXIT_SUCCESS;
+        }
+
         Environment.set_application_name (_("Iagno"));
 
         Gtk.Window.set_default_icon_name ("iagno");


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