[gnome-software/1510-after-installing-flatpak-launching-it-from-inside-gnome-software-opens-it-with-generic] gs-details-page: Reload the page only when the app is idle



commit d7e4b6b02b16cd0f3dbb2f07f1836dfe84ab852f
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 e0a7ad2b5..5bdaaaf2c 100644
--- a/src/gs-details-page.c
+++ b/src/gs-details-page.c
@@ -1688,8 +1688,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]