[gnome-software/1414-software-recommends-a-reboot-even-if-fwupd-fails] gs-updates-section: Propagate error for "Update All" update



commit 82a99de97e743e10685214c7d725650afa1666ef
Author: Milan Crha <mcrha redhat com>
Date:   Tue Sep 14 14:03:33 2021 +0200

    gs-updates-section: Propagate error for "Update All" update
    
    That helps to identify whether the update truly succeeded, to not
    offer a machine reboot on a failure.
    
    Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1414

 src/gs-updates-section.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-updates-section.c b/src/gs-updates-section.c
index fa050513d..3913490eb 100644
--- a/src/gs-updates-section.c
+++ b/src/gs-updates-section.c
@@ -345,8 +345,20 @@ _perform_update_cb (GsPluginLoader *plugin_loader, GAsyncResult *res, gpointer u
 
        /* get the results */
        if (!gs_plugin_loader_job_action_finish (plugin_loader, res, &error)) {
-               if (!g_error_matches (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_CANCELLED))
-                       g_warning ("failed to perform update: %s", error->message);
+               if (!g_error_matches (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_CANCELLED) &&
+                   !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+                       GsApp *app = NULL;
+
+                       if (gs_app_list_length (self->list) == 1)
+                               app = gs_app_list_index (self->list, 0);
+
+                       gs_plugin_loader_claim_error (plugin_loader,
+                                                     NULL,
+                                                     GS_PLUGIN_ACTION_UPDATE,
+                                                     app,
+                                                     TRUE,
+                                                     error);
+               }
                goto out;
        }
 
@@ -441,6 +453,7 @@ _button_update_all_clicked_cb (GsUpdatesSection *self)
        plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_UPDATE,
                                         "list", self->list,
                                         "interactive", TRUE,
+                                        "propagate-error", TRUE,
                                         NULL);
        gs_plugin_loader_job_process_async (self->plugin_loader, plugin_job,
                                            self->cancellable,


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