From 4c365a8e28adafd6619ada97d4239e9e6df429ab Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Mon, 19 Mar 2007 16:35:55 -0400 Subject: add CanActivateSessions to Seat interface And associated documentation and added to test-fus. --- doc/spec/ck-seat.xml | 12 ++++++++++++ doc/xml/ck-design.xml | 9 +++++++++ doc/xml/ref-ck-seat.xml | 12 +++++++----- src/ck-seat.c | 14 ++++++++++++++ src/ck-seat.h | 32 ++++++++++++++++---------------- src/ck-seat.xml | 3 +++ src/test-fus | 6 ++++++ 7 files changed, 67 insertions(+), 21 deletions(-) diff --git a/doc/spec/ck-seat.xml b/doc/spec/ck-seat.xml index 81fb1cc..1d154e7 100644 --- a/doc/spec/ck-seat.xml +++ b/doc/spec/ck-seat.xml @@ -52,6 +52,18 @@ seat at a time. + + + + TRUE if seat supports session activation + + + + Used to determine whether the seat supports session activation. + + + + diff --git a/doc/xml/ck-design.xml b/doc/xml/ck-design.xml index 086795c..1148773 100644 --- a/doc/xml/ck-design.xml +++ b/doc/xml/ck-design.xml @@ -61,6 +61,9 @@ The Session will remain open until the Session Leader disconnects from the D-Bus To determine which Seat it is running on. + To know if the current seat supports session switching. + + A list of all sessions on the current Seat. @@ -121,6 +124,12 @@ The Session will remain open until the Session Leader disconnects from the D-Bus To determine which session it is running in. + To determine which Seat it is running on. + + + To know if the current seat supports session switching. + + A list of all sessions on the current Seat. diff --git a/doc/xml/ref-ck-seat.xml b/doc/xml/ref-ck-seat.xml index 6161207..03f4176 100644 --- a/doc/xml/ref-ck-seat.xml +++ b/doc/xml/ref-ck-seat.xml @@ -8,10 +8,11 @@ Methods - GetId (out 'o' sid) -GetSessions (out 'ao' sessions) -GetActiveSession (out 'o' ssid) -ActivateSession (in 'o' ssid) + GetId (out 'o' sid) +GetSessions (out 'ao' sessions) +GetActiveSession (out 'o' ssid) +CanActivateSessions (out 'b' can_activate) +ActivateSession (in 'o' ssid) @@ -51,7 +52,8 @@ seat at a time. sessions:an array of Session IDs<anchor role="function" id="Seat.GetActiveSession"/>GetActiveSession ()GetActiveSessionSeatGetActiveSession (out 'o' ssid) Gets the Session ID that is currently active on this Seat. Returns NULL if there is no active session. - ssid:Session ID<anchor role="function" id="Seat.ActivateSession"/>ActivateSession ()ActivateSessionSeatActivateSession (in 'o' ssid) + ssid:Session ID<anchor role="function" id="Seat.CanActivateSessions"/>CanActivateSessions ()CanActivateSessionsSeatCanActivateSessions (out 'b' can_activate)Used to determine whether the seat supports session activation. + can_activate:TRUE if seat supports session activation<anchor role="function" id="Seat.ActivateSession"/>ActivateSession ()ActivateSessionSeatActivateSession (in 'o' ssid) Attempt to activate the specified session. In most cases, if successful, this will cause the session to become visible and take control of the hardware that is diff --git a/src/ck-seat.c b/src/ck-seat.c index 0b8ef80..06f0240 100644 --- a/src/ck-seat.c +++ b/src/ck-seat.c @@ -592,6 +592,20 @@ ck_seat_add_session (CkSeat *seat, return TRUE; } +gboolean +ck_seat_can_activate_sessions (CkSeat *seat, + gboolean *can_activate, + GError **error) +{ + g_return_val_if_fail (CK_IS_SEAT (seat), FALSE); + + if (can_activate != NULL) { + *can_activate = (seat->priv->kind == CK_SEAT_KIND_STATIC); + } + + return TRUE; +} + gboolean ck_seat_get_kind (CkSeat *seat, CkSeatKind *kind, diff --git a/src/ck-seat.h b/src/ck-seat.h index 0b13eb4..4707bf9 100644 --- a/src/ck-seat.h +++ b/src/ck-seat.h @@ -89,22 +89,22 @@ gboolean ck_seat_set_active_session (CkSeat *seat, GError **error); /* exported methods */ -gboolean ck_seat_get_id (CkSeat *seat, - char **sid, - GError **error); -gboolean ck_seat_get_seat_type (CkSeat *seat, - char **type, - GError **error); -gboolean ck_seat_get_sessions (CkSeat *seat, - GPtrArray **sessions, - GError **error); -gboolean ck_seat_get_active_session (CkSeat *seat, - char **ssid, - GError **error); - -gboolean ck_seat_activate_session (CkSeat *seat, - const char *ssid, - DBusGMethodInvocation *context); +gboolean ck_seat_get_id (CkSeat *seat, + char **sid, + GError **error); +gboolean ck_seat_get_sessions (CkSeat *seat, + GPtrArray **sessions, + GError **error); +gboolean ck_seat_get_active_session (CkSeat *seat, + char **ssid, + GError **error); + +gboolean ck_seat_can_activate_sessions (CkSeat *seat, + gboolean *can_activate, + GError **error); +gboolean ck_seat_activate_session (CkSeat *seat, + const char *ssid, + DBusGMethodInvocation *context); G_END_DECLS diff --git a/src/ck-seat.xml b/src/ck-seat.xml index c6d3ed6..5fda057 100644 --- a/src/ck-seat.xml +++ b/src/ck-seat.xml @@ -10,6 +10,9 @@ + + + diff --git a/src/test-fus b/src/test-fus index 3ac7921..f904ea9 100755 --- a/src/test-fus +++ b/src/test-fus @@ -45,6 +45,12 @@ seat.connect_to_signal ('SessionAdded', session_added_cb) seat.connect_to_signal ('SessionRemoved', session_removed_cb) seat.connect_to_signal ('ActiveSessionChanged', active_session_changed_cb) +can_fus = seat.CanActivateSessions() +if can_fus: + print "The current seat supports session switching" +else: + print "The current seat does not support session switching" + # Show a list of sessions on the current seat sessions = seat.GetSessions () for ssid in sessions: -- cgit