summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJesús González <jgonzalez@gdr-sistemas.com>2014-12-12 12:45:15 +1300
committerRobert Ancell <robert.ancell@canonical.com>2014-12-12 12:45:15 +1300
commit3580a693d35e7185d203d49ff46c2e002adc923c (patch)
treedb8440034c5200e6f2de4f3dff5c3a027465bb46 /src
parent8e9507c712c9fc53de23fabe79413f426bd85af7 (diff)
downloadlightdm-3580a693d35e7185d203d49ff46c2e002adc923c.tar.gz
Detect when logind changes the active session and log it (will be connected in the future)
Diffstat (limited to 'src')
-rw-r--r--src/lightdm.c26
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;
}
}