summaryrefslogtreecommitdiff
path: root/liblightdm-gobject
diff options
context:
space:
mode:
Diffstat (limited to 'liblightdm-gobject')
-rw-r--r--liblightdm-gobject/Makefile.am3
-rw-r--r--liblightdm-gobject/session.c30
2 files changed, 21 insertions, 12 deletions
diff --git a/liblightdm-gobject/Makefile.am b/liblightdm-gobject/Makefile.am
index bb02275f..5db00557 100644
--- a/liblightdm-gobject/Makefile.am
+++ b/liblightdm-gobject/Makefile.am
@@ -8,7 +8,8 @@ liblightdm_gobject_1_la_CFLAGS = $(LIBLIGHTDM_GOBJECT_CFLAGS) \
$(WARN_CFLAGS) \
-I"$(top_srcdir)/common" \
-DCONFIG_DIR=\"$(sysconfdir)/lightdm\" \
- -DSESSIONS_DIR=\"$(pkgdatadir)/sessions:$(datadir)/xsessions\" \
+ -DSESSIONS_DIR=\"$(pkgdatadir)/sessions:$(datadir)/xsessions:$(datadir)/wayland-sessions\" \
+ -DWAYLAND_SESSIONS_DIR=\"$(datadir)/wayland-sessions\" \
-DREMOTE_SESSIONS_DIR=\"$(pkgdatadir)/remote-sessions\"
mainheader_HEADERS = lightdm.h
diff --git a/liblightdm-gobject/session.c b/liblightdm-gobject/session.c
index d635f330..9af02bc8 100644
--- a/liblightdm-gobject/session.c
+++ b/liblightdm-gobject/session.c
@@ -46,9 +46,9 @@ compare_session (gconstpointer a, gconstpointer b)
}
static LightDMSession *
-load_session (GKeyFile *key_file, const gchar *key)
+load_session (GKeyFile *key_file, const gchar *key, const gchar *default_type)
{
- gchar *type, *domain, *name;
+ gchar *domain, *name, *type;
LightDMSession *session;
LightDMSessionPrivate *priv;
gchar *try_exec;
@@ -57,10 +57,6 @@ load_session (GKeyFile *key_file, const gchar *key)
g_key_file_get_boolean (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_HIDDEN, NULL))
return NULL;
- type = g_key_file_get_string (key_file, G_KEY_FILE_DESKTOP_GROUP, "X-LightDM-Session-Type", NULL);
- if (!type)
- type = "x";
-
#ifdef G_KEY_FILE_DESKTOP_KEY_GETTEXT_DOMAIN
domain = g_key_file_get_string (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_GETTEXT_DOMAIN, NULL);
#else
@@ -91,6 +87,10 @@ load_session (GKeyFile *key_file, const gchar *key)
g_free (full_path);
}
+ type = g_key_file_get_string (key_file, G_KEY_FILE_DESKTOP_GROUP, "X-LightDM-Session-Type", NULL);
+ if (!type)
+ type = strdup (default_type);
+
session = g_object_new (LIGHTDM_TYPE_SESSION, NULL);
priv = GET_PRIVATE (session);
@@ -98,7 +98,7 @@ load_session (GKeyFile *key_file, const gchar *key)
priv->key = g_strdup (key);
g_free (priv->type);
- priv->type = g_strdup (type);
+ priv->type = type;
g_free (priv->name);
priv->name = name;
@@ -114,7 +114,7 @@ load_session (GKeyFile *key_file, const gchar *key)
}
static GList *
-load_sessions_dir (GList *sessions, const gchar *sessions_dir)
+load_sessions_dir (GList *sessions, const gchar *sessions_dir, const gchar *default_type)
{
GDir *directory;
GError *error = NULL;
@@ -154,7 +154,7 @@ load_sessions_dir (GList *sessions, const gchar *sessions_dir)
LightDMSession *session;
key = g_strndup (filename, strlen (filename) - strlen (".desktop"));
- session = load_session (key_file, key);
+ session = load_session (key_file, key, default_type);
if (session)
{
g_debug ("Loaded session %s (%s, %s)", path, GET_PRIVATE (session)->name, GET_PRIVATE (session)->comment);
@@ -182,8 +182,16 @@ load_sessions (const gchar *sessions_dir)
int i;
dirs = g_strsplit (sessions_dir, ":", -1);
- for (i = 0; dirs[i]; i++)
- sessions = load_sessions_dir (sessions, dirs[i]);
+ for (i = 0; dirs[i]; i++)
+ {
+ const gchar *default_type = "x";
+
+ if (strcmp (dirs[i], WAYLAND_SESSIONS_DIR) == 0)
+ default_type = "wayland";
+
+ sessions = load_sessions_dir (sessions, dirs[i], default_type);
+ }
+
g_strfreev (dirs);
return sessions;