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




commit 2377d745621a50f225e1e4f9b0740730e1fb3ea5
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 165fc1fd6..e4dcceccb 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -108,6 +108,7 @@ struct _GsShell
        GtkWidget               *primary_menu;
        GtkWidget               *sub_page_header_title;
 
+       gboolean                 activate_after_setup;
        gboolean                 is_narrow;
        guint                    allocation_changed_cb_id;
 
@@ -166,6 +167,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->activate_after_setup = TRUE;
+               return;
+       }
+
        gtk_widget_show (GTK_WIDGET (shell));
        gtk_window_present (GTK_WINDOW (shell));
 }
@@ -2238,6 +2245,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->activate_after_setup) {
+               shell->activate_after_setup = FALSE;
+               gs_shell_activate (shell);
+       }
 }
 
 void


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