diff --git a/src/spek.vala b/src/spek.vala index 8d1c4b0..f426691 100644 --- a/src/spek.vala +++ b/src/spek.vala @@ -18,12 +18,32 @@ using Spek; +bool version = false; +// TODO: move into main() when bgo#530623 is fixed. +const OptionEntry[] options = { + { "version", 'V', 0, OptionArg.NONE, &version, N_("Display the version and exit"), null }, + { null } +}; + int main (string[] args) { Intl.bindtextdomain (Config.GETTEXT_PACKAGE, Config.LOCALEDIR); Intl.bind_textdomain_codeset (Config.GETTEXT_PACKAGE, "UTF-8"); Intl.textdomain (Config.GETTEXT_PACKAGE); - Gtk.init (ref args); + try { + Gtk.init_with_args (ref args, _("[FILE]"), (OptionEntry[]) options, Config.GETTEXT_PACKAGE); + } catch (Error e) { + print (e.message); + print ("\n"); + print (_("Run `%s --help` to see a full list of available command line options.\n"), args[0]); + return 1; + } + + if (version) { + print (_("%s version %s\n"), Config.PACKAGE_NAME, Config.PACKAGE_VERSION); + return 0; + } + Gst.init (ref args); var window = new Window (); Gtk.main ();