[gnome-software/gnome-3-24] Sort the upgrades list chronologically
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/gnome-3-24] Sort the upgrades list chronologically
- Date: Tue, 13 Mar 2018 20:03:24 +0000 (UTC)
commit c04bf023d6d0ba50d3c7a27403dcc3c052ed22e7
Author: Richard Hughes <richard hughsie com>
Date: Tue Mar 13 20:02:13 2018 +0000
Sort the upgrades list chronologically
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1553792
lib/gs-plugin-loader.c | 10 ++++++++++
1 file changed, 10 insertions(+)
---
diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c
index 7491d12f..38a3e0e9 100644
--- a/lib/gs-plugin-loader.c
+++ b/lib/gs-plugin-loader.c
@@ -1357,6 +1357,13 @@ gs_plugin_loader_get_updates_finish (GsPluginLoader *plugin_loader,
/******************************************************************************/
+static gint
+gs_plugin_loader_app_sort_version_cb (GsApp *app1, GsApp *app2, gpointer user_data)
+{
+ return g_strcmp0 (gs_app_get_version (app1),
+ gs_app_get_version (app2));
+}
+
static void
gs_plugin_loader_get_distro_upgrades_thread_cb (GTask *task,
gpointer object,
@@ -1378,6 +1385,9 @@ gs_plugin_loader_get_distro_upgrades_thread_cb (GTask *task,
gs_app_list_filter (job->list, gs_plugin_loader_app_set_prio, plugin_loader);
gs_app_list_filter_duplicates (job->list, GS_APP_LIST_FILTER_FLAG_NONE);
+ /* sort with the chronologically newest release last */
+ gs_app_list_sort (job->list, gs_plugin_loader_app_sort_version_cb, NULL);
+
/* success */
g_task_return_pointer (task, g_object_ref (job->list), (GDestroyNotify) g_object_unref);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]