[gnome-software/1252-gnome-software-is-not-able-to-update-org-freedesktop-platform-ffmpeg-full: 15/15] flatpak: Remember applications to update when replacing by a parent application
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/1252-gnome-software-is-not-able-to-update-org-freedesktop-platform-ffmpeg-full: 15/15] flatpak: Remember applications to update when replacing by a parent application
- Date: Mon, 24 May 2021 14:09:41 +0000 (UTC)
commit c55bc5e539b7c320af24d092756fb4e27e972ec7
Author: Milan Crha <mcrha redhat com>
Date: Mon May 24 16:08:46 2021 +0200
flatpak: Remember applications to update when replacing by a parent application
Runtimes can be hidden under other runtimes, but calling update on the parent
runtime won't necessarily update also the child runtime, thus remember
the reported ref to be updated by Flatpak and ask to update it together with
the parent runtime.
Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1252
plugins/flatpak/gs-flatpak.c | 1 +
plugins/flatpak/gs-plugin-flatpak.c | 43 +++++++++++++++++++++++++------------
2 files changed, 30 insertions(+), 14 deletions(-)
---
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index faf245ca6..fabd248d2 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -1686,6 +1686,7 @@ get_real_app_for_update (GsFlatpak *self,
"setting the latter's state instead.", gs_app_get_unique_id (app),
gs_app_get_unique_id (main_app));
gs_app_set_state (main_app, GS_APP_STATE_UPDATABLE_LIVE);
+ gs_app_add_related (main_app, app);
}
return main_app;
diff --git a/plugins/flatpak/gs-plugin-flatpak.c b/plugins/flatpak/gs-plugin-flatpak.c
index a6f23e446..f7345d6c9 100644
--- a/plugins/flatpak/gs-plugin-flatpak.c
+++ b/plugins/flatpak/gs-plugin-flatpak.c
@@ -461,6 +461,34 @@ _ref_to_app (FlatpakTransaction *transaction, const gchar *ref, GsPlugin *plugin
return gs_plugin_flatpak_find_app_by_ref (plugin, ref, NULL, NULL);
}
+static void
+_group_apps_by_installation_recurse (GsPlugin *plugin,
+ GsAppList *list,
+ GHashTable *applist_by_flatpaks)
+{
+ if (!list)
+ return;
+
+ for (guint i = 0; i < gs_app_list_length (list); i++) {
+ GsApp *app = gs_app_list_index (list, i);
+ GsFlatpak *flatpak = gs_plugin_flatpak_get_handler (plugin, app);
+ if (flatpak != NULL) {
+ GsAppList *list_tmp = g_hash_table_lookup (applist_by_flatpaks, flatpak);
+ GsAppList *related_list;
+ if (list_tmp == NULL) {
+ list_tmp = gs_app_list_new ();
+ g_hash_table_insert (applist_by_flatpaks,
+ g_object_ref (flatpak),
+ list_tmp);
+ }
+ gs_app_list_add (list_tmp, app);
+
+ related_list = gs_app_get_related (app);
+ _group_apps_by_installation_recurse (plugin, related_list, applist_by_flatpaks);
+ }
+ }
+}
+
/*
* Returns: (transfer full) (element-type GsFlatpak GsAppList):
* a map from GsFlatpak to non-empty lists of apps from @list associated
@@ -478,20 +506,7 @@ _group_apps_by_installation (GsPlugin *plugin,
(GDestroyNotify) g_object_unref);
/* put each app into the correct per-GsFlatpak list */
- for (guint i = 0; i < gs_app_list_length (list); i++) {
- GsApp *app = gs_app_list_index (list, i);
- GsFlatpak *flatpak = gs_plugin_flatpak_get_handler (plugin, app);
- if (flatpak != NULL) {
- GsAppList *list_tmp = g_hash_table_lookup (applist_by_flatpaks, flatpak);
- if (list_tmp == NULL) {
- list_tmp = gs_app_list_new ();
- g_hash_table_insert (applist_by_flatpaks,
- g_object_ref (flatpak),
- list_tmp);
- }
- gs_app_list_add (list_tmp, app);
- }
- }
+ _group_apps_by_installation_recurse (plugin, list, applist_by_flatpaks);
return g_steal_pointer (&applist_by_flatpaks);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]