diff options
author | Ray Strode <rstrode@redhat.com> | 2017-02-27 15:51:26 -0500 |
---|---|---|
committer | Ray Strode <rstrode@redhat.com> | 2017-02-27 17:04:18 -0500 |
commit | 5b1e625417c274823c66a552f37d912986fc34d8 (patch) | |
tree | 57f3965829cea157bc7c1f4936b4c6197a86d8c3 | |
parent | 5658fda3958c76a0cbbba2c8fdd0eec929f5aea7 (diff) | |
download | gdm-5b1e625417c274823c66a552f37d912986fc34d8.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.c | 21 |
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 |