[gcalctool/gnome-2-30] Make --help-gtk work (Bug #615667)
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gcalctool/gnome-2-30] Make --help-gtk work (Bug #615667)
- Date: Wed, 14 Apr 2010 02:01:28 +0000 (UTC)
commit cbe1a6e7c77d0e0b20787bd357a017f5bec19de6
Author: Robert Ancell <robert ancell gmail com>
Date: Wed Apr 14 10:00:59 2010 +0800
Make --help-gtk work (Bug #615667)
NEWS | 2 ++
src/calctool.c | 29 ++++++++++++++++++-----------
2 files changed, 20 insertions(+), 11 deletions(-)
---
diff --git a/NEWS b/NEWS
index c5c2794..43525cc 100644
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,8 @@ Overview of changes in gcalctool 5.30.1
* Make inverses of variables work (Bug #614979)
+ * Make --help-gtk work (Bug #615667)
+
Overview of changes in gcalctool 5.30.0
* Fix errors in variable exponents (e.g. xy²)
diff --git a/src/calctool.c b/src/calctool.c
index 46b1070..051f395 100644
--- a/src/calctool.c
+++ b/src/calctool.c
@@ -72,7 +72,7 @@ solve(const char *equation)
}
static void
-usage(int show_gtk)
+usage(gboolean show_application, gboolean show_gtk)
{
fprintf(stderr,
/* Description on how to use gcalctool displayed on command-line */
@@ -106,15 +106,18 @@ usage(int show_gtk)
"\n\n");
}
- fprintf(stderr,
- /* Description on gcalctool application options displayed on command-line */
- _("Application Options:\n"
- " -u, --unittest Perform unit tests\n"
- " -s, --solve <equation> Solve the given equation"));
- fprintf(stderr,
- "\n\n");
+ if (show_application) {
+ fprintf(stderr,
+ /* Description on gcalctool application options displayed on command-line */
+ _("Application Options:\n"
+ " -u, --unittest Perform unit tests\n"
+ " -s, --solve <equation> Solve the given equation"));
+ fprintf(stderr,
+ "\n\n");
+ }
}
+
void
get_options(int argc, char *argv[])
{
@@ -132,11 +135,15 @@ get_options(int argc, char *argv[])
else if (strcmp(arg, "-h") == 0 ||
strcmp(arg, "-?") == 0 ||
strcmp(arg, "--help") == 0) {
- usage(FALSE);
+ usage(TRUE, FALSE);
exit(0);
}
else if (strcmp(arg, "--help-all") == 0) {
- usage(TRUE);
+ usage(TRUE, TRUE);
+ exit(0);
+ }
+ else if (strcmp(arg, "--help-gtk") == 0) {
+ usage(FALSE, TRUE);
exit(0);
}
else if (strcmp(arg, "-s") == 0 ||
@@ -161,7 +168,7 @@ get_options(int argc, char *argv[])
/* Error printed to stderr when user provides an unknown command-line argument */
_("Unknown argument '%s'"), arg);
fprintf(stderr, "\n");
- usage(FALSE);
+ usage(TRUE, FALSE);
exit(1);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]