[gnome-software: 4/7] flatpak: Support additional properties when creating remotes
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software: 4/7] flatpak: Support additional properties when creating remotes
- Date: Wed, 1 Dec 2021 13:16:44 +0000 (UTC)
commit 667c2780a28f0090a0da2357d9b6eaa4ea4d4f59
Author: Philip Withnall <pwithnall endlessos org>
Date: Tue Oct 19 12:12:14 2021 +0100
flatpak: Support additional properties when creating remotes
flatpakrepo files contain more data than we were using. Ensure that data
is propagated into the remote configuration in flatpak’s repository.
In particular, this ensures the remote’s description and icon are set
(if provided in the flatpakrepo file).
Signed-off-by: Philip Withnall <pwithnall endlessos org>
Helps: #1507
plugins/flatpak/gs-flatpak.c | 33 ++++++++++++++++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)
---
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index 7b5583125..318154a58 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -1549,6 +1549,7 @@ gs_flatpak_ref_to_app (GsFlatpak *self, const gchar *ref,
return NULL;
}
+/* This is essentially the inverse of gs_flatpak_app_new_from_repo_file() */
static FlatpakRemote *
gs_flatpak_create_new_remote (GsFlatpak *self,
GsApp *app,
@@ -1557,7 +1558,9 @@ gs_flatpak_create_new_remote (GsFlatpak *self,
{
const gchar *gpg_key;
const gchar *branch;
- const gchar *title;
+ const gchar *title, *homepage, *comment, *description;
+ const gchar *filter;
+ GPtrArray *icons;
g_autoptr(FlatpakRemote) xremote = NULL;
/* create a new remote */
@@ -1588,6 +1591,34 @@ gs_flatpak_create_new_remote (GsFlatpak *self,
if (branch != NULL)
flatpak_remote_set_default_branch (xremote, branch);
+ /* optional data */
+ homepage = gs_app_get_url (app, AS_URL_KIND_HOMEPAGE);
+ if (homepage != NULL)
+ flatpak_remote_set_homepage (xremote, homepage);
+
+ comment = gs_app_get_summary (app);
+ if (comment != NULL)
+ flatpak_remote_set_comment (xremote, comment);
+
+ description = gs_app_get_description (app);
+ if (description != NULL)
+ flatpak_remote_set_description (xremote, description);
+
+ icons = gs_app_get_icons (app);
+ for (guint i = 0; icons != NULL && i < icons->len; i++) {
+ GIcon *icon = g_ptr_array_index (icons, i);
+
+ if (GS_IS_REMOTE_ICON (icon)) {
+ flatpak_remote_set_icon (xremote,
+ gs_remote_icon_get_uri (GS_REMOTE_ICON (icon)));
+ break;
+ }
+ }
+
+ filter = gs_flatpak_app_get_repo_filter (app);
+ if (filter != NULL)
+ flatpak_remote_set_filter (xremote, filter);
+
return g_steal_pointer (&xremote);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]