[gnome-software/fix-locale-updates: 30/30] flatpak: Properly check if an app is a runtime
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/fix-locale-updates: 30/30] flatpak: Properly check if an app is a runtime
- Date: Thu, 14 May 2020 18:22:43 +0000 (UTC)
commit fcc7cd3d04b60cfbac3ffbf857dcec9ff4a6a4d7
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 394ae72f..0353aad8 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)));
@@ -1013,8 +1013,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;
@@ -1377,7 +1381,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]