aboutsummaryrefslogtreecommitdiff
path: root/src/backend-dbus/actions.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend-dbus/actions.c')
-rw-r--r--src/backend-dbus/actions.c37
1 files changed, 25 insertions, 12 deletions
diff --git a/src/backend-dbus/actions.c b/src/backend-dbus/actions.c
index b5810a7..f395e12 100644
--- a/src/backend-dbus/actions.c
+++ b/src/backend-dbus/actions.c
@@ -777,8 +777,8 @@ my_about (IndicatorSessionActions * self G_GNUC_UNUSED)
****
***/
-static void
-lock_current_session (IndicatorSessionActions * self, gboolean immediate)
+static gboolean
+have_unity_session (IndicatorSessionActions * self)
{
priv_t * p = INDICATOR_SESSION_ACTIONS_DBUS(self)->priv;
gchar * name_owner;
@@ -789,20 +789,33 @@ lock_current_session (IndicatorSessionActions * self, gboolean immediate)
if (name_owner)
{
- if (immediate)
- {
- unity_session_call_prompt_lock (p->unity_session, p->cancellable, NULL, NULL);
- }
- else
- {
- unity_session_call_lock (p->unity_session, p->cancellable, NULL, NULL);
- }
-
g_free (name_owner);
- return;
+ return TRUE;
}
}
+ return FALSE;
+}
+
+static void
+lock_current_session (IndicatorSessionActions * self, gboolean immediate)
+{
+ priv_t * p = INDICATOR_SESSION_ACTIONS_DBUS(self)->priv;
+
+ if (have_unity_session (self))
+ {
+ if (immediate)
+ {
+ unity_session_call_prompt_lock (p->unity_session, p->cancellable, NULL, NULL);
+ }
+ else
+ {
+ unity_session_call_lock (p->unity_session, p->cancellable, NULL, NULL);
+ }
+
+ return;
+ }
+
g_return_if_fail (p->screen_saver != NULL);
gnome_screen_saver_call_lock (p->screen_saver, p->cancellable, NULL, NULL);