summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gs-lock-plug.c12
-rw-r--r--src/gs-manager.c122
-rw-r--r--src/gs-prefs.c667
-rw-r--r--src/mate-screensaver-preferences.c340
4 files changed, 309 insertions, 832 deletions
diff --git a/src/gs-lock-plug.c b/src/gs-lock-plug.c
index 70cf1d7..554d257 100644
--- a/src/gs-lock-plug.c
+++ b/src/gs-lock-plug.c
@@ -37,7 +37,7 @@
#include <gdk/gdkx.h>
#include <X11/XKBlib.h>
#include <gtk/gtk.h>
-#include <mateconf/mateconf-client.h>
+#include <gio/gio.h>
#ifdef WITH_KBD_LAYOUT_INDICATOR
#include <libmatekbd/matekbd-indicator.h>
@@ -51,6 +51,8 @@
#include "gs-debug.h"
+#define GSETTINGS_SCHEMA "org.mate.ScreenSaver"
+
#define KEY_LOCK_DIALOG_THEME "/apps/mate-screensaver/lock_dialog_theme"
#define MDM_FLEXISERVER_COMMAND "mdmflexiserver"
@@ -1757,11 +1759,11 @@ static char *
get_dialog_theme_name (GSLockPlug *plug)
{
char *name;
- MateConfClient *client;
+ GSettings *settings;
- client = mateconf_client_get_default ();
- name = mateconf_client_get_string (client, KEY_LOCK_DIALOG_THEME, NULL);
- g_object_unref (client);
+ settings = g_settings_new (GSETTINGS_SCHEMA);
+ name = g_settings_get_string (settings, KEY_LOCK_DIALOG_THEME);
+ g_object_unref (settings);
return name;
}
diff --git a/src/gs-manager.c b/src/gs-manager.c
index 3deca22..d5758d9 100644
--- a/src/gs-manager.c
+++ b/src/gs-manager.c
@@ -26,8 +26,7 @@
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
-#include <mateconf/mateconf-engine.h>
-#include <mateconf/mateconf-client.h>
+#include <gio/gio.h>
#define MATE_DESKTOP_USE_UNSTABLE_API
#include <libmateui/mate-bg.h>
@@ -54,9 +53,8 @@ struct GSManagerPrivate
GHashTable *jobs;
GSThemeManager *theme_manager;
- MateConfClient *client;
+ GSettings *settings;
MateBG *bg;
- guint bg_notify_id;
/* Policy */
glong lock_timeout;
@@ -1034,64 +1032,46 @@ on_bg_changed (MateBG *bg,
gs_debug ("background changed");
}
-static void
-mateconf_changed_callback (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
- GSManager *manager)
-{
- mate_bg_load_from_preferences (manager->priv->bg,
- manager->priv->client);
-}
-
-static void
-watch_bg_preferences (GSManager *manager)
+static gboolean
+background_settings_change_event_cb (GSettings *settings,
+ gpointer keys,
+ gint n_keys,
+ GSManager *manager)
{
- g_assert (manager->priv->bg_notify_id == 0);
+#if 0
+ /* FIXME: since we bind user settings instead of system ones,
+ * watching for changes is no longer valid.
+ */
+ mate_bg_load_from_preferences (manager->priv->bg,
+ manager->priv->settings);
+#endif
- mateconf_client_add_dir (manager->priv->client,
- MATE_BG_KEY_DIR,
- MATECONF_CLIENT_PRELOAD_NONE,
- NULL);
- manager->priv->bg_notify_id = mateconf_client_notify_add (manager->priv->client,
- MATE_BG_KEY_DIR,
- (MateConfClientNotifyFunc)mateconf_changed_callback,
- manager,
- NULL,
- NULL);
+ return FALSE;
}
-static MateConfClient *
-get_mateconf_client (void)
+static GSettings *
+get_system_settings (void)
{
- MateConfClient *client;
- GSList *addresses;
- GError *error;
- MateConfEngine *engine;
+ GSettings *settings;
+ gchar **keys;
+ gchar **k;
- client = NULL;
- addresses = NULL;
+ /* FIXME: we need to bind system settings instead of user but
+ * that's currently impossible, not implemented yet.
+ * Hence, reset to system default values.
+ */
+ /* TODO: Ideally we would like to bind some other key, screensaver-specific. */
+ settings = g_settings_new ("org.mate.desktop.background");
- addresses = g_slist_prepend (addresses, "xml:merged:" SYSCONFDIR "/mateconf/mateconf.xml.mandatory");
- addresses = g_slist_prepend (addresses, "xml:merged:" SYSCONFDIR "/mateconf/mateconf.xml.system");
- addresses = g_slist_prepend (addresses, "xml:merged:" SYSCONFDIR "/mateconf/mateconf.xml.defaults");
- addresses = g_slist_reverse (addresses);
+ g_settings_delay (settings);
- error = NULL;
- engine = mateconf_engine_get_for_addresses (addresses, &error);
- if (engine == NULL)
- {
- gs_debug ("Unable to get mateconf engine for addresses: %s", error->message);
- g_error_free (error);
+ keys = g_settings_list_keys (settings);
+ for (k = keys; *k; k++) {
+ g_settings_reset (settings, *k);
}
- else
- {
- client = mateconf_client_get_for_engine (engine);
- }
-
- g_slist_free (addresses);
+ g_strfreev (keys);
- return client;
+ return settings;
}
static void
@@ -1103,19 +1083,20 @@ gs_manager_init (GSManager *manager)
manager->priv->grab = gs_grab_new ();
manager->priv->theme_manager = gs_theme_manager_new ();
- manager->priv->client = get_mateconf_client ();
- if (manager->priv->client != NULL)
- {
- manager->priv->bg = mate_bg_new ();
+ manager->priv->settings = get_system_settings ();
+ manager->priv->bg = mate_bg_new ();
- g_signal_connect (manager->priv->bg,
- "changed",
- G_CALLBACK (on_bg_changed),
- manager);
- watch_bg_preferences (manager);
+ g_signal_connect (manager->priv->bg,
+ "changed",
+ G_CALLBACK (on_bg_changed),
+ manager);
+ g_signal_connect (manager->priv->settings,
+ "change-event",
+ G_CALLBACK (background_settings_change_event_cb),
+ manager);
- mate_bg_load_from_preferences (manager->priv->bg, manager->priv->client);
- }
+ mate_bg_load_from_preferences (manager->priv->bg,
+ manager->priv->settings);
}
static void
@@ -1726,22 +1707,13 @@ gs_manager_finalize (GObject *object)
g_return_if_fail (manager->priv != NULL);
- if (manager->priv->bg_notify_id != 0)
- {
- mateconf_client_remove_dir (manager->priv->client,
- MATE_BG_KEY_DIR,
- NULL);
- mateconf_client_notify_remove (manager->priv->client,
- manager->priv->bg_notify_id);
- manager->priv->bg_notify_id = 0;
- }
if (manager->priv->bg != NULL)
{
g_object_unref (manager->priv->bg);
}
- if (manager->priv->client != NULL)
- {
- g_object_unref (manager->priv->client);
+ if (manager->priv->settings != NULL) {
+ g_settings_revert (manager->priv->settings);
+ g_object_unref (manager->priv->settings);
}
free_themes (manager);
diff --git a/src/gs-prefs.c b/src/gs-prefs.c
index 0f9d14e..193600b 100644
--- a/src/gs-prefs.c
+++ b/src/gs-prefs.c
@@ -26,7 +26,7 @@
#include <glib.h>
#include <glib-object.h>
-#include <mateconf/mateconf-client.h>
+#include <gio/gio.h>
#include "gs-prefs.h"
@@ -34,33 +34,33 @@ static void gs_prefs_class_init (GSPrefsClass *klass);
static void gs_prefs_init (GSPrefs *prefs);
static void gs_prefs_finalize (GObject *object);
-#define MATE_LOCKDOWN_DIR "/desktop/mate/lockdown"
-#define KEY_LOCK_DISABLE MATE_LOCKDOWN_DIR "/disable_lock_screen"
-#define KEY_USER_SWITCH_DISABLE MATE_LOCKDOWN_DIR "/disable_user_switching"
-
-#define KEY_DIR "/apps/mate-screensaver"
-#define MATE_SESSION_DIR "/desktop/mate/session"
-#define KEY_IDLE_ACTIVATION_ENABLED KEY_DIR "/idle_activation_enabled"
-#define KEY_LOCK_ENABLED KEY_DIR "/lock_enabled"
-#define KEY_MODE KEY_DIR "/mode"
-#define KEY_ACTIVATE_DELAY MATE_SESSION_DIR "/idle_delay"
-#define KEY_POWER_DELAY KEY_DIR "/power_management_delay"
-#define KEY_LOCK_DELAY KEY_DIR "/lock_delay"
-#define KEY_CYCLE_DELAY KEY_DIR "/cycle_delay"
-#define KEY_THEMES KEY_DIR "/themes"
-#define KEY_USER_SWITCH_ENABLED KEY_DIR "/user_switch_enabled"
-#define KEY_LOGOUT_ENABLED KEY_DIR "/logout_enabled"
-#define KEY_LOGOUT_DELAY KEY_DIR "/logout_delay"
-#define KEY_LOGOUT_COMMAND KEY_DIR "/logout_command"
-#define KEY_KEYBOARD_ENABLED KEY_DIR "/embedded_keyboard_enabled"
-#define KEY_KEYBOARD_COMMAND KEY_DIR "/embedded_keyboard_command"
-#define KEY_STATUS_MESSAGE_ENABLED KEY_DIR "/status_message_enabled"
+#define LOCKDOWN_SETTINGS_SCHEMA "org.mate.desktop.lockdown"
+#define KEY_LOCK_DISABLE "disable-lock-screen"
+#define KEY_USER_SWITCH_DISABLE "disable-user-switching"
+
+#define GSETTINGS_SCHEMA "org.mate.screensaver"
+#define KEY_IDLE_ACTIVATION_ENABLED "idle-activation-enabled"
+#define KEY_LOCK_ENABLED "lock-enabled"
+#define KEY_MODE "mode"
+#define KEY_ACTIVATE_DELAY "idle-delay"
+#define KEY_POWER_DELAY "power-management-delay"
+#define KEY_LOCK_DELAY "lock-delay"
+#define KEY_CYCLE_DELAY "cycle-delay"
+#define KEY_THEMES "themes"
+#define KEY_USER_SWITCH_ENABLED "user-switch-enabled"
+#define KEY_LOGOUT_ENABLED "logout-enabled"
+#define KEY_LOGOUT_DELAY "logout-delay"
+#define KEY_LOGOUT_COMMAND "logout-command"
+#define KEY_KEYBOARD_ENABLED "embedded-keyboard-enabled"
+#define KEY_KEYBOARD_COMMAND "embedded-keyboard-command"
+#define KEY_STATUS_MESSAGE_ENABLED "status-message-enabled"
#define GS_PREFS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GS_TYPE_PREFS, GSPrefsPrivate))
struct GSPrefsPrivate
{
- MateConfClient *mateconf_client;
+ GSettings *settings;
+ GSettings *lockdown;
};
enum
@@ -74,14 +74,6 @@ enum
PROP_0
};
-static MateConfEnumStringPair mode_enum_map [] =
-{
- { GS_MODE_BLANK_ONLY, "blank-only" },
- { GS_MODE_RANDOM, "random" },
- { GS_MODE_SINGLE, "single" },
- { 0, NULL }
-};
-
static guint signals [LAST_SIGNAL] = { 0, };
G_DEFINE_TYPE (GSPrefs, gs_prefs, G_TYPE_OBJECT)
@@ -202,20 +194,16 @@ _gs_prefs_set_cycle_timeout (GSPrefs *prefs,
static void
_gs_prefs_set_mode (GSPrefs *prefs,
- const char *value)
+ gint mode)
{
- int mode;
-
- if (value && mateconf_string_to_enum (mode_enum_map, value, &mode))
- prefs->mode = mode;
- else
- prefs->mode = GS_MODE_BLANK_ONLY;
+ prefs->mode = mode;
}
static void
_gs_prefs_set_themes (GSPrefs *prefs,
- GSList *list)
+ gchar **values)
{
+ guint i;
if (prefs->themes)
{
g_slist_foreach (prefs->themes, (GFunc)g_free, NULL);
@@ -223,7 +211,9 @@ _gs_prefs_set_themes (GSPrefs *prefs,
}
/* take ownership of the list */
- prefs->themes = list;
+ prefs->themes = NULL;
+ for (i=0; values[i] != NULL; i++)
+ prefs->themes = g_slist_append (prefs->themes, g_strdup (values[i]));
}
static void
@@ -328,572 +318,214 @@ _gs_prefs_set_user_switch_enabled (GSPrefs *prefs,
}
static void
-key_error_and_free (const char *key,
- GError *error)
-{
- g_warning ("Error retrieving configuration key '%s': %s", key, error->message);
- g_error_free (error);
- error = NULL;
-}
-
-static void
-gs_prefs_load_from_mateconf (GSPrefs *prefs)
+gs_prefs_load_from_settings (GSPrefs *prefs)
{
glong value;
gboolean bvalue;
char *string;
- GSList *list;
- GError *error;
+ gchar **strv;
+ gint mode;
- error = NULL;
- bvalue = mateconf_client_get_bool (prefs->priv->mateconf_client, KEY_IDLE_ACTIVATION_ENABLED, &error);
- if (! error)
- {
- _gs_prefs_set_idle_activation_enabled (prefs, bvalue);
- }
- else
- {
- key_error_and_free (KEY_IDLE_ACTIVATION_ENABLED, error);
- }
+ bvalue = g_settings_get_boolean (prefs->priv->settings, KEY_IDLE_ACTIVATION_ENABLED);
+ _gs_prefs_set_idle_activation_enabled (prefs, bvalue);
- error = NULL;
- bvalue = mateconf_client_get_bool (prefs->priv->mateconf_client, KEY_LOCK_ENABLED, &error);
- if (! error)
- {
- _gs_prefs_set_lock_enabled (prefs, bvalue);
- }
- else
- {
- key_error_and_free (KEY_LOCK_ENABLED, error);
- }
+ bvalue = g_settings_get_boolean (prefs->priv->settings, KEY_LOCK_ENABLED);
+ _gs_prefs_set_lock_enabled (prefs, bvalue);
- error = NULL;
- bvalue = mateconf_client_get_bool (prefs->priv->mateconf_client, KEY_LOCK_DISABLE, &error);
- if (! error)
- {
- _gs_prefs_set_lock_disabled (prefs, bvalue);
- }
- else
- {
- key_error_and_free (KEY_LOCK_DISABLE, error);
- }
+ bvalue = g_settings_get_boolean (prefs->priv->lockdown, KEY_LOCK_DISABLE);
+ _gs_prefs_set_lock_disabled (prefs, bvalue);
- error = NULL;
- bvalue = mateconf_client_get_bool (prefs->priv->mateconf_client, KEY_USER_SWITCH_DISABLE, &error);
- if (! error)
- {
- _gs_prefs_set_user_switch_disabled (prefs, bvalue);
- }
- else
- {
- key_error_and_free (KEY_USER_SWITCH_DISABLE, error);
- }
+ bvalue = g_settings_get_boolean (prefs->priv->lockdown, KEY_USER_SWITCH_DISABLE);
+ _gs_prefs_set_user_switch_disabled (prefs, bvalue);
- error = NULL;
- value = mateconf_client_get_int (prefs->priv->mateconf_client, KEY_ACTIVATE_DELAY, &error);
- if (! error)
- {
- _gs_prefs_set_timeout (prefs, value);
- }
- else
- {
- key_error_and_free (KEY_ACTIVATE_DELAY, error);
- }
+ value = g_settings_get_int (prefs->priv->settings, KEY_ACTIVATE_DELAY);
+ _gs_prefs_set_timeout (prefs, value);
- error = NULL;
- value = mateconf_client_get_int (prefs->priv->mateconf_client, KEY_POWER_DELAY, &error);
- if (! error)
- {
- _gs_prefs_set_power_timeout (prefs, value);
- }
- else
- {
- key_error_and_free (KEY_POWER_DELAY, error);
- }
+ value = g_settings_get_int (prefs->priv->settings, KEY_POWER_DELAY);
+ _gs_prefs_set_power_timeout (prefs, value);
- error = NULL;
- value = mateconf_client_get_int (prefs->priv->mateconf_client, KEY_LOCK_DELAY, &error);
- if (! error)
- {
- _gs_prefs_set_lock_timeout (prefs, value);
- }
- else
- {
- key_error_and_free (KEY_LOCK_DELAY, error);
- }
+ value = g_settings_get_int (prefs->priv->settings, KEY_LOCK_DELAY);
+ _gs_prefs_set_lock_timeout (prefs, value);
- error = NULL;
- value = mateconf_client_get_int (prefs->priv->mateconf_client, KEY_CYCLE_DELAY, &error);
- if (! error)
- {
- _gs_prefs_set_cycle_timeout (prefs, value);
- }
- else
- {
- key_error_and_free (KEY_CYCLE_DELAY, error);
- }
+ value = g_settings_get_int (prefs->priv->settings, KEY_CYCLE_DELAY);
+ _gs_prefs_set_cycle_timeout (prefs, value);
- error = NULL;
- string = mateconf_client_get_string (prefs->priv->mateconf_client, KEY_MODE, &error);
- if (! error)
- {
- _gs_prefs_set_mode (prefs, string);
- }
- else
- {
- key_error_and_free (KEY_MODE, error);
- }
- g_free (string);
+ mode = g_settings_get_enum (prefs->priv->settings, KEY_MODE);
+ _gs_prefs_set_mode (prefs, mode);
- error = NULL;
- list = mateconf_client_get_list (prefs->priv->mateconf_client,
- KEY_THEMES,
- MATECONF_VALUE_STRING,
- &error);
- if (! error)
- {
- _gs_prefs_set_themes (prefs, list);
- }
- else
- {
- key_error_and_free (KEY_THEMES, error);
- }
+ strv = g_settings_get_strv (prefs->priv->settings, KEY_THEMES);
+ _gs_prefs_set_themes (prefs, strv);
+ g_strfreev (strv);
/* Embedded keyboard options */
- error = NULL;
- bvalue = mateconf_client_get_bool (prefs->priv->mateconf_client, KEY_KEYBOARD_ENABLED, &error);
- if (! error)
- {
- _gs_prefs_set_keyboard_enabled (prefs, bvalue);
- }
- else
- {
- key_error_and_free (KEY_KEYBOARD_ENABLED, error);
- }
+ bvalue = g_settings_get_boolean (prefs->priv->settings, KEY_KEYBOARD_ENABLED);
+ _gs_prefs_set_keyboard_enabled (prefs, bvalue);
- error = NULL;
- string = mateconf_client_get_string (prefs->priv->mateconf_client, KEY_KEYBOARD_COMMAND, &error);
- if (! error)
- {
- _gs_prefs_set_keyboard_command (prefs, string);
- }
- else
- {
- key_error_and_free (KEY_KEYBOARD_COMMAND, error);
- }
+ string = g_settings_get_string (prefs->priv->settings, KEY_KEYBOARD_COMMAND);
+ _gs_prefs_set_keyboard_command (prefs, string);
g_free (string);
- error = NULL;
- bvalue = mateconf_client_get_bool (prefs->priv->mateconf_client, KEY_STATUS_MESSAGE_ENABLED, &error);
- if (! error)
- {
- _gs_prefs_set_status_message_enabled (prefs, bvalue);
- }
- else
- {
- key_error_and_free (KEY_STATUS_MESSAGE_ENABLED, error);
- }
+ bvalue = g_settings_get_boolean (prefs->priv->settings, KEY_STATUS_MESSAGE_ENABLED);
+ _gs_prefs_set_status_message_enabled (prefs, bvalue);
/* Logout options */
- error = NULL;
- bvalue = mateconf_client_get_bool (prefs->priv->mateconf_client, KEY_LOGOUT_ENABLED, &error);
- if (! error)
- {
- _gs_prefs_set_logout_enabled (prefs, bvalue);
- }
- else
- {
- key_error_and_free (KEY_LOGOUT_ENABLED, error);
- }
+ bvalue = g_settings_get_boolean (prefs->priv->settings, KEY_LOGOUT_ENABLED);
+ _gs_prefs_set_logout_enabled (prefs, bvalue);
- error = NULL;
- string = mateconf_client_get_string (prefs->priv->mateconf_client, KEY_LOGOUT_COMMAND, &error);
- if (! error)
- {
- _gs_prefs_set_logout_command (prefs, string);
- }
- else
- {
- key_error_and_free (KEY_LOGOUT_COMMAND, error);
- }
+ string = g_settings_get_string (prefs->priv->settings, KEY_LOGOUT_COMMAND);
+ _gs_prefs_set_logout_command (prefs, string);
g_free (string);
- error = NULL;
- value = mateconf_client_get_int (prefs->priv->mateconf_client, KEY_LOGOUT_DELAY, &error);
- if (! error)
- {
- _gs_prefs_set_logout_timeout (prefs, value);
- }
- else
- {
- key_error_and_free (KEY_LOGOUT_DELAY, error);
- }
+ value = g_settings_get_int (prefs->priv->settings, KEY_LOGOUT_DELAY);
+ _gs_prefs_set_logout_timeout (prefs, value);
/* User switching options */
- error = NULL;
- bvalue = mateconf_client_get_bool (prefs->priv->mateconf_client, KEY_USER_SWITCH_ENABLED, &error);
- if (! error)
- {
- _gs_prefs_set_user_switch_enabled (prefs, bvalue);
- }
- else
- {
- key_error_and_free (KEY_USER_SWITCH_ENABLED, error);
- }
-}
-
-static void
-invalid_type_warning (const char *type)
-{
- g_warning ("Error retrieving configuration key '%s': Invalid type",
- type);
+ bvalue = g_settings_get_boolean (prefs->priv->settings, KEY_USER_SWITCH_ENABLED);
+ _gs_prefs_set_user_switch_enabled (prefs, bvalue);
}
static void
-key_changed_cb (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
- GSPrefs *prefs)
+key_changed_cb (GSettings *settings,
+ const gchar *key,
+ GSPrefs *prefs)
{
- gboolean changed = FALSE;
- const char *key;
- MateConfValue *value;
-
- key = mateconf_entry_get_key (entry);
-
- if (! g_str_has_prefix (key, KEY_DIR) && ! g_str_has_prefix (key, MATE_LOCKDOWN_DIR))
- return;
-
- value = mateconf_entry_get_value (entry);
-
if (strcmp (key, KEY_MODE) == 0)
{
+ gint mode;
- if (value->type == MATECONF_VALUE_STRING)
- {
- const char *str;
-
- str = mateconf_value_get_string (value);
- _gs_prefs_set_mode (prefs, str);
-
- changed = TRUE;
- }
- else
- {
- invalid_type_warning (key);
- }
+ mode = g_settings_get_enum (settings, key);
+ _gs_prefs_set_mode (prefs, mode);
}
else if (strcmp (key, KEY_THEMES) == 0)
{
- GSList *list = NULL;
-
- if (value == NULL
- || value->type != MATECONF_VALUE_LIST)
- {
- return;
- }
-
- list = mateconf_value_get_list (value);
-
- if (list
- && mateconf_value_get_list_type (value) == MATECONF_VALUE_STRING)
- {
- GSList *l;
- GSList *new_list;
-
- changed = TRUE;
-
- new_list = NULL;
- for (l = list; l; l = l->next)
- {
- char *s;
-
- s = mateconf_value_to_string (l->data);
-
- new_list = g_slist_prepend (new_list, g_strdup (s));
-
- g_free (s);
- }
+ gchar **strv = NULL;
- new_list = g_slist_reverse (new_list);
-
- _gs_prefs_set_themes (prefs, new_list);
-
- }
+ strv = g_settings_get_strv (settings, key);
+ _gs_prefs_set_themes (prefs, strv);
+ g_strfreev (strv);
}
else if (strcmp (key, KEY_ACTIVATE_DELAY) == 0)
{
+ int delay;
- if (value->type == MATECONF_VALUE_INT)
- {
- int delay;
-
- delay = mateconf_value_get_int (value);
- _gs_prefs_set_timeout (prefs, delay);
-
- changed = TRUE;
- }
- else
- {
- invalid_type_warning (key);
- }
+ delay = g_settings_get_int (settings, key);
+ _gs_prefs_set_timeout (prefs, delay);
}
else if (strcmp (key, KEY_POWER_DELAY) == 0)
{
+ int delay;
- if (value->type == MATECONF_VALUE_INT)
- {
- int delay;
-
- delay = mateconf_value_get_int (value);
- _gs_prefs_set_power_timeout (prefs, delay);
-
- changed = TRUE;
- }
- else
- {
- invalid_type_warning (key);
- }
+ delay = g_settings_get_int (settings, key);
+ _gs_prefs_set_power_timeout (prefs, delay);
}
else if (strcmp (key, KEY_LOCK_DELAY) == 0)
{
+ int delay;
- if (value->type == MATECONF_VALUE_INT)
- {
- int delay;
-
- delay = mateconf_value_get_int (value);
- _gs_prefs_set_lock_timeout (prefs, delay);
-
- changed = TRUE;
- }
- else
- {
- invalid_type_warning (key);
- }
-
+ delay = g_settings_get_int (settings, key);
+ _gs_prefs_set_lock_timeout (prefs, delay);
}
else if (strcmp (key, KEY_IDLE_ACTIVATION_ENABLED) == 0)
{
+ gboolean enabled;
- if (value->type == MATECONF_VALUE_BOOL)
- {
- gboolean enabled;
-
- enabled = mateconf_value_get_bool (value);
- _gs_prefs_set_idle_activation_enabled (prefs, enabled);
-
- changed = TRUE;
- }
- else
- {
- invalid_type_warning (key);
- }
+ enabled = g_settings_get_boolean (settings, key);
+ _gs_prefs_set_idle_activation_enabled (prefs, enabled);
}
else if (strcmp (key, KEY_LOCK_ENABLED) == 0)
{
+ gboolean enabled;
- if (value->type == MATECONF_VALUE_BOOL)
- {
- gboolean enabled;
-
- enabled = mateconf_value_get_bool (value);
- _gs_prefs_set_lock_enabled (prefs, enabled);
-
- changed = TRUE;
- }
- else
- {
- invalid_type_warning (key);
- }
+ enabled = g_settings_get_boolean (settings, key);
+ _gs_prefs_set_lock_enabled (prefs, enabled);
}
else if (strcmp (key, KEY_LOCK_DISABLE) == 0)
{
+ gboolean disabled;
- if (value->type == MATECONF_VALUE_BOOL)
- {
- gboolean disabled;
-
- disabled = mateconf_value_get_bool (value);
- _gs_prefs_set_lock_disabled (prefs, disabled);
-
- changed = TRUE;
- }
- else
- {
- invalid_type_warning (key);
- }
+ disabled = g_settings_get_boolean (settings, key);
+ _gs_prefs_set_lock_disabled (prefs, disabled);
}
else if (strcmp (key, KEY_USER_SWITCH_DISABLE) == 0)
{
+ gboolean disabled;
- if (value->type == MATECONF_VALUE_BOOL)
- {
- gboolean disabled;
-
- disabled = mateconf_value_get_bool (value);
- _gs_prefs_set_user_switch_disabled (prefs, disabled);
-
- changed = TRUE;
- }
- else
- {
- invalid_type_warning (key);
- }
+ disabled = g_settings_get_boolean (settings, key);
+ _gs_prefs_set_user_switch_disabled (prefs, disabled);
}
else if (strcmp (key, KEY_CYCLE_DELAY) == 0)
{
+ int delay;
- if (value->type == MATECONF_VALUE_INT)
- {
- int delay;
-
- delay = mateconf_value_get_int (value);
- _gs_prefs_set_cycle_timeout (prefs, delay);
-
- changed = TRUE;
- }
- else
- {
- invalid_type_warning (key);
- }
+ delay = g_settings_get_int (settings, key);
+ _gs_prefs_set_cycle_timeout (prefs, delay);
}
else if (strcmp (key, KEY_KEYBOARD_ENABLED) == 0)
{
+ gboolean enabled;
- if (value->type == MATECONF_VALUE_BOOL)
- {
- gboolean enabled;
-
- enabled = mateconf_value_get_bool (value);
- _gs_prefs_set_keyboard_enabled (prefs, enabled);
-
- changed = TRUE;
- }
- else
- {
- invalid_type_warning (key);
- }
+ enabled = g_settings_get_boolean (settings, key);
+ _gs_prefs_set_keyboard_enabled (prefs, enabled);
}
else if (strcmp (key, KEY_KEYBOARD_COMMAND) == 0)
{
+ const char *command;
- if (value->type == MATECONF_VALUE_STRING)
- {
- const char *command;
-
- command = mateconf_value_get_string (value);
- _gs_prefs_set_keyboard_command (prefs, command);
-
- changed = TRUE;
- }
- else
- {
- invalid_type_warning (key);
- }
+ command = g_settings_get_string (settings, key);
+ _gs_prefs_set_keyboard_command (prefs, command);
}
else if (strcmp (key, KEY_STATUS_MESSAGE_ENABLED) == 0)
{
+ gboolean enabled;
- if (value->type == MATECONF_VALUE_BOOL)
- {
- gboolean enabled;
-
- enabled = mateconf_value_get_bool (value);
- _gs_prefs_set_status_message_enabled (prefs, enabled);
-
- changed = TRUE;
- }
- else
- {
- invalid_type_warning (key);
- }
+ enabled = g_settings_get_boolean (settings, key);
+ _gs_prefs_set_status_message_enabled (prefs, enabled);
}
else if (strcmp (key, KEY_LOGOUT_ENABLED) == 0)
{
+ gboolean enabled;
- if (value->type == MATECONF_VALUE_BOOL)
- {
- gboolean enabled;
-
- enabled = mateconf_value_get_bool (value);
- _gs_prefs_set_logout_enabled (prefs, enabled);
-
- changed = TRUE;
- }
- else
- {
- invalid_type_warning (key);
- }
+ enabled = g_settings_get_boolean (settings, key);
+ _gs_prefs_set_logout_enabled (prefs, enabled);
}
else if (strcmp (key, KEY_LOGOUT_DELAY) == 0)
{
+ int delay;
- if (value->type == MATECONF_VALUE_INT)
- {
- int delay;
-
- delay = mateconf_value_get_int (value);
- _gs_prefs_set_logout_timeout (prefs, delay);
-
- changed = TRUE;
- }
- else
- {
- invalid_type_warning (key);
- }
+ delay = g_settings_get_int (settings, key);
+ _gs_prefs_set_logout_timeout (prefs, delay);
}
else if (strcmp (key, KEY_LOGOUT_COMMAND) == 0)
{
+ const char *command;
- if (value->type == MATECONF_VALUE_STRING)
- {
- const char *command;
-
- command = mateconf_value_get_string (value);
- _gs_prefs_set_logout_command (prefs, command);
-
- changed = TRUE;
- }
- else
- {
- invalid_type_warning (key);
- }
+ command = g_settings_get_string (settings, key);
+ _gs_prefs_set_logout_command (prefs, command);
}
else if (strcmp (key, KEY_USER_SWITCH_ENABLED) == 0)
{
+ gboolean enabled;
- if (value->type == MATECONF_VALUE_BOOL)
- {
- gboolean enabled;
-
- enabled = mateconf_value_get_bool (value);
- _gs_prefs_set_user_switch_enabled (prefs, enabled);
-
- changed = TRUE;
- }
- else
- {
- invalid_type_warning (key);
- }
+ enabled = g_settings_get_boolean (settings, key);
+ _gs_prefs_set_user_switch_enabled (prefs, enabled);
}
else
@@ -901,10 +533,7 @@ key_changed_cb (MateConfClient *client,
g_warning ("Config key not handled: %s", key);
}
- if (changed && prefs)
- {
- g_signal_emit (prefs, signals [CHANGED], 0);
- }
+ g_signal_emit (prefs, signals [CHANGED], 0);
}
static void
@@ -912,8 +541,16 @@ gs_prefs_init (GSPrefs *prefs)
{
prefs->priv = GS_PREFS_GET_PRIVATE (prefs);
- prefs->priv->mateconf_client = mateconf_client_get_default ();
-
+ prefs->priv->settings = g_settings_new (GSETTINGS_SCHEMA);
+ g_signal_connect (prefs->priv->settings,
+ "changed",
+ G_CALLBACK (key_changed_cb),
+ prefs);
+ prefs->priv->lockdown = g_settings_new (LOCKDOWN_SETTINGS_SCHEMA);
+ g_signal_connect (prefs->priv->lockdown,
+ "changed",
+ G_CALLBACK (key_changed_cb),
+ prefs);
prefs->idle_activation_enabled = TRUE;
prefs->lock_enabled = TRUE;
prefs->lock_disabled = FALSE;
@@ -928,30 +565,7 @@ gs_prefs_init (GSPrefs *prefs)
prefs->mode = GS_MODE_SINGLE;
- /* MateConf setup */
- mateconf_client_add_dir (prefs->priv->mateconf_client,
- KEY_DIR,
- MATECONF_CLIENT_PRELOAD_NONE, NULL);
- mateconf_client_add_dir (prefs->priv->mateconf_client,
- MATE_LOCKDOWN_DIR,
- MATECONF_CLIENT_PRELOAD_NONE, NULL);
- mateconf_client_add_dir (prefs->priv->mateconf_client,
- MATE_SESSION_DIR,
- MATECONF_CLIENT_PRELOAD_NONE, NULL);
-
-
- mateconf_client_notify_add (prefs->priv->mateconf_client,
- KEY_DIR,
- (MateConfClientNotifyFunc)key_changed_cb,
- prefs,
- NULL, NULL);
- mateconf_client_notify_add (prefs->priv->mateconf_client,
- MATE_LOCKDOWN_DIR,
- (MateConfClientNotifyFunc)key_changed_cb,
- prefs,
- NULL, NULL);
-
- gs_prefs_load_from_mateconf (prefs);
+ gs_prefs_load_from_settings (prefs);
}
static void
@@ -966,12 +580,17 @@ gs_prefs_finalize (GObject *object)
g_return_if_fail (prefs->priv != NULL);
- if (prefs->priv->mateconf_client)
+ if (prefs->priv->settings)
{
- g_object_unref (prefs->priv->mateconf_client);
- prefs->priv->mateconf_client = NULL;
+ g_object_unref (prefs->priv->settings);
+ prefs->priv->settings = NULL;
}
+ if (prefs->priv->lockdown) {
+ g_object_unref (prefs->priv->lockdown);
+ prefs->priv->lockdown = NULL;
+ }
+
if (prefs->themes)
{
g_slist_foreach (prefs->themes, (GFunc)g_free, NULL);
diff --git a/src/mate-screensaver-preferences.c b/src/mate-screensaver-preferences.c
index 5bcf5e5..546e028 100644
--- a/src/mate-screensaver-preferences.c
+++ b/src/mate-screensaver-preferences.c
@@ -33,7 +33,6 @@
#include <glib/gi18n.h>
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
-#include <mateconf/mateconf-client.h>
#include <gio/gio.h>
@@ -45,18 +44,17 @@
#define GTK_BUILDER_FILE "mate-screensaver-preferences.ui"
-#define MATE_LOCKDOWN_DIR "/desktop/mate/lockdown"
-#define KEY_LOCK_DISABLE MATE_LOCKDOWN_DIR "/disable_lock_screen"
+#define LOCKDOWN_SETTINGS_SCHEMA "org.mate.desktop.lockdown"
+#define KEY_LOCK_DISABLE "disable-lock-screen"
-#define KEY_DIR "/apps/mate-screensaver"
-#define MATE_SESSION_DIR "/desktop/mate/session"
-#define KEY_LOCK KEY_DIR "/lock_enabled"
-#define KEY_IDLE_ACTIVATION_ENABLED KEY_DIR "/idle_activation_enabled"
-#define KEY_MODE KEY_DIR "/mode"
-#define KEY_ACTIVATE_DELAY MATE_SESSION_DIR "/idle_delay"
-#define KEY_LOCK_DELAY KEY_DIR "/lock_delay"
-#define KEY_CYCLE_DELAY KEY_DIR "/cycle_delay"
-#define KEY_THEMES KEY_DIR "/themes"
+#define GSETTINGS_SCHEMA "org.mate.screensaver"
+#define KEY_LOCK "lock-enabled"
+#define KEY_IDLE_ACTIVATION_ENABLED "idle-activation-enabled"
+#define KEY_MODE "mode"
+#define KEY_ACTIVATE_DELAY "idle-delay"
+#define KEY_LOCK_DELAY "lock-delay"
+#define KEY_CYCLE_DELAY "cycle-delay"
+#define KEY_THEMES "themes"
#define GPM_COMMAND "mate-power-preferences"
@@ -67,14 +65,6 @@ enum
N_COLUMNS
};
-static MateConfEnumStringPair mode_enum_map [] =
-{
- { GS_MODE_BLANK_ONLY, "blank-only" },
- { GS_MODE_RANDOM, "random" },
- { GS_MODE_SINGLE, "single" },
- { 0, NULL }
-};
-
/* Drag and drop info */
enum
{
@@ -95,26 +85,25 @@ static GSJob *job = NULL;
static gint32
config_get_activate_delay (gboolean *is_writable)
{
- MateConfClient *client;
+ GSettings *settings;
gint32 delay;
- client = mateconf_client_get_default ();
+ settings = g_settings_new (GSETTINGS_SCHEMA);
if (is_writable)
{
- *is_writable = mateconf_client_key_is_writable (client,
- KEY_ACTIVATE_DELAY,
- NULL);
+ *is_writable = g_settings_is_writable (settings,
+ KEY_ACTIVATE_DELAY);
}
- delay = mateconf_client_get_int (client, KEY_ACTIVATE_DELAY, NULL);
+ delay = g_settings_get_int (settings, KEY_ACTIVATE_DELAY);
if (delay < 1)
{
delay = 1;
}
- g_object_unref (client);
+ g_object_unref (settings);
return delay;
}
@@ -122,43 +111,32 @@ config_get_activate_delay (gboolean *is_writable)
static void
config_set_activate_delay (gint32 timeout)
{
- MateConfClient *client;
+ GSettings *settings;
- client = mateconf_client_get_default ();
+ settings = g_settings_new (GSETTINGS_SCHEMA);
- mateconf_client_set_int (client, KEY_ACTIVATE_DELAY, timeout, NULL);
+ g_settings_set_int (settings, KEY_ACTIVATE_DELAY, timeout);
- g_object_unref (client);
+ g_object_unref (settings);
}
static int
config_get_mode (gboolean *is_writable)
{
- MateConfClient *client;
+ GSettings *settings;
int mode;
- char *string;
- client = mateconf_client_get_default ();
+ settings = g_settings_new (GSETTINGS_SCHEMA);
if (is_writable)
{
- *is_writable = mateconf_client_key_is_writable (client,
- KEY_MODE,
- NULL);
+ *is_writable = g_settings_is_writable (settings,
+ KEY_MODE);
}
- string = mateconf_client_get_string (client, KEY_MODE, NULL);
- if (string)
- {
- mateconf_string_to_enum (mode_enum_map, string, &mode);
- g_free (string);
- }
- else
- {
- mode = GS_MODE_BLANK_ONLY;
- }
+ mode = g_settings_get_enum (settings, KEY_MODE);
- g_object_unref (client);
+ g_object_unref (settings);
return mode;
}
@@ -166,37 +144,33 @@ config_get_mode (gboolean *is_writable)
static void
config_set_mode (int mode)
{
- MateConfClient *client;
- const char *mode_string;
+ GSettings *settings;
- client = mateconf_client_get_default ();
+ settings = g_settings_new (GSETTINGS_SCHEMA);
- mode_string = mateconf_enum_to_string (mode_enum_map, mode);
- mateconf_client_set_string (client, KEY_MODE, mode_string, NULL);
+ g_settings_set_enum (settings, KEY_MODE, mode);
- g_object_unref (client);
+ g_object_unref (settings);
}
static char *
config_get_theme (gboolean *is_writable)
{
- MateConfClient *client;
+ GSettings *settings;
char *name;
int mode;
- client = mateconf_client_get_default ();
+ settings = g_settings_new (GSETTINGS_SCHEMA);
if (is_writable)
{
gboolean can_write_theme;
gboolean can_write_mode;
- can_write_theme = mateconf_client_key_is_writable (client,
- KEY_THEMES,
- NULL);
- can_write_mode = mateconf_client_key_is_writable (client,
- KEY_MODE,
- NULL);
+ can_write_theme = g_settings_is_writable (settings,
+ KEY_THEMES);
+ can_write_mode = g_settings_is_writable (settings,
+ KEY_MODE);
*is_writable = can_write_theme && can_write_mode;
}
@@ -213,14 +187,11 @@ config_get_theme (gboolean *is_writable)
}
else
{
- GSList *list;
- list = mateconf_client_get_list (client,
- KEY_THEMES,
- MATECONF_VALUE_STRING,
- NULL);
- if (list != NULL)
- {
- name = g_strdup (list->data);
+ gchar **strv;
+ strv = g_settings_get_strv (settings,
+ KEY_THEMES);
+ if (strv != NULL) {
+ name = g_strdup (strv[0]);
}
else
{
@@ -229,28 +200,29 @@ config_get_theme (gboolean *is_writable)
name = g_strdup ("__blank-only");
}
- g_slist_foreach (list, (GFunc)g_free, NULL);
- g_slist_free (list);
+ g_strfreev (strv);
}
- g_object_unref (client);
+ g_object_unref (settings);
return name;
}
-static GSList *
+static gchar **
get_all_theme_ids (GSThemeManager *theme_manager)
{
- GSList *ids = NULL;
+ gchar **ids = NULL;
GSList *entries;
GSList *l;
+ guint idx = 0;
entries = gs_theme_manager_get_info_list (theme_manager);
+ ids = g_new0 (gchar *, g_slist_length (entries) + 1);
for (l = entries; l; l = l->next)
{
GSThemeInfo *info = l->data;
- ids = g_slist_prepend (ids, g_strdup (gs_theme_info_get_id (info)));
+ ids[idx++] = g_strdup (gs_theme_info_get_id (info));
gs_theme_info_unref (info);
}
g_slist_free (entries);
@@ -261,11 +233,11 @@ get_all_theme_ids (GSThemeManager *theme_manager)
static void
config_set_theme (const char *theme_id)
{
- MateConfClient *client;
- GSList *list = NULL;
+ GSettings *settings;
+ gchar **strv = NULL;
int mode;
- client = mateconf_client_get_default ();
+ settings = g_settings_new (GSETTINGS_SCHEMA);
if (theme_id && strcmp (theme_id, "__blank-only") == 0)
{
@@ -276,46 +248,42 @@ config_set_theme (const char *theme_id)
mode = GS_MODE_RANDOM;
/* set the themes key to contain all available screensavers */
- list = get_all_theme_ids (theme_manager);
+ strv = get_all_theme_ids (theme_manager);
}
else
{
mode = GS_MODE_SINGLE;
- list = g_slist_append (list, g_strdup (theme_id));
+ strv = g_strsplit (theme_id, "%%%", 1);
}
config_set_mode (mode);
- mateconf_client_set_list (client,
- KEY_THEMES,
- MATECONF_VALUE_STRING,
- list,
- NULL);
+ g_settings_set_strv (settings,
+ KEY_THEMES,
+ (const gchar * const*) strv);
- g_slist_foreach (list, (GFunc) g_free, NULL);
- g_slist_free (list);
+ g_strfreev (strv);
- g_object_unref (client);
+ g_object_unref (settings);
}
static gboolean
config_get_enabled (gboolean *is_writable)
{
int enabled;
- MateConfClient *client;
+ GSettings *settings;
- client = mateconf_client_get_default ();
+ settings = g_settings_new (GSETTINGS_SCHEMA);
if (is_writable)
{
- *is_writable = mateconf_client_key_is_writable (client,
- KEY_LOCK,
- NULL);
+ *is_writable = g_settings_is_writable (settings,
+ KEY_LOCK);
}
- enabled = mateconf_client_get_bool (client, KEY_IDLE_ACTIVATION_ENABLED, NULL);
+ enabled = g_settings_get_boolean (settings, KEY_IDLE_ACTIVATION_ENABLED);
- g_object_unref (client);
+ g_object_unref (settings);
return enabled;
}
@@ -323,33 +291,32 @@ config_get_enabled (gboolean *is_writable)
static void
config_set_enabled (gboolean enabled)
{
- MateConfClient *client;
+ GSettings *settings;
- client = mateconf_client_get_default ();
+ settings = g_settings_new (GSETTINGS_SCHEMA);
- mateconf_client_set_bool (client, KEY_IDLE_ACTIVATION_ENABLED, enabled, NULL);
+ g_settings_set_boolean (settings, KEY_IDLE_ACTIVATION_ENABLED, enabled);
- g_object_unref (client);
+ g_object_unref (settings);
}
static gboolean
config_get_lock (gboolean *is_writable)
{
- MateConfClient *client;
+ GSettings *settings;
gboolean lock;
- client = mateconf_client_get_default ();
+ settings = g_settings_new (GSETTINGS_SCHEMA);
if (is_writable)
{
- *is_writable = mateconf_client_key_is_writable (client,
- KEY_LOCK,
- NULL);
+ *is_writable = g_settings_is_writable (settings,
+ KEY_LOCK);
}
- lock = mateconf_client_get_bool (client, KEY_LOCK, NULL);
+ lock = g_settings_get_boolean (settings, KEY_LOCK);
- g_object_unref (client);
+ g_object_unref (settings);
return lock;
}
@@ -357,27 +324,27 @@ config_get_lock (gboolean *is_writable)
static gboolean
config_get_lock_disabled ()
{
- MateConfClient *client;
+ GSettings *settings;
gboolean lock;
- client = mateconf_client_get_default ();
+ settings = g_settings_new (LOCKDOWN_SETTINGS_SCHEMA);
- lock = mateconf_client_get_bool (client, KEY_LOCK_DISABLE, NULL);
+ lock = g_settings_get_boolean (settings, KEY_LOCK_DISABLE);
- g_object_unref (client);
+ g_object_unref (settings);
return lock;
}
static void
config_set_lock (gboolean lock)
{
- MateConfClient *client;
+ GSettings *settings;
- client = mateconf_client_get_default ();
+ settings = g_settings_new (GSETTINGS_SCHEMA);
- mateconf_client_set_bool (client, KEY_LOCK, lock, NULL);
+ g_settings_set_boolean (settings, KEY_LOCK, lock);
- g_object_unref (client);
+ g_object_unref (settings);
}
static void
@@ -438,20 +405,16 @@ preview_set_theme (GtkWidget *widget,
}
else if (theme && strcmp (theme, "__random") == 0)
{
- GSList *themes;
+ gchar **themes;
themes = get_all_theme_ids (theme_manager);
if (themes != NULL)
{
- GSList *l;
gint32 i;
- i = g_random_int_range (0, g_slist_length (themes));
- l = g_slist_nth (themes, i);
-
- job_set_theme (job, (const char *) l->data);
- g_slist_foreach (themes, (GFunc) g_free, NULL);
- g_slist_free (themes);
+ i = g_random_int_range (0, g_strv_length (themes));
+ job_set_theme (job, themes[i]);
+ g_strfreev (themes);
gs_job_start (job);
}
@@ -1134,13 +1097,6 @@ enabled_checkbox_toggled (GtkToggleButton *button, gpointer user_data)
}
static void
-invalid_type_warning (const char *type)
-{
- g_warning ("Error retrieving configuration key '%s': Invalid type",
- type);
-}
-
-static void
ui_disable_lock (gboolean disable)
{
GtkWidget *widget;
@@ -1206,96 +1162,45 @@ ui_set_delay (int delay)
}
static void
-key_changed_cb (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
- gpointer data)
+key_changed_cb (GSettings *settings, const gchar *key, gpointer data)
{
- const char *key;
- MateConfValue *value;
-
- key = mateconf_entry_get_key (entry);
-
- if (! g_str_has_prefix (key, KEY_DIR) && ! g_str_has_prefix (key, MATE_LOCKDOWN_DIR))
- {
- return;
- }
-
- value = mateconf_entry_get_value (entry);
-
if (strcmp (key, KEY_IDLE_ACTIVATION_ENABLED) == 0)
{
- if (value->type == MATECONF_VALUE_BOOL)
- {
gboolean enabled;
- enabled = mateconf_value_get_bool (value);
+ enabled = g_settings_get_boolean (settings, key);
ui_set_enabled (enabled);
- }
- else
- {
- invalid_type_warning (key);
- }
}
else if (strcmp (key, KEY_LOCK) == 0)
{
- if (value->type == MATECONF_VALUE_BOOL)
- {
- gboolean enabled;
+ gboolean enabled;
- enabled = mateconf_value_get_bool (value);
+ enabled = g_settings_get_boolean (settings, key);
ui_set_lock (enabled);
- }
- else
- {
- invalid_type_warning (key);
- }
}
else if (strcmp (key, KEY_LOCK_DISABLE) == 0)
{
- if (value->type == MATECONF_VALUE_BOOL)
- {
- gboolean disabled;
+ gboolean disabled;
- disabled = mateconf_value_get_bool (value);
+ disabled = g_settings_get_boolean (settings, key);
ui_disable_lock (disabled);
- }
- else
- {
- invalid_type_warning (key);
- }
}
else if (strcmp (key, KEY_THEMES) == 0)
{
- if (value->type == MATECONF_VALUE_LIST)
- {
- GtkWidget *treeview;
+ GtkWidget *treeview;
treeview = GTK_WIDGET (gtk_builder_get_object (builder, "savers_treeview"));
setup_treeview_selection (treeview);
- }
- else
- {
- invalid_type_warning (key);
- }
}
else if (strcmp (key, KEY_ACTIVATE_DELAY) == 0)
{
-
- if (value->type == MATECONF_VALUE_INT)
- {
int delay;
- delay = mateconf_value_get_int (value);
- ui_set_delay (delay);
- }
- else
- {
- invalid_type_warning (key);
- }
+ delay = g_settings_get_int (settings, key);
+ ui_set_delay (delay);
}
else
@@ -1578,12 +1483,12 @@ init_capplet (void)
GtkWidget *fullscreen_preview_area;
GtkWidget *fullscreen_preview_close;
char *gtk_builder_file;
- char *string;
gdouble activate_delay;
gboolean enabled;
gboolean is_writable;
- MateConfClient *client;
+ GSettings *settings;
GError *error=NULL;
+ gint mode;
gtk_builder_file = g_build_filename (GTKBUILDERDIR, GTK_BUILDER_FILE, NULL);
builder = gtk_builder_new();
@@ -1687,42 +1592,21 @@ init_capplet (void)
gtk_widget_show_all (dialog);
/* Update list of themes if using random screensaver */
- client = mateconf_client_get_default ();
- string = mateconf_client_get_string (client, KEY_MODE, NULL);
- if (string != NULL)
- {
- int mode;
- GSList *list;
-
- mateconf_string_to_enum (mode_enum_map, string, &mode);
- g_free (string);
-
- if (mode == GS_MODE_RANDOM)
- {
- list = get_all_theme_ids (theme_manager);
- mateconf_client_set_list (client, KEY_THEMES, MATECONF_VALUE_STRING, list, NULL);
-
- g_slist_foreach (list, (GFunc) g_free, NULL);
- g_slist_free (list);
- }
- }
-
- mateconf_client_add_dir (client, KEY_DIR,
- MATECONF_CLIENT_PRELOAD_ONELEVEL,
- NULL);
- mateconf_client_notify_add (client,
- KEY_DIR,
- key_changed_cb,
- NULL, NULL, NULL);
- mateconf_client_add_dir (client, MATE_LOCKDOWN_DIR,
- MATECONF_CLIENT_PRELOAD_ONELEVEL,
- NULL);
- mateconf_client_notify_add (client,
- MATE_LOCKDOWN_DIR,
- key_changed_cb,
- NULL, NULL, NULL);
-
- g_object_unref (client);
+ settings = g_settings_new (GSETTINGS_SCHEMA);
+ mode = g_settings_get_enum (settings, KEY_MODE);
+ if (mode == GS_MODE_RANDOM) {
+ gchar **list;
+ list = get_all_theme_ids (theme_manager);
+ g_settings_set_strv (settings, KEY_THEMES, (const gchar * const*) list);
+ g_strfreev (list);
+ }
+
+ g_signal_connect (settings,
+ "changed",
+ G_CALLBACK (key_changed_cb),
+ NULL);
+
+ g_object_unref (settings);
preview_clear (preview);
gs_job_set_widget (job, preview);