[geary/wip/gtk-args-722463] Fix up command line arg handling, remove gtk args
- From: Charles Lindsay <clindsay src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/gtk-args-722463] Fix up command line arg handling, remove gtk args
- Date: Tue, 28 Jan 2014 22:29:34 +0000 (UTC)
commit 454ade128b8efa6fe0fea57fc78d71a7b1ea9497
Author: Charles Lindsay <chaz yorba org>
Date: Tue Jan 28 14:28:26 2014 -0800
Fix up command line arg handling, remove gtk args
src/client/application/geary-application.vala | 5 ++++-
src/client/application/geary-args.vala | 16 +++++++---------
2 files changed, 11 insertions(+), 10 deletions(-)
---
diff --git a/src/client/application/geary-application.vala b/src/client/application/geary-application.vala
index c1acbf6..d355aa1 100644
--- a/src/client/application/geary-application.vala
+++ b/src/client/application/geary-application.vala
@@ -105,7 +105,10 @@ public class GearyApplication : Gtk.Application {
error("Error registering GearyApplication: %s", e.message);
}
- Args.parse(args);
+ if (!Args.parse(args)) {
+ exit_status = 1;
+ return true;
+ }
activate();
foreach (unowned string arg in args) {
diff --git a/src/client/application/geary-args.vala b/src/client/application/geary-args.vala
index 53eeaa0..b172b0f 100644
--- a/src/client/application/geary-args.vala
+++ b/src/client/application/geary-args.vala
@@ -38,11 +38,10 @@ public bool log_folder_normalization = false;
public bool inspector = false;
public bool version = false;
-public int parse(string[] args) {
+public bool parse(string[] args) {
var context = new OptionContext("");
context.set_help_enabled(true);
context.add_main_entries(options, null);
- context.add_group(Gtk.get_option_group(false));
context.set_description("%s\n\n%s\n\t%s\n".printf(
GearyApplication.COPYRIGHT, _("Please report comments, suggestions and bugs to:"),
GearyApplication.BUGREPORT));
@@ -52,8 +51,8 @@ public int parse(string[] args) {
} catch (OptionError error) {
// i18n: Command line arguments are invalid
stdout.printf (_("Failed to parse command line options: %s\n"), error.message);
- stdout.printf("\n%s", context.get_help(true, Gtk.get_option_group(false)));
- return 1;
+ stdout.printf("\n%s", context.get_help(true, null));
+ return false;
}
// other than the OptionEntry command-line arguments, the only acceptable arguments are
@@ -63,16 +62,15 @@ public int parse(string[] args) {
if (!arg.has_prefix(Geary.ComposedEmail.MAILTO_SCHEME)) {
stdout.printf(_("Unrecognized command line option \"%s\"\n").printf(arg));
- stdout.printf("\n%s", context.get_help(true, Gtk.get_option_group(false)));
+ stdout.printf("\n%s", context.get_help(true, null));
- return 1;
+ return false;
}
}
if (version) {
stdout.printf("%s %s\n", GearyApplication.PRGNAME, GearyApplication.VERSION);
-
- return 1;
+ Process.exit(0);
}
if (log_network)
@@ -102,7 +100,7 @@ public int parse(string[] args) {
if (log_debug)
Geary.Logging.log_to(stdout);
- return 0;
+ return true;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]