| Top |
These functions let applications inhibit certain login session state changes, and be informed about the impending end of the session.
A typical use for this functionality is to prevent the session from locking while a video is playing.
The underlying portal is org.freedesktop.portal.Inhibit.
void xdp_portal_session_inhibit (XdpPortal *portal,XdpParent *parent,XdpInhibitFlags inhibit,const char *reason,const char *id);
Inhibits various session status changes.
It is the callers responsibility to ensure that the ID is unique among all active inhibitors.
To remove an active inhibitor, call xdp_portal_session_uninhibit()
with the same ID.
void xdp_portal_session_uninhibit (XdpPortal *portal,const char *id);
Removes an inhibitor that was created by a call
to xdp_portal_session_inhibit().
void xdp_portal_session_monitor_start (XdpPortal *portal,XdpParent *parent,GCancellable *cancellable,GAsyncReadyCallback callback,gpointer data);
Makes XdpPortal start monitoring the login session state.
When the state changes, the “session-state-changed” signal is emitted.
Use xdp_portal_session_monitor_stop() to stop monitoring.
portal |
||
parent |
a XdpParent, or |
[nullable] |
cancellable |
optional GCancellable. |
[nullable] |
callback |
a callback to call when the request is done. |
[scope async] |
data |
data to pass to |
[closure] |
gboolean xdp_portal_session_monitor_start_finish (XdpPortal *portal,GAsyncResult *result,GError **error);
Finishes a session-monitor request, and returns the result in the form of boolean.
void
xdp_portal_session_monitor_stop (XdpPortal *portal);
Stops session state monitoring that was started with
xdp_portal_session_monitor_start().
void
xdp_portal_session_monitor_query_end_response
(XdpPortal *portal);
This method should be called within one second of receiving a “session-state-changed” signal with the 'Query End' state, to acknowledge that they have handled the state change.
Possible ways to handle the state change are either
to call xdp_portal_session_inhibit() to prevent the
session from ending, or to save your state and get
ready for the session to end.
The values of this enum are returned in the “session-state-changed” signal to indicate the current state of the user session.