diff options
Diffstat (limited to 'tests/src/test-runner.c')
-rw-r--r-- | tests/src/test-runner.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/src/test-runner.c b/tests/src/test-runner.c index abad4865..e66dead8 100644 --- a/tests/src/test-runner.c +++ b/tests/src/test-runner.c @@ -110,6 +110,7 @@ typedef struct gchar *path; gboolean can_graphical; gboolean can_multi_session; + gchar *active_session; } Login1Seat; static GList *login1_seats = NULL; @@ -142,6 +143,7 @@ static void check_status (const gchar *status); static AccountsUser *get_accounts_user_by_uid (guint uid); static AccountsUser *get_accounts_user_by_name (const gchar *username); static void accounts_user_set_hidden (AccountsUser *user, gboolean hidden, gboolean emit_signal); +static Login1Session *find_login1_session (const gchar *id); static gboolean kill_timeout_cb (gpointer data) @@ -567,6 +569,13 @@ handle_command (const gchar *command) seat->can_multi_session = strcmp (v, "TRUE") == 0; g_variant_builder_add (&invalidated_properties, "s", "CanMultiSession"); } + v = g_hash_table_lookup (params, "ACTIVE-SESSION"); + if (v) + { + g_free (seat->active_session); + seat->active_session = g_strdup (v); + g_variant_builder_add (&invalidated_properties, "s", "ActiveSession"); + } g_dbus_connection_emit_signal (g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL), NULL, @@ -917,6 +926,26 @@ handle_command (const gchar *command) check_status (status_text); g_free (status_text); } + else if (strcmp (name, "UNLOCK-SESSION") == 0) + { + gchar *status_text, *id; + Login1Session *session; + + id = g_hash_table_lookup (params, "SESSION"); + session = find_login1_session (id); + if (session) + { + if (!session->locked) + g_warning ("Session %s is not locked", id); + session->locked = FALSE; + } + else + g_warning ("Unknown session %s", id); + + status_text = g_strdup_printf ("RUNNER UNLOCK-SESSION SESSION=%s", id); + check_status (status_text); + g_free (status_text); + } /* Forward to external processes */ else if (g_str_has_prefix (name, "SESSION-") || g_str_has_prefix (name, "GREETER-") || @@ -1481,6 +1510,22 @@ handle_login1_seat_get_property (GDBusConnection *connection, return g_variant_new_boolean (seat->can_multi_session); else if (strcmp (property_name, "Id") == 0) return g_variant_new_string (seat->id); + else if (strcmp (property_name, "ActiveSession") == 0) + { + if (seat->active_session) + { + gchar *path; + GVariant *ret; + + path = g_strdup_printf ("/org/freedesktop/login1/session/%s", seat->active_session); + ret = g_variant_new ("(so)", seat->active_session, path); + g_free (path); + + return ret; + } + else + return NULL; + } else return NULL; } @@ -1497,6 +1542,7 @@ add_login1_seat (GDBusConnection *connection, const gchar *id, gboolean emit_sig " <interface name='org.freedesktop.login1.Seat'>" " <property name='CanGraphical' type='b' access='read'/>" " <property name='CanMultiSession' type='b' access='read'/>" + " <property name='ActiveSession' type='(so)' access='read'/>" " <property name='Id' type='s' access='read'/>" " </interface>" "</node>"; @@ -1512,6 +1558,7 @@ add_login1_seat (GDBusConnection *connection, const gchar *id, gboolean emit_sig seat->path = g_strdup_printf ("/org/freedesktop/login1/seat/%s", seat->id); seat->can_graphical = TRUE; seat->can_multi_session = TRUE; + seat->active_session = NULL; login1_seat_info = g_dbus_node_info_new_for_xml (login1_seat_interface, &error); if (error) @@ -1589,6 +1636,7 @@ remove_login1_seat (GDBusConnection *connection, const gchar *id) login1_seats = g_list_remove (login1_seats, seat); g_free (seat->id); g_free (seat->path); + g_free (seat->active_session); g_free (seat); } |