diff options
author | Conor Curran <conor.curran@canonical.com> | 2011-08-18 12:27:36 +0100 |
---|---|---|
committer | Conor Curran <conor.curran@canonical.com> | 2011-08-18 12:27:36 +0100 |
commit | fbc3c1069a1472d0c5229eb6bcd583e784fcc963 (patch) | |
tree | d88fd9b5ab2200bfe29df74e9c291ffee19f9461 | |
parent | 1909ed838f14287d156e3ad9d619f7604534dae6 (diff) | |
parent | 4e71b293536e2b3091d323bd92f24538bb41d1a9 (diff) | |
download | ayatana-indicator-session-fbc3c1069a1472d0c5229eb6bcd583e784fcc963.tar.gz ayatana-indicator-session-fbc3c1069a1472d0c5229eb6bcd583e784fcc963.tar.bz2 ayatana-indicator-session-fbc3c1069a1472d0c5229eb6bcd583e784fcc963.zip |
merged mterry's move over to gsettings
-rw-r--r-- | src/lock-helper.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/lock-helper.c b/src/lock-helper.c index 9b15070..4c91aa5 100644 --- a/src/lock-helper.c +++ b/src/lock-helper.c @@ -20,12 +20,12 @@ with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <glib/gi18n.h> -#include <gconf/gconf-client.h> +#include <gio/gio.h> #include <dbus/dbus-glib.h> #include "lock-helper.h" -#define GCONF_DIR "/apps/gnome-screensaver" -#define GCONF_KEY GCONF_DIR "/lock_enabled" +#define SCREENSAVER_SCHEMA "org.gnome.desktop.screensaver" +#define SCREENSAVER_LOCK_ENABLED_KEY "lock-enabled" static DBusGProxy * gss_proxy = NULL; static GMainLoop * gss_mainloop = NULL; @@ -34,7 +34,7 @@ static DBusGProxyCall * cookie_call = NULL; static gboolean is_guest = FALSE; -static GConfClient * gconf_client = NULL; +static GSettings * settings = NULL; void build_gss_proxy (void); @@ -131,11 +131,11 @@ will_lock_screen (void) return FALSE; } - if (gconf_client == NULL) { - gconf_client = gconf_client_get_default(); + if (settings == NULL) { + settings = g_settings_new (SCREENSAVER_SCHEMA); } - return gconf_client_get_bool (gconf_client, GCONF_KEY, NULL); + return g_settings_get_boolean (settings, SCREENSAVER_LOCK_ENABLED_KEY); } /* When the screensave go active, if we've got a mainloop @@ -150,11 +150,22 @@ gss_active_changed (DBusGProxy * proxy, gboolean active, gpointer data) return; } +static gboolean +get_greeter_mode (void) +{ + const gchar *var; + var = g_getenv("INDICATOR_GREETER_MODE"); + return (g_strcmp0(var, "1") == 0); +} + /* Build the gss proxy and set up it's signals */ void build_gss_proxy (void) { if (gss_proxy == NULL) { + if (get_greeter_mode ()) + return; /* Don't start/lock the screensaver from the login screen */ + DBusGConnection * session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); g_return_if_fail(session_bus != NULL); |