[gnome-software/fix-locale-updates] flatpak: Properly check if an app is a runtime
- From: Matthew Leeds <mwleeds src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/fix-locale-updates] flatpak: Properly check if an app is a runtime
- Date: Tue, 28 Apr 2020 22:40:50 +0000 (UTC)
commit 06c114183a5828044cc4ff71360ab7690c1a9597
Author: Matthew Leeds <matthew leeds endlessm com>
Date: Wed Apr 22 15:50:40 2020 -0700
flatpak: Properly check if an app is a runtime
In gs_flatpak_set_kind_from_flatpak(), we use AS_APP_KIND_LOCALIZATION
and AS_APP_KIND_GENERIC in addition to AS_APP_KIND_RUNTIME, all for
things which from Flatpak's perspective are runtimes (their ref starts
with "runtime/"). So change checks in a few places to correctly identify
Flatpak runtimes instead of checking for AS_APP_KIND_RUNTIME, which has
the effect of ensuring that applications properly show as needing an
update when their locale extension needs an update, e.g. because the
user chose a language other than the one the locale extensions already
have.
Together with an update of libflatpak to 1.7.3 when that is released,
this commit addresses the issue described in this MR:
https://gitlab.gnome.org/GNOME/gnome-software/-/merge_requests/430
Closes: #539
plugins/flatpak/gs-flatpak.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index a98ca934..6374a0e0 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -250,7 +250,7 @@ gs_flatpak_create_app (GsFlatpak *self, const gchar *origin, FlatpakRef *xref)
return app_cached;
/* fallback values */
- if (gs_app_get_kind (app) == AS_APP_KIND_RUNTIME) {
+ if (gs_flatpak_app_get_ref_kind (app) == FLATPAK_REF_KIND_RUNTIME) {
g_autoptr(AsIcon) icon = NULL;
gs_app_set_name (app, GS_APP_QUALITY_NORMAL,
flatpak_ref_get_name (FLATPAK_REF (xref)));
@@ -1010,8 +1010,12 @@ gs_flatpak_set_metadata_installed (GsFlatpak *self, GsApp *app,
gs_app_set_install_date (app, mtime);
}
- /* if it's a runtime, check if the main-app info should be set */
- if (gs_app_get_kind (app) == AS_APP_KIND_RUNTIME &&
+ /* If it's a runtime, check if the main-app info should be set. Note that
+ * checking the app for AS_APP_KIND_RUNTIME is not good enough because it
+ * could be e.g. AS_APP_KIND_LOCALIZATION and still be a runtime from
+ * Flatpak's perspective.
+ */
+ if (gs_flatpak_app_get_ref_kind (app) == FLATPAK_REF_KIND_RUNTIME &&
gs_flatpak_app_get_main_app_ref_name (app) == NULL) {
g_autoptr(GError) error = NULL;
g_autoptr(GKeyFile) metadata_file = NULL;
@@ -1374,7 +1378,7 @@ get_real_app_for_update (GsFlatpak *self,
GsApp *main_app = NULL;
g_autoptr(GError) error_local = NULL;
- if (gs_app_get_kind (app) == AS_APP_KIND_RUNTIME)
+ if (gs_flatpak_app_get_ref_kind (app) == FLATPAK_REF_KIND_RUNTIME)
main_app = get_main_app_of_related (self, app, cancellable, &error_local);
if (main_app == NULL) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]