[gnome-menus] [editor] Add --help and --version arguments



commit fecc2847cf75048a6fe41c7423ac1e705a32b12b
Author: Vincent Untz <vuntz gnome org>
Date:   Sun Jun 21 01:09:40 2009 +0200

    [editor] Add --help and --version arguments
    
    http://bugzilla.gnome.org/show_bug.cgi?id=552989

 simple-editor/GMenuSimpleEditor/main.py |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/simple-editor/GMenuSimpleEditor/main.py b/simple-editor/GMenuSimpleEditor/main.py
index 45b5e47..6cdb91d 100644
--- a/simple-editor/GMenuSimpleEditor/main.py
+++ b/simple-editor/GMenuSimpleEditor/main.py
@@ -22,6 +22,9 @@ def main (args):
 
     import pygtk; pygtk.require('2.0');
 
+    import gobject
+    from gobject.option import OptionParser, make_option
+
     import gtk
     import gtk.glade
 
@@ -32,6 +35,19 @@ def main (args):
     gettext.install (config.PACKAGE, config.LOCALEDIR)
     gtk.glade.bindtextdomain (config.PACKAGE, config.LOCALEDIR)
 
-    dialog = maindialog.MenuEditorDialog (args)
+    parser = OptionParser (
+            option_list = [
+		    # FIXME: remove this when we can get all the default
+		    # options
+                    make_option ("--version",
+                                 action="store_true",
+                                 dest="version",
+                                 help=config.VERSION),
+                ])
+    parser.parse_args (args)
 
-    gtk.main ()
+    if parser.values.version:
+        print _("Simple Menu Editor %s") % (config.VERSION)
+    else:
+        dialog = maindialog.MenuEditorDialog (args)
+        gtk.main ()



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