/* The last session set to active */
Session *active_session;
+ /* The session belonging to the active greeter user */
+ Session *next_session;
+
/* The session to set active when it starts */
Session *session_to_activate;
return SEAT_GET_CLASS (seat)->get_active_session (seat);
}
+Session *
+seat_get_next_session (Seat *seat)
+{
+ g_return_val_if_fail (seat != NULL, NULL);
+ return seat->priv->next_session;
+}
+
gboolean
seat_get_can_switch (Seat *seat)
{
return NULL;
}
+static void
+greeter_active_username_changed_cb (Greeter *greeter, GParamSpec *pspec, Seat *seat)
+{
+ Session *session;
+
+ session = find_user_session (seat, greeter_get_active_username (greeter), seat->priv->active_session);
+ if (session)
+ {
+ if (seat->priv->next_session)
+ g_object_unref (seat->priv->next_session);
+ seat->priv->next_session = g_object_ref (session);
+
+ SEAT_GET_CLASS (seat)->set_next_session (seat, session);
+ }
+}
+
static void
session_authentication_complete_cb (Session *session, Seat *seat)
{
g_object_unref (seat->priv->active_session);
seat->priv->active_session = NULL;
}
+ if (session == seat->priv->next_session)
+ {
+ g_object_unref (seat->priv->next_session);
+ seat->priv->next_session = NULL;
+ }
if (session == seat->priv->session_to_activate)
{
g_object_unref (seat->priv->session_to_activate);
}
static Session *
-create_session (Seat *seat, gboolean autostart)
+create_session (Seat *seat, gboolean autostart, const gchar *username)
{
Session *session;
+ Session *user_session;
- session = SEAT_GET_CLASS (seat)->create_session (seat);
+ user_session = find_user_session (seat, username, NULL);
+ session = SEAT_GET_CLASS (seat)->create_session (seat, user_session);
seat->priv->sessions = g_list_append (seat->priv->sessions, session);
if (autostart)
g_signal_connect (session, "authentication-complete", G_CALLBACK (session_authentication_complete_cb), seat);
const gchar *desktop_name;
gchar **argv;
- session = create_session (seat, autostart);
+ session = create_session (seat, autostart, username);
session_set_session_type (session, session_config_get_session_type (session_config));
session_set_env (session, "DESKTOP_SESSION", session_name);
session_set_env (session, "GDMSESSION", session_name);
return NULL;
}
- session = create_session (seat, TRUE);
+ session = create_session (seat, TRUE, NULL);
session_set_session_type (session, session_config_get_session_type (session_config));
session_set_do_authenticate (session, TRUE);
session_set_is_guest (session, TRUE);
}
static Session *
-greeter_create_session_cb (Greeter *greeter, Seat *seat)
+greeter_create_session_cb (Greeter *greeter, Seat *seat, const gchar *username)
{
Session *session;
- session = create_session (seat, FALSE);
+ session = create_session (seat, FALSE, username);
session_set_session_type (session, session_get_session_type (SESSION (greeter)));
session_set_display_server (session, session_get_display_server (SESSION (greeter)));
greeter_session = SEAT_GET_CLASS (seat)->create_greeter_session (seat);
session_set_session_type (SESSION (greeter_session), session_config_get_session_type (session_config));
seat->priv->sessions = g_list_append (seat->priv->sessions, SESSION (greeter_session));
+ g_signal_connect (greeter_session, "notify::active-username", G_CALLBACK (greeter_active_username_changed_cb), seat);
g_signal_connect (greeter_session, "authentication-complete", G_CALLBACK (session_authentication_complete_cb), seat);
g_signal_connect (greeter_session, "stopped", G_CALLBACK (session_stopped_cb), seat);
}
static Session *
-seat_real_create_session (Seat *seat)
+seat_real_create_session (Seat *seat, Session *user_session)
{
return session_new ();
}
{
}
+static void
+seat_real_set_next_session (Seat *seat, Session *session)
+{
+}
+
static Session *
seat_real_get_active_session (Seat *seat)
{
g_list_free_full (self->priv->sessions, g_object_unref);
if (self->priv->active_session)
g_object_unref (self->priv->active_session);
+ if (self->priv->next_session)
+ g_object_unref (self->priv->next_session);
if (self->priv->session_to_activate)
g_object_unref (self->priv->session_to_activate);
klass->create_session = seat_real_create_session;
klass->set_active_session = seat_real_set_active_session;
klass->get_active_session = seat_real_get_active_session;
+ klass->set_next_session = seat_real_set_next_session;
klass->run_script = seat_real_run_script;
klass->stop = seat_real_stop;