[gnome-text-editor] session: reverse sort when comparing recent URIs
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-text-editor] session: reverse sort when comparing recent URIs
- Date: Sat, 30 Oct 2021 19:45:52 +0000 (UTC)
commit 8ab1531b4dec550723527e144b62ce9e0b921dd6
Author: Christian Hergert <chergert redhat com>
Date: Sat Oct 30 12:44:00 2021 -0700
session: reverse sort when comparing recent URIs
As the author of GDateTime you'd think I'd have remembered
that older files come first. We want the opposite of that.
Fixes #204
src/editor-session.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/src/editor-session.c b/src/editor-session.c
index 66120b6..5e122d3 100644
--- a/src/editor-session.c
+++ b/src/editor-session.c
@@ -1010,6 +1010,7 @@ recent_compare (gconstpointer a,
{
const Recent *ra = a;
const Recent *rb = b;
+ int ret;
if (ra->age == NULL && rb->age == NULL)
return strcmp (ra->uri, rb->uri);
@@ -1020,7 +1021,11 @@ recent_compare (gconstpointer a,
if (rb->age == NULL)
return -1;
- return g_date_time_compare (ra->age, rb->age);
+ ret = g_date_time_compare (ra->age, rb->age);
+
+ if (ret < 0) return 1;
+ else if (ret > 0) return -1;
+ else return 0;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]