diff options
author | Stefano Karapetsas <[email protected]> | 2012-11-26 21:23:39 +0100 |
---|---|---|
committer | Stefano Karapetsas <[email protected]> | 2012-11-26 21:23:39 +0100 |
commit | 09388d8e945ef0674bca82c5ba375d901b14e693 (patch) | |
tree | 1e2ccc89f49f671b8e245d5e700edb4dcc4a8a31 /mate-session/gsm-manager.c | |
parent | 08fded1464ec46772e5c7fc471ff2e3ad1f887bc (diff) | |
download | mate-session-manager-09388d8e945ef0674bca82c5ba375d901b14e693.tar.bz2 mate-session-manager-09388d8e945ef0674bca82c5ba375d901b14e693.tar.xz |
fix screensaver gschema usage
close https://github.com/mate-desktop/mate-desktop/issues/38
Diffstat (limited to 'mate-session/gsm-manager.c')
-rw-r--r-- | mate-session/gsm-manager.c | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/mate-session/gsm-manager.c b/mate-session/gsm-manager.c index 8b2e024..ad4ed89 100644 --- a/mate-session/gsm-manager.c +++ b/mate-session/gsm-manager.c @@ -137,6 +137,7 @@ struct GsmManagerPrivate GSettings *settings_session; GSettings *settings_lockdown; + GSettings *settings_screensaver; DBusGProxy *bus_proxy; DBusGConnection *connection; @@ -967,8 +968,11 @@ manager_switch_user (GsmManager *manager) static gboolean sleep_lock_is_enabled (GsmManager *manager) { - return g_settings_get_boolean (manager->priv->settings_lockdown, - KEY_SLEEP_LOCK); + if (manager->priv->settings_screensaver != NULL) + return g_settings_get_boolean (manager->priv->settings_screensaver, + KEY_SLEEP_LOCK); + else + return FALSE; } static void @@ -2178,6 +2182,11 @@ gsm_manager_dispose (GObject *object) manager->priv->settings_lockdown = NULL; } + if (manager->priv->settings_screensaver) { + g_object_unref (manager->priv->settings_screensaver); + manager->priv->settings_screensaver = NULL; + } + if (manager->priv->up_client != NULL) { g_object_unref (manager->priv->up_client); manager->priv->up_client = NULL; @@ -2336,12 +2345,29 @@ on_presence_status_changed (GsmPresence *presence, static void gsm_manager_init (GsmManager *manager) { + const char * const *schemas; + gboolean schema_exists; + guint i; manager->priv = GSM_MANAGER_GET_PRIVATE (manager); manager->priv->settings_session = g_settings_new (SESSION_SCHEMA); manager->priv->settings_lockdown = g_settings_new (LOCKDOWN_SCHEMA); + /* check if mate-screensaver is installed */ + schemas = g_settings_list_schemas (); + schema_exists = FALSE; + for (i = 0; schemas[i] != NULL; i++) { + if (g_str_equal (schemas[i], SCREENSAVER_SCHEMA)) { + schema_exists = TRUE; + break; + } + } + if (schema_exists == TRUE) + manager->priv->settings_screensaver = g_settings_new (SCREENSAVER_SCHEMA); + else + manager->priv->settings_screensaver = NULL; + manager->priv->inhibitors = gsm_store_new (); g_signal_connect (manager->priv->inhibitors, "added", |