/* 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)
{
}
}
+static Session *
+find_user_session (Seat *seat, const gchar *username)
+{
+ GList *link;
+
+ if (!username)
+ return NULL;
+
+ for (link = seat->priv->sessions; link; link = link->next)
+ {
+ Session *session = link->data;
+
+ if (!session_get_is_stopping (session) && strcmp (session_get_username (session), username) == 0)
+ return session;
+ }
+
+ 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));
+ 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 *
-find_user_session (Seat *seat, const gchar *username)
-{
- GList *link;
-
- if (!username)
- return NULL;
-
- for (link = seat->priv->sessions; link; link = link->next)
- {
- Session *session = link->data;
-
- if (!session_get_is_stopping (session) && strcmp (session_get_username (session), username) == 0)
- return session;
- }
-
- return NULL;
-}
-
static Session *
create_session (Seat *seat, gboolean autostart, const gchar *username)
{
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 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;
Greeter *(*create_greeter_session) (Seat *seat);
Session *(*create_session) (Seat *seat, Session *user_session);
void (*set_active_session)(Seat *seat, Session *session);
+ void (*set_next_session)(Seat *seat, Session *session);
Session *(*get_active_session)(Seat *seat);
void (*run_script)(Seat *seat, DisplayServer *display_server, Process *script);
void (*stop)(Seat *seat);
Session *seat_get_active_session (Seat *seat);
+Session *seat_get_next_session (Seat *seat);
+
gboolean seat_get_can_switch (Seat *seat);
gboolean seat_get_allow_guest (Seat *seat);