[gnome-software/1266-indeterminate-progress-bar-for-os-updates] packagekit: Report overall progress when downloading package updates



commit 6e22b39ae340dda27c398d37721c2abea1578fef
Author: Milan Crha <mcrha redhat com>
Date:   Wed Oct 13 15:53:17 2021 +0200

    packagekit: Report overall progress when downloading package updates
    
    The PackageKit reports an overall progress, not a per-package progress, when
    downloading updates, thus pass this to the caller, to have a GUI feedback on
    the update download progress.
    
    Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1266

 plugins/packagekit/gs-plugin-packagekit-refresh.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/plugins/packagekit/gs-plugin-packagekit-refresh.c 
b/plugins/packagekit/gs-plugin-packagekit-refresh.c
index c76450625..513b52169 100644
--- a/plugins/packagekit/gs-plugin-packagekit-refresh.c
+++ b/plugins/packagekit/gs-plugin-packagekit-refresh.c
@@ -71,6 +71,7 @@ gs_plugin_packagekit_refresh_finalize (GObject *object)
 static gboolean
 _download_only (GsPluginPackagekitRefresh  *self,
                 GsAppList                  *list,
+               GsAppList                  *progress_list,
                 GCancellable               *cancellable,
                 GError                    **error)
 {
@@ -109,6 +110,7 @@ _download_only (GsPluginPackagekitRefresh  *self,
                GsApp *app = gs_app_list_index (list, i);
                gs_packagekit_helper_add_app (helper, app);
        }
+       gs_packagekit_helper_set_progress_list (helper, progress_list);
        g_mutex_lock (&self->task_mutex);
        /* never refresh the metadata here as this can surprise the frontend if
         * we end up downloading a different set of packages than what was
@@ -121,6 +123,7 @@ _download_only (GsPluginPackagekitRefresh  *self,
                                                 gs_packagekit_helper_cb, helper,
                                                 error);
        g_mutex_unlock (&self->task_mutex);
+       gs_app_list_override_progress (progress_list, GS_APP_PROGRESS_UNKNOWN);
        if (results2 == NULL) {
                gs_plugin_packagekit_error_convert (error);
                return FALSE;
@@ -151,8 +154,8 @@ gs_plugin_download (GsPlugin *plugin,
                GsAppList *related = gs_app_get_related (app);
 
                /* add this app */
-               if (!gs_app_has_quirk (app, GS_APP_QUIRK_IS_PROXY))
-                       if (g_strcmp0 (gs_app_get_management_plugin (app), "packagekit") == 0) {
+               if (!gs_app_has_quirk (app, GS_APP_QUIRK_IS_PROXY)) {
+                       if (g_strcmp0 (gs_app_get_management_plugin (app), "packagekit") == 0)
                                gs_app_list_add (list_tmp, app);
                        continue;
                }
@@ -176,7 +179,7 @@ gs_plugin_download (GsPlugin *plugin,
                }
        }
 
-       retval = _download_only (self, list_tmp, cancellable, error);
+       retval = _download_only (self, list_tmp, list, cancellable, error);
 
        if (!gs_metered_remove_from_download_scheduler (schedule_entry_handle, NULL, &error_local))
                g_warning ("Failed to remove schedule entry: %s", error_local->message);


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