summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2017-02-27 15:51:26 -0500
committerRay Strode <rstrode@redhat.com>2017-03-01 10:58:20 -0500
commita6cd93323d2f3ddaac35e452a42f043681830bc4 (patch)
tree9a6a40bab0811fc86eb773a75dc514179db25b1a
parente7c5c8d3a0ba4a6c74fbf1ca4a5509a5e81ec762 (diff)
downloadgdm-a6cd93323d2f3ddaac35e452a42f043681830bc4.tar.gz
gdm-session: change how session search path is computed
The current mechanism of assuming the wayland-sessions path is the first element of the array isn't very conducive to reprioritizing wayland sessions. This commit changes the code to use a GArray instead. https://bugzilla.gnome.org/show_bug.cgi?id=779338
-rw-r--r--daemon/gdm-session.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c
index b839fea4..492ce32d 100644
--- a/daemon/gdm-session.c
+++ b/daemon/gdm-session.c
@@ -340,10 +340,9 @@ on_establish_credentials_cb (GdmDBusWorker *proxy,
static const char **
get_system_session_dirs (GdmSession *self)
{
- static const char *search_dirs[] = {
-#ifdef ENABLE_WAYLAND_SUPPORT
- DATADIR "/wayland-sessions/",
-#endif
+ static GArray *search_array = NULL;
+
+ static const char *x_search_dirs[] = {
"/etc/X11/sessions/",
DMCONFDIR "/Sessions/",
DATADIR "/gdm/BuiltInSessions/",
@@ -351,13 +350,19 @@ get_system_session_dirs (GdmSession *self)
NULL
};
+ static const char *wayland_search_dir = DATADIR "/wayland-sessions/";
+
+ if (search_array == NULL) {
+ search_array = g_array_new (TRUE, TRUE, sizeof (char *));
+
+ g_array_append_vals (search_array, x_search_dirs, G_N_ELEMENTS (x_search_dirs));
+
#ifdef ENABLE_WAYLAND_SUPPORT
- if (self->priv->ignore_wayland) {
- return search_dirs + 1;
- }
+ g_array_prepend_val (search_array, wayland_search_dir);
#endif
+ }
- return search_dirs;
+ return (const char **) search_array->data;
}
static gboolean