[gnome-software: 1/2] gs-details-page: Don’t show the origin box if not on the details page




commit d8ea80e0f3fe23faab239ded5515366c1694c4ae
Author: Philip Withnall <pwithnall endlessos org>
Date:   Sun Nov 22 22:28:55 2020 +0000

    gs-details-page: Don’t show the origin box if not on the details page
    
    The different repos an app can be installed from are loaded
    asynchronously, but the widget for them (the origin box) is in a global
    header bar. That means it’s possible for the asynchronous load to
    complete after the user has switched away from the app details page, but
    for the origin box to then still be shown.
    
    Fix that by only showing the origin box if the details page is still
    active when the asynchronous load completes.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>
    
    Fixes: #988

 src/gs-details-page.c | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/src/gs-details-page.c b/src/gs-details-page.c
index 097d7abf..53c17599 100644
--- a/src/gs-details-page.c
+++ b/src/gs-details-page.c
@@ -841,6 +841,12 @@ gs_details_page_get_alternates_cb (GObject *source_object,
 
        gs_container_remove_all (GTK_CONTAINER (origin_popover_list_box));
 
+       /* Did we switch away from the page in the meantime? */
+       if (!gs_page_is_active (GS_PAGE (self))) {
+               gtk_widget_hide (origin_box);
+               return;
+       }
+
        list = gs_plugin_loader_job_process_finish (plugin_loader,
                                                    res,
                                                    &error);


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