[gcalctool] Make --help-gtk work (Bug #615667)



commit 3c8c0750beba1e34f0b65ad9173a92dcc56454ac
Author: Robert Ancell <robert ancell gmail com>
Date:   Wed Apr 14 09:58:15 2010 +0800

    Make --help-gtk work (Bug #615667)

 src/calctool.c |   28 +++++++++++++++++-----------
 1 files changed, 17 insertions(+), 11 deletions(-)
---
diff --git a/src/calctool.c b/src/calctool.c
index 3d50c0f..4f3b3d1 100644
--- a/src/calctool.c
+++ b/src/calctool.c
@@ -71,7 +71,7 @@ solve(const char *equation)
 
 
 static void
-usage(const gchar *progname, int show_gtk)
+usage(const gchar *progname, gboolean show_application, gboolean show_gtk)
 {
     fprintf(stderr,
             /* Description on how to use gcalctool displayed on command-line */
@@ -105,13 +105,15 @@ usage(const gchar *progname, 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");
+    }
 }
 
 
@@ -134,11 +136,15 @@ get_options(int argc, char *argv[])
         else if (strcmp(arg, "-h") == 0 ||
                  strcmp(arg, "-?") == 0 ||
                  strcmp(arg, "--help") == 0) {
-            usage(progname, FALSE);
+            usage(progname, TRUE, FALSE);
             exit(0);
         }
         else if (strcmp(arg, "--help-all") == 0) {
-            usage(progname, TRUE);
+            usage(progname, TRUE, TRUE);
+            exit(0);
+        }
+        else if (strcmp(arg, "--help-gtk") == 0) {
+            usage(progname, FALSE, TRUE);
             exit(0);
         }
         else if (strcmp(arg, "-s") == 0 ||
@@ -163,7 +169,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(progname, FALSE);
+            usage(progname, TRUE, FALSE);
             exit(1);
         }
     }



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