diff options
author | Ted Gould <ted@gould.cx> | 2010-08-12 11:37:15 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-08-12 11:37:15 -0500 |
commit | 5988e5b24d22184ce32beb9a16644f28fe8d4841 (patch) | |
tree | af60584f3ffb7176402a9a8e535335ef0c9f3e65 /src/lock-helper.c | |
parent | 906f7922bbf1875f3fd666ff1e40f1635c52af4c (diff) | |
parent | 3b5cc0042799d3d5796bb22f61aafc3837ffdd59 (diff) | |
download | ayatana-indicator-session-5988e5b24d22184ce32beb9a16644f28fe8d4841.tar.gz ayatana-indicator-session-5988e5b24d22184ce32beb9a16644f28fe8d4841.tar.bz2 ayatana-indicator-session-5988e5b24d22184ce32beb9a16644f28fe8d4841.zip |
Import upstream version 0.2.10
Diffstat (limited to 'src/lock-helper.c')
-rw-r--r-- | src/lock-helper.c | 85 |
1 files changed, 6 insertions, 79 deletions
diff --git a/src/lock-helper.c b/src/lock-helper.c index ba6b182..9b15070 100644 --- a/src/lock-helper.c +++ b/src/lock-helper.c @@ -176,9 +176,11 @@ build_gss_proxy (void) static gboolean activate_timeout (gpointer data) { + /* Clear the ID for the timeout */ guint * address = (guint *)data; *address = 0; + /* Quit the mainloop */ if (gss_mainloop != NULL) { g_main_loop_quit(gss_mainloop); } @@ -186,22 +188,6 @@ activate_timeout (gpointer data) return FALSE; } -/* Handle errors from activating the screensaver */ -static void -active_cb (DBusGProxy * proxy, DBusGProxyCall * call, gpointer user_data) -{ - GError * error = NULL; - - dbus_g_proxy_end_call(proxy, call, &error, G_TYPE_INVALID); - - if (error != NULL) { - g_warning("Unable to activate screensaver: %s", error->message); - g_error_free(error); - } - - return; -} - /* A fun little function to actually lock the screen. If, that's what you want, let's do it! */ void @@ -212,19 +198,10 @@ lock_screen (DbusmenuMenuitem * mi, guint timestamp, gpointer data) build_gss_proxy(); g_return_if_fail(gss_proxy != NULL); - if (will_lock_screen()) { - dbus_g_proxy_call_no_reply(gss_proxy, - "Lock", - G_TYPE_INVALID, - G_TYPE_INVALID); - } else { - dbus_g_proxy_begin_call(gss_proxy, - "SetActive", - active_cb, NULL, - NULL, - G_TYPE_BOOLEAN, TRUE, - G_TYPE_INVALID); - } + dbus_g_proxy_call_no_reply(gss_proxy, + "Lock", + G_TYPE_INVALID, + G_TYPE_INVALID); if (gss_mainloop == NULL) { gss_mainloop = g_main_loop_new(NULL, FALSE); @@ -253,53 +230,3 @@ lock_screen_setup (gpointer data) return FALSE; } -/* When the GConf key changes we need to adjust the text on - what we're going to do with the menu item */ -static void -lockscreen_update (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer data) { - DbusmenuMenuitem * mi = (DbusmenuMenuitem*) data; - const gchar * key = gconf_entry_get_key (entry); - - if(g_strcmp0 (key, GCONF_KEY) == 0) { - if (will_lock_screen()) { - dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Lock Screen")); - } else { - dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Start Screensaver")); - } - } -} - -/* Notification handler for lock menuitems. */ -static guint lock_notify = 0; - -/* Sets the menu item to be updating. There can - only be one. So we clear and reset if we get - another. */ -void -lock_screen_update_item (DbusmenuMenuitem * mi) -{ - if (gconf_client == NULL) { - gconf_client = gconf_client_get_default(); - } - - if (lock_notify == 0) { - gconf_client_add_dir (gconf_client, - GCONF_DIR, - GCONF_CLIENT_PRELOAD_ONELEVEL, - NULL); - } - - if (lock_notify != 0) { - gconf_client_notify_remove(gconf_client, lock_notify); - lock_notify = 0; - } - - lock_notify = gconf_client_notify_add(gconf_client, - GCONF_KEY, - lockscreen_update, - mi, - NULL, - NULL); - - return; -} |