From c2846982424b3bf3f2703e7a3a19b7b5f7d3611e Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 15 Sep 2023 14:40:05 +0200 Subject: src/session-list.vala: Rework case-insensitive session sorting. Do the sorting on a deep copy of the session list from LightDM. This resolves the issue of loosing all session types starting with lower case letters from the session chooser when accessing the chooser list the second time. --- src/session-list.vala | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/session-list.vala b/src/session-list.vala index 21e9eb6..b90c751 100644 --- a/src/session-list.vala +++ b/src/session-list.vala @@ -29,12 +29,6 @@ public class SessionPrompt : PromptBox Object (id: id, session: session, default_session: default_session); } - private unowned GLib.List sessions_sorted_ci (GLib.List sessions) - { - sessions.sort_with_data((a, b) => GLib.strcmp (a.name.casefold(), b.name.casefold())); - return sessions; - } - private ToggleBox box; construct @@ -53,7 +47,9 @@ public class SessionPrompt : PromptBox } else { - foreach (var session in sessions_sorted_ci( LightDM.get_sessions() ) ) + var sessions = LightDM.get_sessions().copy(); + sessions.sort_with_data((a, b) => GLib.strcmp (a.name.casefold().collate_key(), b.name.casefold().collate_key())); + foreach (var session in sessions) { /* Apply hide x11/wayland filter */ if (greeter.validate_session(session.key, false) != null) { -- cgit v1.2.3