[gnome-software/1504-drop-older-versions-from-update-details-dialog] gs-appstream: Limit what update details are used
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/1504-drop-older-versions-from-update-details-dialog] gs-appstream: Limit what update details are used
- Date: Tue, 26 Oct 2021 15:55:28 +0000 (UTC)
commit 99d66a8bb1d043215f63a3fd95ca57a31d639c9d
Author: Milan Crha <mcrha redhat com>
Date: Tue Oct 26 17:51:40 2021 +0200
gs-appstream: Limit what update details are used
Show only update details between the currently installed version
and the version for the update. No need to show older versions.
Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1504
lib/gs-appstream.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/lib/gs-appstream.c b/lib/gs-appstream.c
index df91dd0fd..e0b9cc8c5 100644
--- a/lib/gs-appstream.c
+++ b/lib/gs-appstream.c
@@ -550,12 +550,18 @@ gs_appstream_refine_app_updates (GsApp *app,
/* get the descriptions with a version prefix */
} else if (updates_list->len > 1) {
+ const gchar *version = gs_app_get_version (app);
g_autoptr(GString) update_desc = g_string_new ("");
for (guint i = 0; i < updates_list->len; i++) {
XbNode *release = g_ptr_array_index (updates_list, i);
+ const gchar *release_version = xb_node_get_attr (release, "version");
g_autofree gchar *desc = NULL;
g_autoptr(XbNode) n = NULL;
+ /* skip the currently installed version and all below it */
+ if (version != NULL && as_vercmp_simple (version, release_version) >= 0)
+ continue;
+
n = xb_node_query_first (release, "description", NULL);
desc = gs_appstream_format_description (n, NULL);
g_string_append_printf (update_desc,
@@ -567,7 +573,8 @@ gs_appstream_refine_app_updates (GsApp *app,
/* remove trailing newlines */
if (update_desc->len > 2)
g_string_truncate (update_desc, update_desc->len - 2);
- gs_app_set_update_details (app, update_desc->str);
+ if (update_desc->len > 0)
+ gs_app_set_update_details (app, update_desc->str);
}
/* if there is no already set update version use the newest */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]