diff options
author | Ted Gould <ted@gould.cx> | 2010-02-08 10:55:24 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-02-08 10:55:24 -0600 |
commit | b981b3a21f94a9786c043a48dc57670c2d12e6dd (patch) | |
tree | c2a5a5cec4300a56c13cd49071e8ec0a1290df64 /src | |
parent | 4b6ca8a15df3a57ba2a54c76a90090f9360709a7 (diff) | |
parent | 751fbe8b0f5c049abdaa007b104772691305e21f (diff) | |
download | ayatana-indicator-session-b981b3a21f94a9786c043a48dc57670c2d12e6dd.tar.gz ayatana-indicator-session-b981b3a21f94a9786c043a48dc57670c2d12e6dd.tar.bz2 ayatana-indicator-session-b981b3a21f94a9786c043a48dc57670c2d12e6dd.zip |
Kill screensaver autobuild proxy
Diffstat (limited to 'src')
-rw-r--r-- | src/lock-helper.c | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/src/lock-helper.c b/src/lock-helper.c index ded1b33..24b76ed 100644 --- a/src/lock-helper.c +++ b/src/lock-helper.c @@ -35,6 +35,8 @@ static gboolean is_guest = FALSE; static gdm_autologin_cb_t gdm_autologin_cb = NULL; +void build_gss_proxy (void); + /* Checks to see if there is an error and reports it. Not much else we can do. */ static void @@ -56,6 +58,9 @@ screensaver_unthrottle (void) { g_return_if_fail(cookie != 0); + build_gss_proxy(); + g_return_if_fail(gss_proxy != NULL); + dbus_g_proxy_begin_call(gss_proxy, "UnThrottle", unthrottle_return, NULL, NULL, @@ -103,6 +108,9 @@ screensaver_throttle (gchar * reason) screensaver_unthrottle(); } + build_gss_proxy(); + g_return_if_fail(gss_proxy != NULL); + cookie_call = dbus_g_proxy_begin_call(gss_proxy, "Throttle", throttle_return, NULL, NULL, @@ -245,17 +253,19 @@ gss_active_changed (DBusGProxy * proxy, gboolean active, gpointer data) void build_gss_proxy (void) { - DBusGConnection * session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); - g_return_if_fail(session_bus != NULL); - - gss_proxy = dbus_g_proxy_new_for_name(session_bus, - "org.gnome.ScreenSaver", - "/", - "org.gnome.ScreenSaver"); - g_return_if_fail(gss_proxy != NULL); - - dbus_g_proxy_add_signal(gss_proxy, "ActiveChanged", G_TYPE_BOOLEAN, G_TYPE_INVALID); - dbus_g_proxy_connect_signal(gss_proxy, "ActiveChanged", G_CALLBACK(gss_active_changed), NULL, NULL); + if (gss_proxy == NULL) { + DBusGConnection * session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); + g_return_if_fail(session_bus != NULL); + + gss_proxy = dbus_g_proxy_new_for_name(session_bus, + "org.gnome.ScreenSaver", + "/", + "org.gnome.ScreenSaver"); + g_return_if_fail(gss_proxy != NULL); + + dbus_g_proxy_add_signal(gss_proxy, "ActiveChanged", G_TYPE_BOOLEAN, G_TYPE_INVALID); + dbus_g_proxy_connect_signal(gss_proxy, "ActiveChanged", G_CALLBACK(gss_active_changed), NULL, NULL); + } return; } @@ -286,6 +296,7 @@ lock_screen (DbusmenuMenuitem * mi, guint timestamp, gpointer data) return; } + build_gss_proxy(); g_return_if_fail(gss_proxy != NULL); dbus_g_proxy_call_no_reply(gss_proxy, @@ -318,7 +329,6 @@ lock_screen_setup (gpointer data) } build_gdm_proxy(); - build_gss_proxy(); return FALSE; } |