Parse command line options, print version info

This commit is contained in:
Alexander Kojevnikov 2010-05-17 17:10:29 +10:00
parent 3b48f7cbe2
commit c32bcadde1

View File

@ -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 ();