summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Ancell <robert.ancell@canonical.com>2013-06-28 21:18:31 +1200
committerRobert Ancell <robert.ancell@canonical.com>2013-06-28 21:18:31 +1200
commitad54887aea7d6e72ef6f12c04199e6afe4ad1a8a (patch)
tree28fccb93a0eeaad627981c5a6b240bccc9a6eade
parentd7ab0d7189fb8cc97da8cbcd4703ce1bc672874e (diff)
downloadlightdm-ad54887aea7d6e72ef6f12c04199e6afe4ad1a8a.tar.gz
Link up some code to start sessions on a new display
-rw-r--r--src/display.c57
-rw-r--r--src/display.h3
-rw-r--r--src/ldm-marshal.list1
-rw-r--r--src/seat.c16
4 files changed, 74 insertions, 3 deletions
diff --git a/src/display.c b/src/display.c
index deab9f40..9ef61a12 100644
--- a/src/display.c
+++ b/src/display.c
@@ -30,6 +30,7 @@ enum
DISPLAY_SERVER_READY,
START_GREETER,
START_SESSION,
+ CREATE_DISPLAY,
STOPPED,
LAST_SIGNAL
};
@@ -366,6 +367,17 @@ greeter_start_authentication_cb (Greeter *greeter, const gchar *username, Displa
return create_session (display);
}
+
+static Display *
+create_display (Display *display, Session *session)
+{
+ Display *d;
+
+ g_signal_emit (display, signals[CREATE_DISPLAY], 0, session, &d);
+
+ return d;
+}
+
static gboolean
greeter_start_session_cb (Greeter *greeter, SessionType type, const gchar *session_name, Display *display)
{
@@ -401,9 +413,14 @@ greeter_start_session_cb (Greeter *greeter, SessionType type, const gchar *sessi
return TRUE;
}
- /* Stop the greeter, the session will start when the greeter has quit */
- g_debug ("Stopping greeter");
- session_stop (display->priv->session);
+ /* If we can re-use this display server, then stop the greeter and start the session when it is done */
+ if (display->priv->share_display_server)
+ {
+ g_debug ("Stopping greeter");
+ session_stop (display->priv->session);
+ }
+ else
+ create_display (display, greeter_get_authentication_session (greeter));
return TRUE;
}
@@ -790,6 +807,14 @@ display_server_ready_cb (DisplayServer *display_server, Display *display)
return;
}
+ /* If already have a session, run it */
+ if (display->priv->session != NULL)
+ {
+ if (!display_start_session (display))
+ display_stop (display);
+ return;
+ }
+
/* Don't run any sessions on local terminals */
if (!display_server_get_start_local_sessions (display_server))
return;
@@ -839,6 +864,17 @@ display_start (Display *display)
}
gboolean
+display_start_with_session (Display *display, Session *session)
+{
+ g_return_val_if_fail (display != NULL, FALSE);
+ g_return_val_if_fail (session != NULL, FALSE);
+
+ // FIXME: Store the session
+
+ return display_start (display);
+}
+
+gboolean
display_get_is_ready (Display *display)
{
g_return_val_if_fail (display != NULL, FALSE);
@@ -929,6 +965,12 @@ display_real_get_guest_username (Display *display)
return NULL;
}
+static Display *
+display_real_create_display (Display *display, Session *session)
+{
+ return NULL;
+}
+
static void
display_init (Display *display)
{
@@ -973,6 +1015,7 @@ display_class_init (DisplayClass *klass)
klass->get_guest_username = display_real_get_guest_username;
klass->start_greeter = display_start_greeter;
klass->start_session = display_start_session;
+ klass->create_display = display_real_create_display;
object_class->finalize = display_finalize;
g_type_class_add_private (klass, sizeof (DisplayPrivate));
@@ -1044,6 +1087,14 @@ display_class_init (DisplayClass *klass)
g_signal_accumulator_true_handled, NULL,
ldm_marshal_BOOLEAN__VOID,
G_TYPE_BOOLEAN, 0);
+ signals[CREATE_DISPLAY] =
+ g_signal_new ("create-display",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (DisplayClass, create_display),
+ NULL, NULL,
+ ldm_marshal_OBJECT__OBJECT,
+ DISPLAY_TYPE, 1, SESSION_TYPE);
signals[STOPPED] =
g_signal_new ("stopped",
G_TYPE_FROM_CLASS (klass),
diff --git a/src/display.h b/src/display.h
index c5ee9cd1..b8de1971 100644
--- a/src/display.h
+++ b/src/display.h
@@ -44,6 +44,7 @@ typedef struct
void (*ready)(Display *display);
gboolean (*switch_to_user)(Display *display, User *user);
gboolean (*switch_to_guest)(Display *display);
+ Display *(*create_display)(Display *display, Session *session);
gchar *(*get_guest_username)(Display *display);
void (*stopped)(Display *display);
} DisplayClass;
@@ -84,6 +85,8 @@ void display_set_user_session (Display *display, SessionType type, const gchar *
gboolean display_start (Display *display);
+gboolean display_start_with_session (Display *display, Session *session);
+
gboolean display_get_is_ready (Display *display);
void display_lock (Display *display);
diff --git a/src/ldm-marshal.list b/src/ldm-marshal.list
index 9be211ac..4edb9616 100644
--- a/src/ldm-marshal.list
+++ b/src/ldm-marshal.list
@@ -5,3 +5,4 @@ BOOLEAN:OBJECT
STRING:VOID
OBJECT:VOID
OBJECT:STRING
+OBJECT:OBJECT
diff --git a/src/seat.c b/src/seat.c
index 5ac18079..8bd1d3ee 100644
--- a/src/seat.c
+++ b/src/seat.c
@@ -54,6 +54,8 @@ typedef struct
} SeatModule;
static GHashTable *seat_modules = NULL;
+static Display *create_display (Seat *seat);
+
void
seat_register_module (const gchar *name, GType type)
{
@@ -409,6 +411,19 @@ display_ready_cb (Display *display, Seat *seat)
SEAT_GET_CLASS (seat)->set_active_display (seat, display);
}
+static Display *
+display_create_display_cb (Display *display, Session *session, Seat *seat)
+{
+ Display *d;
+
+ d = create_display (seat);
+ g_signal_emit (seat, signals[DISPLAY_ADDED], 0, d);
+
+ display_start_with_session (display, session);
+
+ return d;
+}
+
static void
check_stopped (Seat *seat)
{
@@ -492,6 +507,7 @@ create_display (Seat *seat)
g_signal_connect (display, "start-greeter", G_CALLBACK (display_start_greeter_cb), seat);
g_signal_connect (display, "start-session", G_CALLBACK (display_start_session_cb), seat);
g_signal_connect_after (display, "start-session", G_CALLBACK (display_session_started_cb), seat);
+ g_signal_connect (display, "create-display", G_CALLBACK (display_create_display_cb), seat);
g_signal_connect (display, "stopped", G_CALLBACK (display_stopped_cb), seat);
display_set_greeter_session (display, seat_get_string_property (seat, "greeter-session"));
display_set_session_wrapper (display, seat_get_string_property (seat, "session-wrapper"));