[gnome-software/wip/followup-for-m1355] gs-application: Change when withdraw possibly obsolete notifications



commit f5776a5bb2f5da9036638eae8983cb9aa3ce8de8
Author: Milan Crha <mcrha redhat com>
Date:   Mon May 30 10:04:23 2022 +0200

    gs-application: Change when withdraw possibly obsolete notifications
    
    Withdraw possibly obsolete notifications only after the app
    is registered on the D-Bus, otherwise a runtime warning is
    shown on the console:
    
    > GLib-GIO g_application_get_dbus_connection: assertion 'application->priv->is_registered' failed
    
    This is a follow up fix for https://gitlab.gnome.org/GNOME/gnome-software/-/merge_requests/1355

 src/gs-application.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)
---
diff --git a/src/gs-application.c b/src/gs-application.c
index 937d40c3f..ecc970680 100644
--- a/src/gs-application.c
+++ b/src/gs-application.c
@@ -151,18 +151,8 @@ gs_application_init (GsApplication *application)
                  _("Show version number"), NULL },
                { NULL }
        };
-       GApplication *gapp = G_APPLICATION (application);
 
-       g_application_add_main_option_entries (gapp, options);
-
-       /* Remove possibly obsolete notifications */
-       g_application_withdraw_notification (gapp, "installed");
-       g_application_withdraw_notification (gapp, "restart-required");
-       g_application_withdraw_notification (gapp, "updates-available");
-       g_application_withdraw_notification (gapp, "updates-installed");
-       g_application_withdraw_notification (gapp, "upgrades-available");
-       g_application_withdraw_notification (gapp, "offline-updates");
-       g_application_withdraw_notification (gapp, "eol");
+       g_application_add_main_option_entries (G_APPLICATION (application), options);
 }
 
 static gboolean
@@ -1144,6 +1134,15 @@ gs_application_handle_local_options (GApplication *app, GVariantDict *options)
                return 1;
        }
 
+       /* Remove possibly obsolete notifications */
+       g_application_withdraw_notification (app, "installed");
+       g_application_withdraw_notification (app, "restart-required");
+       g_application_withdraw_notification (app, "updates-available");
+       g_application_withdraw_notification (app, "updates-installed");
+       g_application_withdraw_notification (app, "upgrades-available");
+       g_application_withdraw_notification (app, "offline-updates");
+       g_application_withdraw_notification (app, "eol");
+
        if (g_variant_dict_contains (options, "autoupdate")) {
                g_action_group_activate_action (G_ACTION_GROUP (app),
                                                "autoupdate",


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