#include "lightdm/session.h"
enum {
- PROP_0,
- PROP_KEY,
+ PROP_KEY = 1,
PROP_NAME,
PROP_COMMENT
};
}
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;
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
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);
priv->key = g_strdup (key);
g_free (priv->type);
- priv->type = g_strdup (type);
+ priv->type = type;
g_free (priv->name);
priv->name = name;
}
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;
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);
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;
static void
lightdm_session_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
static void
lightdm_session_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
LightDMSession *self;