[gnome-software] trivial: Also install related apps when updating flatpaks



commit 6e5e24607c2582a9eb4aecc2d103a84406aaffd1
Author: Richard Hughes <richard hughsie com>
Date:   Thu Jun 22 10:51:16 2017 +0100

    trivial: Also install related apps when updating flatpaks
    
    You can only hit this if you turn off the auto-download of updates.

 plugins/flatpak/gs-flatpak.c |   38 ++++++++++++++++++++++++++------------
 1 files changed, 26 insertions(+), 12 deletions(-)
---
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index 30c8288..5d5df4d 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -2790,7 +2790,7 @@ gs_flatpak_update_app (GsFlatpak *self,
                       GCancellable *cancellable,
                       GError **error)
 {
-       g_autoptr(FlatpakInstalledRef) xref = NULL;
+       g_autoptr(GsAppList) list = NULL;
        g_autoptr(GsFlatpakProgressHelper) phelper = NULL;
 
        /* install */
@@ -2803,21 +2803,35 @@ gs_flatpak_update_app (GsFlatpak *self,
                return FALSE;
        }
 
-       phelper = gs_flatpak_progress_helper_new (self->plugin, app);
-       xref = flatpak_installation_update (self->installation,
-                                           FLATPAK_UPDATE_FLAGS_NONE,
-                                           gs_app_get_flatpak_kind (app),
-                                           gs_app_get_flatpak_name (app),
-                                           gs_app_get_flatpak_arch (app),
-                                           gs_app_get_flatpak_branch (app),
-                                           gs_flatpak_progress_cb, phelper,
-                                           cancellable, error);
-       if (xref == NULL) {
-               gs_plugin_flatpak_error_convert (error);
+       /* get the list of apps to process */
+       list = gs_flatpak_get_list_for_install (self, app, cancellable, error);
+       if (list == NULL) {
+               g_prefix_error (error, "failed to get related refs: ");
                gs_app_set_state_recover (app);
                return FALSE;
        }
 
+       /* update all the required packages */
+       phelper = gs_flatpak_progress_helper_new (self->plugin, app);
+       phelper->job_max = gs_app_list_length (list);
+       for (phelper->job_now = 0; phelper->job_now < phelper->job_max; phelper->job_now++) {
+               GsApp *app_tmp = gs_app_list_index (list, phelper->job_now);
+               g_autoptr(FlatpakInstalledRef) xref = NULL;
+               xref = flatpak_installation_update (self->installation,
+                                                   FLATPAK_UPDATE_FLAGS_NONE,
+                                                   gs_app_get_flatpak_kind (app_tmp),
+                                                   gs_app_get_flatpak_name (app_tmp),
+                                                   gs_app_get_flatpak_arch (app_tmp),
+                                                   gs_app_get_flatpak_branch (app_tmp),
+                                                   gs_flatpak_progress_cb, phelper,
+                                                   cancellable, error);
+               if (xref == NULL) {
+                       gs_plugin_flatpak_error_convert (error);
+                       gs_app_set_state_recover (app);
+                       return FALSE;
+               }
+       }
+
        /* update UI */
        gs_plugin_updates_changed (self->plugin);
 


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