[Xfce4-commits] [xfce/xfce4-session] 01/01: Sort saved sessions by most recently used (Bug #15338)
noreply at xfce.org
noreply at xfce.org
Tue Oct 8 10:22:45 CEST 2019
This is an automated email from the git hooks/post-receive script.
o c h o s i p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository xfce/xfce4-session.
commit 436c09d51f8c3ae5beffd3aad536bc1c99935222
Author: Magnus Bergman <magnus.bergman at snisurset.net>
Date: Tue Oct 8 10:21:02 2019 +0200
Sort saved sessions by most recently used (Bug #15338)
---
libxfsm/xfsm-util.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/libxfsm/xfsm-util.c b/libxfsm/xfsm-util.c
index 691753b..a4d0888 100644
--- a/libxfsm/xfsm-util.c
+++ b/libxfsm/xfsm-util.c
@@ -350,6 +350,23 @@ settings_list_sessions_treeview_init (GtkTreeView *treeview)
gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
}
+static gint
+compare_session_atime (XfsmSessionInfo *session1,
+ XfsmSessionInfo *session2)
+{
+ if (session1->atime < session2->atime)
+ return 1;
+ if (session1->atime > session2->atime)
+ return -1;
+ return 0;
+}
+
+static GList *
+sort_sessions_on_atime (GList *sessions)
+{
+ return g_list_sort (sessions, (GCompareFunc) compare_session_atime);
+}
+
void
settings_list_sessions_populate (GtkTreeModel *model,
GList *sessions)
@@ -360,6 +377,8 @@ settings_list_sessions_populate (GtkTreeModel *model,
gchar *title;
GList *lp;
+ sessions = sort_sessions_on_atime (sessions);
+
gtk_list_store_clear (GTK_LIST_STORE (model));
for (lp = sessions; lp != NULL; lp = lp->next)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list