[gnome-software/mwleeds/fix-deprecated-install] fixup! flatpak: Migrate flatpakref handling to FlatpakTransaction



commit 45c5a50ee8b7822191fb6e5b302551ab320c6004
Author: Phaedrus Leeds <mwleeds protonmail com>
Date:   Thu Nov 11 20:49:15 2021 -0800

    fixup! flatpak: Migrate flatpakref handling to FlatpakTransaction

 plugins/flatpak/gs-flatpak.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index 2e0370bf1..30be77632 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -3474,9 +3474,12 @@ gs_flatpak_file_to_app_ref (GsFlatpak *self,
        GsApp *runtime;
        const gchar *const *locales = g_get_language_names ();
        const gchar *remote_name;
-       gboolean is_runtime;
+       gboolean is_runtime, success;
        gsize len = 0;
        GList *txn_ops;
+#if !FLATPAK_CHECK_VERSION(1,13,1)
+       guint64 app_installed_size = 0, app_download_size = 0;
+#endif
        g_autofree gchar *contents = NULL;
        g_autoptr(FlatpakTransaction) transaction = NULL;
        g_autoptr(FlatpakRef) parsed_ref = NULL;
@@ -3569,7 +3572,8 @@ gs_flatpak_file_to_app_ref (GsFlatpak *self,
                gs_flatpak_error_convert (error);
                return NULL;
        }
-       g_assert (!flatpak_transaction_run (transaction, cancellable, &error_local));
+       success = flatpak_transaction_run (transaction, cancellable, &error_local);
+       g_assert (!success); /* aborted in _txn_abort_on_ready */
 
        if (!g_error_matches (error_local, FLATPAK_ERROR, FLATPAK_ERROR_ALREADY_INSTALLED) &&
            !g_error_matches (error_local, FLATPAK_ERROR, FLATPAK_ERROR_ABORTED)) {
@@ -3613,6 +3617,10 @@ gs_flatpak_file_to_app_ref (GsFlatpak *self,
                } else {
                        remote_name = flatpak_transaction_operation_get_remote (op);
                        g_debug ("auto-created remote name: %s", remote_name);
+#if !FLATPAK_CHECK_VERSION(1,13,1)
+                       app_download_size = flatpak_transaction_operation_get_download_size (op);
+                       app_installed_size = flatpak_transaction_operation_get_installed_size (op);
+#endif
                        break;
                }
        }
@@ -3636,6 +3644,10 @@ gs_flatpak_file_to_app_ref (GsFlatpak *self,
        app = gs_flatpak_create_app (self, remote_name, FLATPAK_REF (remote_ref), NULL, cancellable);
 #else
        app = gs_flatpak_create_app (self, remote_name, parsed_ref, NULL, cancellable);
+       if (app_download_size != 0)
+               gs_app_set_size_download (app, app_download_size);
+       if (app_installed_size != 0)
+               gs_app_set_size_installed (app, app_installed_size);
 #endif
 
        gs_app_add_quirk (app, GS_APP_QUIRK_HAS_SOURCE);


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