[gnome-software/ramcq/loading: 2/4] Have shell advance from LOADING to OVERVIEW by itself



commit 5c8d077006598e27b1ddd40f9911f9e6b8a26db3
Author: Robert McQueen <rob endlessm com>
Date:   Wed Oct 10 15:26:27 2018 +0100

    Have shell advance from LOADING to OVERVIEW by itself
    
    Have the shell leave the LOADING state by itself once the refresh is completed,
    avoiding confusing coupling between GsApplication and GsShell. This is done
    conditionally, after the "loaded" signal emission so that if GsApplication has
    a queued mode change (from --mode=...) this is respected and un-necessary mode
    changes are avoided.

 src/gs-application.c | 2 +-
 src/gs-shell.c       | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/src/gs-application.c b/src/gs-application.c
index 771015ff..b60f0381 100644
--- a/src/gs-application.c
+++ b/src/gs-application.c
@@ -247,7 +247,7 @@ theme_changed (GtkSettings *settings, GParamSpec *pspec, GsApplication *app)
 static void
 gs_application_shell_loaded_cb (GsShell *shell, GsApplication *app)
 {
-       gs_shell_set_mode (app->shell, GS_SHELL_MODE_OVERVIEW);
+       g_signal_handler_disconnect (app->shell, app->shell_loaded_handler_id);
        app->shell_loaded_handler_id = 0;
 }
 
diff --git a/src/gs-shell.c b/src/gs-shell.c
index 977417e6..7a23f51e 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -552,6 +552,10 @@ initial_overview_load_done (GsOverviewPage *overview_page, gpointer data)
        gs_page_reload (page);
 
        g_signal_emit (shell, signals[SIGNAL_LOADED], 0);
+
+       /* go to OVERVIEW, unless the "loading" callbacks changed mode already */
+       if (priv->mode == GS_SHELL_MODE_LOADING)
+               gs_shell_change_mode (shell, GS_SHELL_MODE_OVERVIEW, NULL, TRUE);
 }
 
 static gboolean


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