[gnome-software/741-allow-verbose-to-be-enabled-at-runtime] gs-application: Allow `--verbose` to be enabled at runtime



commit 98e8b09717093cdd874153987335e8c821f49efb
Author: Milan Crha <mcrha redhat com>
Date:   Thu Jan 20 10:33:25 2022 +0100

    gs-application: Allow `--verbose` to be enabled at runtime
    
    This passes the `--verbose` argument to the running process, enabling
    verbose debugging on the fly.
    
    Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/741

 src/gs-application.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
---
diff --git a/src/gs-application.c b/src/gs-application.c
index 188eeb385..c2d7d11dc 100644
--- a/src/gs-application.c
+++ b/src/gs-application.c
@@ -877,6 +877,15 @@ install_resources_activated (GSimpleAction *action,
        gs_shell_show_extras_search (app->shell, mode, resources, desktop_id, ident);
 }
 
+static void
+verbose_activated (GSimpleAction *action,
+                  GVariant      *parameter,
+                  gpointer       data)
+{
+       GsApplication *app = GS_APPLICATION (data);
+       gs_debug_set_verbose (app->debug, TRUE);
+}
+
 static GActionEntry actions[] = {
        { "about", about_activated, NULL, NULL, NULL },
        { "quit", quit_activated, NULL, NULL, NULL },
@@ -886,6 +895,7 @@ static GActionEntry actions[] = {
        { "launch", launch_activated, "(ss)", NULL, NULL },
        { "show-offline-update-error", show_offline_updates_error, NULL, NULL, NULL },
        { "autoupdate", autoupdate_activated, NULL, NULL, NULL },
+       { "verbose", verbose_activated, NULL, NULL, NULL },
        { "nop", NULL, NULL, NULL }
 };
 
@@ -1173,6 +1183,12 @@ gs_application_handle_local_options (GApplication *app, GVariantDict *options)
                return 0;
        }
 
+       if (g_variant_dict_contains (options, "verbose")) {
+               g_action_group_activate_action (G_ACTION_GROUP (app),
+                                               "verbose",
+                                               NULL);
+       }
+
        if (g_variant_dict_lookup (options, "mode", "&s", &mode)) {
                g_action_group_activate_action (G_ACTION_GROUP (app),
                                                "set-mode",


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