[gnome-software/gnome-41: 1/2] gs-details-page: Reload the page only when the app is idle




commit bc0a371cebb8d60827a55dea891ee02e5eb67a7c
Author: Milan Crha <mcrha redhat com>
Date:   Wed Oct 27 11:49:55 2021 +0200

    gs-details-page: Reload the page only when the app is idle
    
    It doesn't look good when the user installs/removes an app from the details page
    and the page is reloading in the middle of the install/remove process. This can
    be seen for example with flatpaks, when the applications installs also its
    runtime. There are issued several reload requests, after each installed
    part of the app or the runtime (the runtime, the locale part, the app itself).
    
    The reload can lost track of the install progress too, when it gets a different
    app instance during the reload.
    
    Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1510

 src/gs-details-page.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/src/gs-details-page.c b/src/gs-details-page.c
index 9fa7b1848..56211ad33 100644
--- a/src/gs-details-page.c
+++ b/src/gs-details-page.c
@@ -1697,8 +1697,15 @@ static void
 gs_details_page_reload (GsPage *page)
 {
        GsDetailsPage *self = GS_DETAILS_PAGE (page);
-       if (self->app != NULL && gs_shell_get_mode (self->shell) == GS_SHELL_MODE_DETAILS)
+       if (self->app != NULL && gs_shell_get_mode (self->shell) == GS_SHELL_MODE_DETAILS) {
+               GsAppState state = gs_app_get_state (self->app);
+               /* Do not reload the page when the app is "doing something" */
+               if (state == GS_APP_STATE_INSTALLING ||
+                   state == GS_APP_STATE_REMOVING ||
+                   state == GS_APP_STATE_PURCHASING)
+                       return;
                gs_details_page_load_stage1 (self);
+       }
 }
 
 static gint


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