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



commit f76a84d729589d1b8c854f7479268f093e88ccd8
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 db449a9b0..796d7b05a 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -107,6 +107,7 @@ struct _GsShell
        GtkWidget               *primary_menu;
        GtkWidget               *sub_page_header_title;
 
+       gboolean                 active_after_setup;
        gboolean                 is_narrow;
        guint                    allocation_changed_cb_id;
 
@@ -165,6 +166,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));
 }
@@ -2237,6 +2244,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]