! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
The most recently used session should be the default in the session chooser
Status:
RESOLVED: FIXED
Product:
Xfce4-session
Component:
General

Comments

Description Magnus Bergman 2019-04-30 03:34:42 CEST
If there are multiple sessions in the list it's not the most recently used one that is in the top of the list and selected. It's actually sorted the other way around (at least for me, maybe the order is simply undefined).

To fix the session order I get the expected result (the most recently used session selected) by simply replacing gtk_list_store_append() with gtk_list_store_prepend() in xfsm_chooser_set_sessions(). But I don't know how the list of sessions sent to this function is supposed to be sorted. Is it perhaps better to fix it in the caller? Or perhaps assume the list is unsorted and sort it on access time before adding the sessions to the list store?
Comment 1 Simon Steinbeiss editbugs 2019-05-05 00:43:11 CEST
As far as I can tell it simply loads them from top to bottom from the rc file which I think - as far as I can tell from the code - is unsorted.

The "last access time" is stored and available in the function that loads the sessions, so instead of gtk_list_store_append you'd have to implement g_list_store_insert_sorted with a compare_func that sorts by ATIME.
Comment 2 Magnus Bergman 2019-08-23 02:12:32 CEST
Created attachment 8942 
Fix

With this patch the sorting is done in settings_list_sessions_populate(), which is also used by the session editor. Perhaps another sorting is preferred in that case (but for now I guess this sorting is no worse than unsorted at least). In that case the function sort_sessions_on_atime() could be called from xfsm_chooser_set_sessions() instead.
Comment 3 Git Bot editbugs 2019-10-08 10:22:50 CEST
Magnus Bergman referenced this bugreport in commit 436c09d51f8c3ae5beffd3aad536bc1c99935222

Sort saved sessions by most recently used (Bug #15338)

https://git.xfce.org/xfce/xfce4-session/commit?id=436c09d51f8c3ae5beffd3aad536bc1c99935222
Comment 4 Simon Steinbeiss editbugs 2019-10-08 10:23:14 CEST
I finally got around to looking at this. Thanks for the patch!

Bug #15338

Reported by:
Magnus Bergman
Reported on: 2019-04-30
Last modified on: 2019-10-08

People

Assignee:
Xfce Bug Triage
CC List:
1 user

Version

Version:
Unspecified

Attachments

Fix (1.05 KB, patch)
2019-08-23 02:12 CEST , Magnus Bergman
no flags

Additional information