[gnome-software/gnome-3-30] flatpak: trivial: Move state restoring to new gs_flatpak_transaction_run
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/gnome-3-30] flatpak: trivial: Move state restoring to new gs_flatpak_transaction_run
- Date: Thu, 4 Oct 2018 15:10:39 +0000 (UTC)
commit 4b0787eaf50b627dcddb62bae7c1038401db2f2e
Author: Kalev Lember <klember redhat com>
Date: Thu Oct 4 09:49:54 2018 +0200
flatpak: trivial: Move state restoring to new gs_flatpak_transaction_run
As the state restoring isn't just about one operation but all apps in
the transaction, it fits better in the new gs_flatpak_transaction than
in operation_error().
plugins/flatpak/gs-flatpak-transaction.c | 30 +++++++++++++-----------------
1 file changed, 13 insertions(+), 17 deletions(-)
---
diff --git a/plugins/flatpak/gs-flatpak-transaction.c b/plugins/flatpak/gs-flatpak-transaction.c
index e296fc87..2b78a331 100644
--- a/plugins/flatpak/gs-flatpak-transaction.c
+++ b/plugins/flatpak/gs-flatpak-transaction.c
@@ -119,6 +119,19 @@ gs_flatpak_transaction_run (FlatpakTransaction *transaction,
g_autoptr(GError) error_local = NULL;
if (!flatpak_transaction_run (transaction, cancellable, &error_local)) {
+ /* whole transaction failed; restore the state for all the apps involved */
+ g_autolist(GObject) ops = flatpak_transaction_get_operations (transaction);
+ for (GList *l = ops; l != NULL; l = l->next) {
+ FlatpakTransactionOperation *op = l->data;
+ const gchar *ref = flatpak_transaction_operation_get_ref (op);
+ g_autoptr(GsApp) app = _ref_to_app (self, ref);
+ if (app == NULL) {
+ g_warning ("failed to find app for %s", ref);
+ continue;
+ }
+ gs_app_set_state_recover (app);
+ }
+
if (self->first_operation_error != NULL) {
g_propagate_error (error, g_steal_pointer (&self->first_operation_error));
return FALSE;
@@ -275,23 +288,6 @@ _transaction_operation_error (FlatpakTransaction *transaction,
FlatpakTransactionErrorDetails detail)
{
GsFlatpakTransaction *self = GS_FLATPAK_TRANSACTION (transaction);
- g_autolist(GObject) ops = NULL;
-
- /* whole transaction failed; restore the state for all the apps */
- ops = flatpak_transaction_get_operations (transaction);
- for (GList *l = ops; l != NULL; l = l->next) {
- FlatpakTransactionOperation *op = l->data;
- const gchar *ref = flatpak_transaction_operation_get_ref (op);
- g_autoptr(GsApp) app = _ref_to_app (self, ref);
-
- if (app == NULL) {
- g_warning ("failed to find app for %s",
- flatpak_transaction_operation_get_ref (operation));
- continue;
- }
-
- gs_app_set_state_recover (app);
- }
if (g_error_matches (error, FLATPAK_ERROR, FLATPAK_ERROR_SKIPPED)) {
return TRUE; /* continue */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]