[gdm] Sort session using file basename
- From: Frédéric Crozat <fcrozat src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdm] Sort session using file basename
- Date: Mon, 3 May 2010 16:49:02 +0000 (UTC)
commit 84eed8bb4394c1408f5673775d798ab2858cd2d9
Author: Frederic Crozat <fcrozat mandriva com>
Date: Mon May 3 14:19:55 2010 +0200
Sort session using file basename
Ensure behaviour in default / fallback session is consistent with gdm <=
2.20. Fixes Mandriva bug 58501 / GNOME bug 617516.
daemon/gdm-session-direct.c | 28 +++++++++++++++++++++++-----
1 files changed, 23 insertions(+), 5 deletions(-)
---
diff --git a/daemon/gdm-session-direct.c b/daemon/gdm-session-direct.c
index 031ae33..9aa47fc 100644
--- a/daemon/gdm-session-direct.c
+++ b/daemon/gdm-session-direct.c
@@ -650,12 +650,16 @@ get_fallback_session_name (void)
const char **search_dirs;
int i;
char *name;
+ GSequence *sessions;
+ GSequenceIter *session;
name = g_strdup ("gnome");
if (get_session_command_for_name (name, NULL)) {
return name;
}
+ sessions = g_sequence_new (g_free);
+
search_dirs = get_system_session_dirs ();
for (i = 0; search_dirs[i] != NULL; i++) {
GDir *dir;
@@ -679,18 +683,32 @@ get_fallback_session_name (void)
}
if (get_session_command_for_file (base_name, NULL)) {
- g_free (name);
- name = g_strndup (base_name,
- strlen (base_name) -
- strlen (".desktop"));
- break;
+ g_sequence_insert_sorted (sessions, g_strdup (base_name), (GCompareDataFunc) g_strcmp0, NULL);
}
} while (base_name != NULL);
g_dir_close (dir);
}
+ session = g_sequence_get_begin_iter (sessions);
+ do {
+ if (g_sequence_get (session)) {
+ char *base_name;
+
+ g_free (name);
+ base_name = g_sequence_get (session);
+ name = g_strndup (base_name,
+ strlen (base_name) -
+ strlen (".desktop"));
+
+ break;
+ }
+ session = g_sequence_iter_next (session);
+ } while (!g_sequence_iter_is_end (session));
+
+ g_sequence_free (sessions);
+
return name;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]