[gnome-software/1288-moderate-page-is-being-loaded-when-not-needed] gs-shell: First change page, then switch the deck, to avoid unneeded page load



commit 2fe0be3037205abc6f18e034fb9f77ea977fae59
Author: Milan Crha <mcrha redhat com>
Date:   Tue Jun 29 11:18:44 2021 +0200

    gs-shell: First change page, then switch the deck, to avoid unneeded page load
    
    When the deck is changed first, the notification about changed visibility of the page
    is received and the page load is done, but it's the previously selected page, not
    the page to be selected a tick later.
    
    Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1288

 src/gs-shell.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-shell.c b/src/gs-shell.c
index c7ffe7f25..15d06a5b6 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -615,9 +615,11 @@ gs_shell_change_mode (GsShell *shell,
        } else {
                hdy_deck_set_visible_child_name (shell->details_deck, "main");
                /* We only change the main deck when not reaching the details
-                * page to preserve the navigation history in the UI's state. */
-               hdy_deck_set_visible_child_name (shell->main_deck, mode_is_main ? "main" : "sub");
+                * page to preserve the navigation history in the UI's state.
+                * First change the page, then the deck, to avoid load of
+                * the previously shown page, which will be changed shortly after. */
                gtk_stack_set_visible_child_name (mode_is_main ? shell->stack_main : shell->stack_sub, 
page_name[mode]);
+               hdy_deck_set_visible_child_name (shell->main_deck, mode_is_main ? "main" : "sub");
        }
 
        /* do any mode-specific actions */


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