diff options
Diffstat (limited to 'src/lightdm.c')
-rw-r--r-- | src/lightdm.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/lightdm.c b/src/lightdm.c index fdebd682..48a44ab5 100644 --- a/src/lightdm.c +++ b/src/lightdm.c @@ -1078,6 +1078,23 @@ login1_can_graphical_changed_cb (Login1Seat *login1_seat) } static void +login1_active_session_changed_cb (Login1Seat *login1_seat, const gchar *login1_session_id) +{ + g_debug ("Seat %s changes active session to %s", login1_seat_get_id (login1_seat), login1_session_id); +} + +static gboolean +login1_add_seat (Login1Seat *login1_seat) +{ + if (config_get_boolean (config_get_instance (), "LightDM", "logind-check-graphical")) + g_signal_connect (login1_seat, "can-graphical-changed", G_CALLBACK (login1_can_graphical_changed_cb), NULL); + + g_signal_connect (login1_seat, LOGIN1_SIGNAL_ACTIVE_SESION_CHANGED, G_CALLBACK (login1_active_session_changed_cb), NULL); + + return update_login1_seat (login1_seat); +} + +static void login1_service_seat_added_cb (Login1Service *service, Login1Seat *login1_seat) { if (login1_seat_get_can_graphical (login1_seat)) @@ -1085,9 +1102,7 @@ login1_service_seat_added_cb (Login1Service *service, Login1Seat *login1_seat) else g_debug ("Seat %s added from logind without graphical output", login1_seat_get_id (login1_seat)); - if (config_get_boolean (config_get_instance (), "LightDM", "logind-check-graphical")) - g_signal_connect (login1_seat, LOGIN1_SEAT_SIGNAL_CAN_GRAPHICAL_CHANGED, G_CALLBACK (login1_can_graphical_changed_cb), NULL); - update_login1_seat (login1_seat); + login1_add_seat (login1_seat); } static void @@ -1095,6 +1110,7 @@ login1_service_seat_removed_cb (Login1Service *service, Login1Seat *login1_seat) { g_debug ("Seat %s removed from logind", login1_seat_get_id (login1_seat)); g_signal_handlers_disconnect_matched (login1_seat, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, login1_can_graphical_changed_cb, NULL); + g_signal_handlers_disconnect_matched (login1_seat, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, login1_active_session_changed_cb, NULL); remove_login1_seat (login1_seat); } @@ -1442,9 +1458,7 @@ main (int argc, char **argv) for (link = login1_service_get_seats (login1_service_get_instance ()); link; link = link->next) { Login1Seat *login1_seat = link->data; - if (config_get_boolean (config_get_instance (), "LightDM", "logind-check-graphical")) - g_signal_connect (login1_seat, LOGIN1_SEAT_SIGNAL_CAN_GRAPHICAL_CHANGED, G_CALLBACK (login1_can_graphical_changed_cb), NULL); - if (!update_login1_seat (login1_seat)) + if (!login1_add_seat (login1_seat)) return EXIT_FAILURE; } } |