[gnome-software] Sort the history details with the most recent first
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Sort the history details with the most recent first
- Date: Thu, 12 Sep 2013 10:54:10 +0000 (UTC)
commit 53489a8f3fb427d416b61d2e5b48f2d763ffcf9a
Author: Richard Hughes <richard hughsie com>
Date: Thu Sep 12 11:54:04 2013 +0100
Sort the history details with the most recent first
src/gs-shell-details.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index ef22f3e..5833b3e 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -324,6 +324,21 @@ gs_shell_details_app_install_button_cb (GtkWidget *widget, GsShellDetails *shell
}
/**
+ * gs_shell_details_history_sort_cb:
+ **/
+static gint
+gs_shell_details_history_sort_cb (gconstpointer a, gconstpointer b)
+{
+ gint64 timestamp_a = gs_app_get_install_date (*(GsApp **) a);
+ gint64 timestamp_b = gs_app_get_install_date (*(GsApp **) b);
+ if (timestamp_a < timestamp_b)
+ return 1;
+ if (timestamp_a > timestamp_b)
+ return -1;
+ return 0;
+}
+
+/**
* gs_shell_details_app_history_button_cb:
**/
static void
@@ -344,6 +359,7 @@ gs_shell_details_app_history_button_cb (GtkWidget *widget, GsShellDetails *shell
list_box = GTK_LIST_BOX (gtk_builder_get_object (priv->builder, "list_box_history"));
gs_container_remove_all (GTK_CONTAINER (list_box));
history = gs_app_get_history (priv->app);
+ g_ptr_array_sort (history, gs_shell_details_history_sort_cb);
for (i = 0; i < history->len; i++) {
app = g_ptr_array_index (history, i);
box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]