[gdm/gnome-2-30] Sort session using file basename
- From: William Jon McCann <mccann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdm/gnome-2-30] Sort session using file basename
- Date: Thu, 17 Jun 2010 21:55:37 +0000 (UTC)
commit 311f2bd3c0870624449175b789d5f415e24083de
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.
(cherry picked from commit 84eed8bb4394c1408f5673775d798ab2858cd2d9)
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 9ba2e6c..57e5515 100644
--- a/daemon/gdm-session-direct.c
+++ b/daemon/gdm-session-direct.c
@@ -648,12 +648,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;
@@ -677,18 +681,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]