[gnome-software/ramcq/loading: 7/8] Have shell go to LOADING state by itself



commit a7440c0a22099f732260dc8eb99de4c16b528542
Author: Robert McQueen <rob endlessm com>
Date:   Wed Oct 10 15:30:15 2018 +0100

    Have shell go to LOADING state by itself
    
    There isn't any reason to have the shell sit in the UNKNOWN state at setup and
    rely on the GsApplication to initialise it correctly. At the end of setup, have
    the shell start the initial refresh by itself.

 src/gs-application.c | 12 ++++--------
 src/gs-shell.c       |  3 +++
 2 files changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/src/gs-application.c b/src/gs-application.c
index b60f0381..d81f18be 100644
--- a/src/gs-application.c
+++ b/src/gs-application.c
@@ -277,16 +277,12 @@ gs_application_initialize_ui (GsApplication *app)
        app->shell = gs_shell_new ();
        app->cancellable = g_cancellable_new ();
 
+       app->shell_loaded_handler_id = g_signal_connect (app->shell, "loaded",
+                                                        G_CALLBACK (gs_application_shell_loaded_cb),
+                                                        app);
+
        gs_shell_setup (app->shell, app->plugin_loader, app->cancellable);
        gtk_application_add_window (GTK_APPLICATION (app), gs_shell_get_window (app->shell));
-
-        app->shell_loaded_handler_id = g_signal_connect (app->shell, "loaded",
-                                                         G_CALLBACK (gs_application_shell_loaded_cb),
-                                                         app);
-
-       /* it's very important to set the loading as the first mode because it will
-        * make the plugins load all their needed initial catalogs/information */
-       gs_shell_set_mode (app->shell, GS_SHELL_MODE_LOADING);
 }
 
 static void
diff --git a/src/gs-shell.c b/src/gs-shell.c
index 2c42b16e..4b313a06 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -2162,6 +2162,9 @@ gs_shell_setup (GsShell *shell, GsPluginLoader *plugin_loader, GCancellable *can
                signout_item = g_menu_item_new (signout_label, signout_target);
                g_menu_append_item (auth_menu, signout_item);
        }
+
+       /* show loading page, which triggers the initial refresh */
+       gs_shell_change_mode (shell, GS_SHELL_MODE_LOADING, NULL, TRUE);
 }
 
 void


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