[gdm/gnome-3-22] gdm-session: change how session search path is computed



commit a6cd93323d2f3ddaac35e452a42f043681830bc4
Author: Ray Strode <rstrode redhat com>
Date:   Mon Feb 27 15:51:26 2017 -0500

    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 files changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c
index b839fea..492ce32 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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]