aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-02-08 16:43:34 -0600
committerTed Gould <ted@gould.cx>2010-02-08 16:43:34 -0600
commit40be2d62a4014ed8238b5a64952bcb148eeba500 (patch)
treebfcc7e0f5610b612908c9aff2402a790ef34ced6 /src
parent3ac26591413939bbf52e2303eb5ba5010c28d71b (diff)
parent751fbe8b0f5c049abdaa007b104772691305e21f (diff)
downloadayatana-indicator-session-40be2d62a4014ed8238b5a64952bcb148eeba500.tar.gz
ayatana-indicator-session-40be2d62a4014ed8238b5a64952bcb148eeba500.tar.bz2
ayatana-indicator-session-40be2d62a4014ed8238b5a64952bcb148eeba500.zip
Only get the screensaver proxy when needed.
Diffstat (limited to 'src')
-rw-r--r--src/lock-helper.c34
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;
}