aboutsummaryrefslogtreecommitdiff
path: root/src/backend-dbus/actions.c
diff options
context:
space:
mode:
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2014-04-10 06:58:04 +0200
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2014-04-10 06:58:04 +0200
commit78112284ec71ea481625408455835e1dc4e0d7f2 (patch)
tree9d8b8a247002c8156cdc1eecac771950b7988f44 /src/backend-dbus/actions.c
parent4ad55d6c928cff40ed58a6a12971355a6757bc53 (diff)
downloadayatana-indicator-session-78112284ec71ea481625408455835e1dc4e0d7f2.tar.gz
ayatana-indicator-session-78112284ec71ea481625408455835e1dc4e0d7f2.tar.bz2
ayatana-indicator-session-78112284ec71ea481625408455835e1dc4e0d7f2.zip
actions: add have_unity_session to check if unity is currently running and exporting his session bus
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);