diff options
author | Eric Koegel <eric.koegel@gmail.com> | 2017-07-20 07:46:35 +0300 |
---|---|---|
committer | Eric Koegel <eric.koegel@gmail.com> | 2017-07-23 05:41:48 +0300 |
commit | 3a5d440397ab095e1e78509c0f725b79d5773076 (patch) | |
tree | 62cabc7035821a79de9fc1e9006270b27885cea0 | |
parent | 66b4026cb1f1019a66e7aed111c8760fdb9ecbfd (diff) | |
download | ConsoleKit2-3a5d440397ab095e1e78509c0f725b79d5773076.tar.gz |
feat: Add CanControlSession dbus call
This way a program can query whether CK2 can actually do the
Session Controller stuff before attempting to call TakeControl.
-rw-r--r-- | data/ConsoleKit.conf | 3 | ||||
-rw-r--r-- | src/ck-session.c | 9 | ||||
-rw-r--r-- | src/org.freedesktop.ConsoleKit.Session.xml | 15 |
3 files changed, 27 insertions, 0 deletions
diff --git a/data/ConsoleKit.conf b/data/ConsoleKit.conf index 9c564ce..6c10476 100644 --- a/data/ConsoleKit.conf +++ b/data/ConsoleKit.conf @@ -209,6 +209,9 @@ send_member="SetLockedHint"/> <allow send_destination="org.freedesktop.ConsoleKit" send_interface="org.freedesktop.ConsoleKit.Session" + send_member="CanControlSession"/> + <allow send_destination="org.freedesktop.ConsoleKit" + send_interface="org.freedesktop.ConsoleKit.Session" send_member="TakeControl"/> <allow send_destination="org.freedesktop.ConsoleKit" send_interface="org.freedesktop.ConsoleKit.Session" diff --git a/src/ck-session.c b/src/ck-session.c index f445dff..7b05428 100644 --- a/src/ck-session.c +++ b/src/ck-session.c @@ -1602,6 +1602,14 @@ ck_session_set_session_controller (CkSession *session, } static gboolean +dbus_can_control_session (ConsoleKitSession *object, + GDBusMethodInvocation *invocation) +{ + console_kit_session_complete_can_control_session (object, invocation, ck_device_is_server_managed ()); + return TRUE; +} + +static gboolean dbus_take_control (ConsoleKitSession *object, GDBusMethodInvocation *invocation, gboolean arg_force) @@ -2079,6 +2087,7 @@ ck_session_iface_init (ConsoleKitSessionIface *iface) iface->handle_unlock = dbus_unlock; iface->handle_get_idle_hint = dbus_get_idle_hint; iface->handle_get_xdgruntime_dir = dbus_get_runtime_dir; + iface->handle_can_control_session = dbus_can_control_session; iface->handle_take_control = dbus_take_control; iface->handle_release_control = dbus_release_control; iface->handle_take_device = dbus_take_device; diff --git a/src/org.freedesktop.ConsoleKit.Session.xml b/src/org.freedesktop.ConsoleKit.Session.xml index f899103..97ceb64 100644 --- a/src/org.freedesktop.ConsoleKit.Session.xml +++ b/src/org.freedesktop.ConsoleKit.Session.xml @@ -368,6 +368,21 @@ </doc:doc> </method> + <method name="CanControlSession"> + <arg name="controller_supported" type="b" direction="out"> + <doc:doc> + <doc:summary>Whether the system supports a session controller.</doc:summary> + </doc:doc> + </arg> + <doc:doc> + <doc:description> + <doc:para>Returns TRUE if the system has Session Controller support. This means + the TakeControl call won't return CK_SESSION_ERROR_NOT_SUPPORTED.</doc:para> + <doc:para>Since 1.3.0</doc:para> + </doc:description> + </doc:doc> + </method> + <method name="TakeControl"> <arg name="force" type="b" direction="in"> <doc:doc> |