diff options
author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2014-04-10 06:58:04 +0200 |
---|---|---|
committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2014-04-10 06:58:04 +0200 |
commit | 78112284ec71ea481625408455835e1dc4e0d7f2 (patch) | |
tree | 9d8b8a247002c8156cdc1eecac771950b7988f44 | |
parent | 4ad55d6c928cff40ed58a6a12971355a6757bc53 (diff) | |
download | ayatana-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
-rw-r--r-- | src/backend-dbus/actions.c | 37 | ||||
-rw-r--r-- | src/backend-dbus/org.gnome.ScreenSaver.xml | 3 |
2 files changed, 25 insertions, 15 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); diff --git a/src/backend-dbus/org.gnome.ScreenSaver.xml b/src/backend-dbus/org.gnome.ScreenSaver.xml index c21fdc5..a1da786 100644 --- a/src/backend-dbus/org.gnome.ScreenSaver.xml +++ b/src/backend-dbus/org.gnome.ScreenSaver.xml @@ -8,9 +8,6 @@ <method name="Lock"> </method> - <method name="SimulateUserActivity"> - </method> - </interface> </node> |