[gnome-software/gnome-3-22] Initialize progress to zero right before and after processing and action



commit 35620109e08c82fd962548e8a8b6572951f5790c
Author: Mario Sanchez Prada <mario endlessm com>
Date:   Thu Feb 23 14:35:52 2017 +0000

    Initialize progress to zero right before and after processing and action
    
    This will make sure that, even after a successful installation, the
    progress bar is reset to zero, to prevent confusion in the unlikely
    event of the user going for a install + uninstall + reinstall process.

 src/gs-plugin-loader.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index e0ceffe..a65087a 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -1025,6 +1025,9 @@ gs_plugin_loader_run_action (GsPluginLoader *plugin_loader,
        gboolean ret;
        guint i;
 
+       /* make sure the progress is properly initialized */
+       gs_app_set_progress (app, 0);
+
        /* run each plugin */
        for (i = 0; i < priv->plugins->len; i++) {
                GsPluginActionFunc plugin_func = NULL;
@@ -2829,6 +2832,9 @@ gs_plugin_loader_app_action_thread_cb (GTask *task,
                                           cancellable,
                                           &error);
        if (ret) {
+               /* reset the progress after successful operations */
+               gs_app_set_progress (state->app, 0);
+
                /* unstage addons */
                addons = gs_app_get_addons (state->app);
                for (i = 0; i < addons->len; i++) {


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