[gnome-software/wip/jrocha/fix-startup: 1/6] Set the loading state when initializing the UI



commit 3c6bb0d387de0e786a11e783722cd7b4fc0eba94
Author: Joaquim Rocha <jrocha endlessm com>
Date:   Mon Oct 16 17:22:33 2017 +0200

    Set the loading state when initializing the UI
    
    The loading-state is necessary to make sure that plugins are correctly
    refreshed when GNOME Software is launched, as it is in refresh time that
    usually plugins load their app catalogs and other resources needed
    during their regular use.
    However, currently only the normal activation (on CLI options) of the
    GNOME Software is calling this loading-state. As a result, options
    like --details and --install are not working.
    
    To fix that, these changes move the call for the loading-state to the
    function that intializes the UI. Since all of the CLI options initialize
    the UI, then we make sure that the loading-state is called for every
    option.

 src/gs-application.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/gs-application.c b/src/gs-application.c
index 264443e..0ebb52f 100644
--- a/src/gs-application.c
+++ b/src/gs-application.c
@@ -251,6 +251,10 @@ gs_application_initialize_ui (GsApplication *app)
 
        gs_shell_setup (app->shell, app->plugin_loader, app->cancellable);
        gtk_application_add_window (GTK_APPLICATION (app), gs_shell_get_window (app->shell));
+
+       /* 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
@@ -808,14 +812,12 @@ gs_application_activate (GApplication *application)
        gs_application_initialize_ui (GS_APPLICATION (application));
 
        /* start metadata loading screen */
-       if (gs_shell_get_mode (app->shell) == GS_SHELL_MODE_UNKNOWN) {
+       if (gs_shell_get_mode (app->shell) == GS_SHELL_MODE_LOADING)
                g_signal_connect (app->shell, "loaded",
                                  G_CALLBACK (gs_application_shell_loaded_cb),
                                  app);
-               gs_shell_set_mode (app->shell, GS_SHELL_MODE_LOADING);
-       } else {
+       else
                gs_shell_set_mode (app->shell, GS_SHELL_MODE_OVERVIEW);
-       }
 
        gs_shell_activate (GS_APPLICATION (application)->shell);
 


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