[gnome-boxes/override-help-cmdline-argument: 2/2] app: Override "--help" command line argument




commit 60d76d345a36f94738a75145dbefb2bff3955f9a
Author: Felipe Borges <felipeborges gnome org>
Date:   Thu Apr 29 16:45:46 2021 +0200

    app: Override "--help" command line argument
    
    For some reason the default handling of the --help argument in
    GApplication will call "exit" in all the running instances of
    the application.
    
    By handling the --help argument ourselves we manage to get the
    desired behavior.
    
    Fixes #394
    Fixes #689

 src/app.vala | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/src/app.vala b/src/app.vala
index 9aa74332..aed7b6d0 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -187,6 +187,7 @@ public override void activate () {
     static string[] opt_search;
     const OptionEntry[] options = {
         { "version", 0, 0, OptionArg.NONE, null, N_("Display version number"), null },
+        { "help", 'h', 0, OptionArg.NONE, ref opt_help, N_("Show help"), null },
         { "full-screen", 'f', 0, OptionArg.NONE, ref opt_fullscreen, N_("Open in full screen"), null },
         { "checks", 0, 0, OptionArg.NONE, null, N_("Check virtualization capabilities"), null },
         { "open-uuid", 0, 0, OptionArg.STRING, ref opt_open_uuid, N_("Open box with UUID"), null },
@@ -209,7 +210,7 @@ public override int command_line (GLib.ApplicationCommandLine cmdline) {
         opt_context.add_group (Spice.get_option_group ());
         opt_context.add_group (Vnc.Display.get_option_group ());
         opt_context.add_group (Gtk.get_option_group (true));
-        opt_context.set_help_enabled (true);
+        opt_context.set_help_enabled (false);
 
         try {
             string[] args1 = cmdline.get_arguments();


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