From 5b1e625417c274823c66a552f37d912986fc34d8 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Mon, 27 Feb 2017 15:51:26 -0500 Subject: 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 --- daemon/gdm-session.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'daemon/gdm-session.c') 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 -- cgit v1.2.1