[gnome-software/1453-flathub-repo-misleadingly-considered-present-on-fedora-35-with-filtered-flathub] flatpak: Update existing remote from a .flatpakref file
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/1453-flathub-repo-misleadingly-considered-present-on-fedora-35-with-filtered-flathub] flatpak: Update existing remote from a .flatpakref file
- Date: Tue, 21 Sep 2021 12:33:30 +0000 (UTC)
commit 2a94efbda64d94ba6ac27cfd08190b62f52df000
Author: Milan Crha <mcrha redhat com>
Date: Tue Sep 21 14:06:35 2021 +0200
flatpak: Update existing remote from a .flatpakref file
Update existing remote's title, description and filter when installing
a .flatpakref file, to match what had been installed, with new-enough
flatpak library.
Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1453
plugins/flatpak/gs-flatpak-utils.c | 6 ++++++
plugins/flatpak/gs-flatpak.c | 11 +++++++++--
2 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/plugins/flatpak/gs-flatpak-utils.c b/plugins/flatpak/gs-flatpak-utils.c
index 7aa735b0b..ec0b397e3 100644
--- a/plugins/flatpak/gs-flatpak-utils.c
+++ b/plugins/flatpak/gs-flatpak-utils.c
@@ -72,8 +72,10 @@ gs_flatpak_app_new_from_remote (GsPlugin *plugin,
{
g_autofree gchar *title = NULL;
g_autofree gchar *url = NULL;
+ #if FLATPAK_CHECK_VERSION(1, 4, 0)
g_autofree gchar *filter = NULL;
g_autofree gchar *description = NULL;
+ #endif
g_autoptr(GsApp) app = NULL;
app = gs_flatpak_app_new (flatpak_remote_get_name (xremote));
@@ -103,18 +105,22 @@ gs_flatpak_app_new_from_remote (GsPlugin *plugin,
* not the remote title */
gs_app_set_origin_ui (app, _("Applications"));
+ #if FLATPAK_CHECK_VERSION(1, 4, 0)
description = flatpak_remote_get_description (xremote);
if (description != NULL)
gs_app_set_description (app, GS_APP_QUALITY_NORMAL, description);
+ #endif
/* url */
url = flatpak_remote_get_url (xremote);
if (url != NULL)
gs_app_set_url (app, AS_URL_KIND_HOMEPAGE, url);
+ #if FLATPAK_CHECK_VERSION(1, 4, 0)
filter = flatpak_remote_get_filter (xremote);
if (filter != NULL)
gs_flatpak_app_set_repo_filter (app, filter);
+ #endif
/* success */
return g_steal_pointer (&app);
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index 55a91af2a..fa7df00c9 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -1608,9 +1608,16 @@ gs_flatpak_app_install_source (GsFlatpak *self,
gs_app_get_id (app),
cancellable, NULL);
if (xremote != NULL) {
- /* if the remote already exists, just enable it */
- g_debug ("enabling existing remote %s", flatpak_remote_get_name (xremote));
+ /* if the remote already exists, just enable it and update it */
+ g_debug ("modifying existing remote %s", flatpak_remote_get_name (xremote));
flatpak_remote_set_disabled (xremote, FALSE);
+ if (gs_flatpak_app_get_file_kind (app) == GS_FLATPAK_APP_FILE_KIND_REPO) {
+ flatpak_remote_set_title (xremote, gs_app_get_origin_ui (app));
+ #if FLATPAK_CHECK_VERSION(1, 4, 0)
+ flatpak_remote_set_filter (xremote, gs_flatpak_app_get_repo_filter (app));
+ flatpak_remote_set_description (xremote, gs_app_get_description (app));
+ #endif
+ }
} else if (!is_install) {
g_set_error (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_FAILED, "Cannot enable flatpak remote
'%s', remote not found", gs_app_get_id (app));
} else {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]