[gnome-software] flatpak: Fix the ref kind when getting the main app of a related one
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] flatpak: Fix the ref kind when getting the main app of a related one
- Date: Thu, 10 Sep 2020 13:28:23 +0000 (UTC)
commit 3ea63be4b572296fa4df0466d0c87b0a1c169866
Author: Joaquim Rocha <jrocha endlessm com>
Date: Mon Mar 25 21:50:17 2019 +0100
flatpak: Fix the ref kind when getting the main app of a related one
When getting the main ref of a related one, the ref kind used for
trying to match it to an installed one was always the "app" kind. This
may have been because initially, all related apps had a regular app as
their main one. However, runtimes do have extensions too, and thus the
main app in this case will be a "runtime" type one.
Thus, this patch gets the right ref kind for the main app based on
the ref name's prefix.
plugins/flatpak/gs-flatpak.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index 0d22e04c..b21df303 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -1382,6 +1382,7 @@ get_main_app_of_related (GsFlatpak *self,
g_autoptr(FlatpakInstalledRef) ref = NULL;
const gchar *ref_name;
g_auto(GStrv) app_tokens = NULL;
+ FlatpakRefKind ref_kind = FLATPAK_REF_KIND_RUNTIME;
ref_name = gs_flatpak_app_get_main_app_ref_name (related_app);
if (ref_name == NULL) {
@@ -1399,11 +1400,15 @@ get_main_app_of_related (GsFlatpak *self,
return NULL;
}
+ /* get the right ref kind for the main app */
+ if (g_strcmp0 (app_tokens[0], "app") == 0)
+ ref_kind = FLATPAK_REF_KIND_APP;
+
/* this function only returns G_IO_ERROR_NOT_FOUND when the metadata file
* is missing, but if that's the case then things should have broken before
* this point */
ref = flatpak_installation_get_installed_ref (self->installation,
- FLATPAK_REF_KIND_APP,
+ ref_kind,
app_tokens[1],
app_tokens[2],
app_tokens[3],
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]