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
,const char *reason
,XdpInhibitFlags inhibit
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer data
);
Inhibits various session status changes.
To obtain an ID that can be used to undo the inhibition, use
xdp_portal_session_inhibit_finish()
in the callback.
To remove an active inhibitor, call xdp_portal_session_uninhibit()
with the same ID.
portal |
||
parent |
parent window information. |
[nullable] |
reason |
user-visible reason for the inhibition. |
[nullable] |
flags |
information about what to inhibit |
|
cancellable |
optional GCancellable. |
[nullable] |
callback |
a callback to call when the request is done. |
[scope async] |
data |
data to pass to |
[closure] |
int xdp_portal_session_inhibit_finish (XdpPortal *portal
,GAsyncResult *result
,GError **error
);
Finishes the inhbit request, and returns the ID of the
inhibition as a positive integer. The ID can be passed to
xdg_portal_session_uninhibit()
to undo the inhibition.
void xdp_portal_session_uninhibit (XdpPortal *portal
,int 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
,XdpSessionMonitorFlags flags
,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] |
flags |
options for this call |
|
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.