[gnome-software/wip/setup-shell-only-after-plugin-loader-is-setup: 294/295] gs-shell: Wait for plugin loader to setup, before showing the window




commit 122d0b46d863d9dbfc09c8f00acd144058099fbc
Author: Milan Crha <mcrha redhat com>
Date:   Wed May 25 12:05:51 2022 +0200

    gs-shell: Wait for plugin loader to setup, before showing the window
    
    This is needed, because otherwise there can be done plugin loader calls
    where the plugin loader may not be fully initialized, it can even not
    have loaded all the plugins yet.

 src/gs-shell.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
---
diff --git a/src/gs-shell.c b/src/gs-shell.c
index cebbdfd88..3105f68cd 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -109,6 +109,7 @@ struct _GsShell
        GtkWidget               *primary_menu;
        GtkWidget               *sub_page_header_title;
 
+       gboolean                 active_after_setup;
        gboolean                 is_narrow;
        guint                    allocation_changed_cb_id;
 
@@ -167,6 +168,12 @@ gs_shell_modal_dialog_present (GsShell *shell, GtkWindow *window)
 void
 gs_shell_activate (GsShell *shell)
 {
+       /* Waiting for plugin loader to setup first */
+       if (shell->plugin_loader == NULL) {
+               shell->active_after_setup = TRUE;
+               return;
+       }
+
        gtk_widget_show (GTK_WIDGET (shell));
        gtk_window_present (GTK_WINDOW (shell));
 }
@@ -2265,6 +2272,11 @@ gs_shell_setup (GsShell *shell, GsPluginLoader *plugin_loader, GCancellable *can
                if (g_settings_get_boolean (shell->settings, "first-run"))
                        g_settings_set_boolean (shell->settings, "first-run", FALSE);
        }
+
+       if (shell->active_after_setup) {
+               shell->active_after_setup = FALSE;
+               gs_shell_activate (shell);
+       }
 }
 
 void


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