[gnome-settings-daemon] a11y-keyboard: Port to GSettings



commit 3a03d7a06184246ccbd20fab0422e595fb065d18
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Oct 20 17:29:42 2010 +0100

    a11y-keyboard: Port to GSettings
    
    https://bugzilla.gnome.org/show_bug.cgi?id=632727

 plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c  |  354 +++++--------
 .../a11y-keyboard/gsd-a11y-preferences-dialog.c    |  534 +++-----------------
 2 files changed, 213 insertions(+), 675 deletions(-)
---
diff --git a/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c b/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c
index 0ec489c..34aebd2 100644
--- a/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c
+++ b/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c
@@ -36,7 +36,6 @@
 #include <gdk/gdk.h>
 #include <gdk/gdkx.h>
 #include <gtk/gtk.h>
-#include <gconf/gconf-client.h>
 
 #include <X11/XKBlib.h>
 #include <X11/extensions/XKBstr.h>
@@ -49,7 +48,7 @@
 #include "gsd-a11y-keyboard-manager.h"
 #include "gsd-a11y-preferences-dialog.h"
 
-#define CONFIG_ROOT "/desktop/gnome/accessibility/keyboard"
+#define KEYBOARD_A11Y_SCHEMA "org.gnome.desktop.a11y.keyboard"
 #define NOTIFICATION_TIMEOUT 30
 
 #define GSD_A11Y_KEYBOARD_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_A11Y_KEYBOARD_MANAGER, GsdA11yKeyboardManagerPrivate))
@@ -66,7 +65,7 @@ struct GsdA11yKeyboardManagerPrivate
         GtkStatusIcon    *status_icon;
         XkbDescRec       *original_xkb_desc;
 
-        guint      gconf_notify;
+        GSettings        *settings;
 
 #ifdef HAVE_LIBNOTIFY
         NotifyNotification *notification;
@@ -77,8 +76,7 @@ static void     gsd_a11y_keyboard_manager_class_init  (GsdA11yKeyboardManagerCla
 static void     gsd_a11y_keyboard_manager_init        (GsdA11yKeyboardManager      *a11y_keyboard_manager);
 static void     gsd_a11y_keyboard_manager_finalize    (GObject             *object);
 static void     gsd_a11y_keyboard_manager_ensure_status_icon (GsdA11yKeyboardManager *manager);
-static void     set_server_from_gconf (GsdA11yKeyboardManager *manager,
-				       GConfClient            *client);
+static void     set_server_from_gsettings (GsdA11yKeyboardManager *manager);
 
 G_DEFINE_TYPE (GsdA11yKeyboardManager, gsd_a11y_keyboard_manager, G_TYPE_OBJECT)
 
@@ -92,32 +90,26 @@ static gpointer manager_object = NULL;
 #endif
 
 static void
-device_added_cb (GdkDeviceManager *device_manager,
-		 GdkDevice        *device,
-		 gpointer          user_data)
+device_added_cb (GdkDeviceManager       *device_manager,
+                 GdkDevice              *device,
+                 GsdA11yKeyboardManager *manager)
 {
-	if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD) {
-		GConfClient *client;
-
-		client = gconf_client_get_default ();
-		set_server_from_gconf (user_data, client);
-
-		g_object_unref (client);
-	}
+        if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
+                set_server_from_gsettings (manager);
 }
 
 static void
 set_devicepresence_handler (GsdA11yKeyboardManager *manager)
 {
-	GdkDeviceManager *device_manager;
+        GdkDeviceManager *device_manager;
 
-	device_manager = gdk_display_get_device_manager (gdk_display_get_default ());
-	if (device_manager == NULL)
-		return;
+        device_manager = gdk_display_get_device_manager (gdk_display_get_default ());
+        if (device_manager == NULL)
+                return;
 
-	g_signal_connect (G_OBJECT (device_manager), "device-added",
-			  G_CALLBACK (device_added_cb), manager);
-	manager->priv->device_manager = device_manager;
+        manager->priv->device_manager = device_manager;
+        g_signal_connect (G_OBJECT (device_manager), "device-added",
+                          G_CALLBACK (device_added_cb), manager);
 }
 
 static gboolean
@@ -159,10 +151,10 @@ get_xkb_desc_rec (GsdA11yKeyboardManager *manager)
 }
 
 static int
-get_int (GConfClient *client,
-         char const  *key)
+get_int (GSettings  *settings,
+         char const *key)
 {
-        int res = gconf_client_get_int  (client, key, NULL);
+        int res = g_settings_get_int  (settings, key);
         if (res <= 0) {
                 res = 1;
         }
@@ -170,36 +162,39 @@ get_int (GConfClient *client,
 }
 
 static gboolean
-set_int (GConfClient    *client,
-         GConfChangeSet *cs,
+set_int (GSettings      *settings,
          char const     *key,
          int             val)
 {
-        gconf_change_set_set_int (cs, key, val);
+        int prev_val;
+
+        prev_val = g_settings_get_int (settings, key);
+        g_settings_set_int (settings, key, val);
 #ifdef DEBUG_ACCESSIBILITY
-        if (val != gconf_client_get_int (client, key, NULL)) {
+        if (val != prev_val) {
                 g_warning ("%s changed", key);
         }
 #endif
-        return val != gconf_client_get_int (client, key, NULL);
+        return val != prev_val;
 }
 
 static gboolean
-set_bool (GConfClient    *client,
-          GConfChangeSet *cs,
+set_bool (GSettings      *settings,
           char const     *key,
           int             val)
 {
         gboolean bval = (val != 0);
+        gboolean prev_val;
 
-        gconf_change_set_set_bool (cs, key, bval ? TRUE : FALSE);
+        prev_val = g_settings_get_boolean (settings, key);
+        g_settings_set_boolean (settings, key, bval ? TRUE : FALSE);
 #ifdef DEBUG_ACCESSIBILITY
-                if (bval != gconf_client_get_bool (client, key, NULL)) {
+                if (bval != prev_val) {
                         d ("%s changed", key);
                         return TRUE;
                 }
 #endif
-        return (bval != gconf_client_get_bool (client, key, NULL));
+        return (bval != prev_val);
 }
 
 static unsigned long
@@ -214,22 +209,22 @@ set_clear (gboolean      flag,
 }
 
 static gboolean
-set_ctrl_from_gconf (XkbDescRec   *desc,
-                     GConfClient  *client,
-                     char const   *key,
-                     unsigned long mask)
+set_ctrl_from_gsettings (XkbDescRec   *desc,
+                         GSettings    *settings,
+                         char const   *key,
+                         unsigned long mask)
 {
-        gboolean result = gconf_client_get_bool (client, key, NULL);
+        gboolean result = g_settings_get_boolean (settings, key);
         desc->ctrls->enabled_ctrls = set_clear (result, desc->ctrls->enabled_ctrls, mask);
         return result;
 }
 
 static void
-set_server_from_gconf (GsdA11yKeyboardManager *manager,
-                       GConfClient            *client)
+set_server_from_gsettings (GsdA11yKeyboardManager *manager)
 {
         XkbDescRec      *desc;
         gboolean         enable_accessX;
+        GSettings       *settings;
 
         gnome_settings_profile_start (NULL);
 
@@ -238,19 +233,20 @@ set_server_from_gconf (GsdA11yKeyboardManager *manager,
                 return;
         }
 
+        settings = manager->priv->settings;
+
         /* general */
-        enable_accessX = gconf_client_get_bool (client, CONFIG_ROOT "/enable", NULL);
+        enable_accessX = g_settings_get_boolean (settings, "enable");
 
         desc->ctrls->enabled_ctrls = set_clear (enable_accessX,
                                                 desc->ctrls->enabled_ctrls,
                                                 XkbAccessXKeysMask);
 
-        if (set_ctrl_from_gconf (desc, client, CONFIG_ROOT "/timeout_enable",
-                                 XkbAccessXTimeoutMask)) {
-                desc->ctrls->ax_timeout = get_int (client,
-                                                   CONFIG_ROOT "/timeout");
+        if (set_ctrl_from_gsettings (desc, settings, "timeout-enable",
+                                     XkbAccessXTimeoutMask)) {
+                desc->ctrls->ax_timeout = get_int (settings, "disable-timeout");
                 /* disable only the master flag via the server we will disable
-                 * the rest on the rebound without affecting gconf state
+                 * the rest on the rebound without affecting GSettings state
                  * don't change the option flags at all.
                  */
                 desc->ctrls->axt_ctrls_mask = XkbAccessXKeysMask | XkbAccessXFeedbackMask;
@@ -258,82 +254,67 @@ set_server_from_gconf (GsdA11yKeyboardManager *manager,
                 desc->ctrls->axt_opts_mask = 0;
         }
 
-        desc->ctrls->ax_options = set_clear (gconf_client_get_bool (client, CONFIG_ROOT "/feature_state_change_beep", NULL),
+        desc->ctrls->ax_options = set_clear (g_settings_get_boolean (settings, "feature-state-change-beep"),
                                              desc->ctrls->ax_options,
                                              XkbAccessXFeedbackMask | XkbAX_FeatureFBMask | XkbAX_SlowWarnFBMask);
 
         /* bounce keys */
-        if (set_ctrl_from_gconf (desc,
-                                 client,
-                                 CONFIG_ROOT "/bouncekeys_enable",
-                                 XkbBounceKeysMask)) {
-                desc->ctrls->debounce_delay  = get_int (client,
-                                                        CONFIG_ROOT "/bouncekeys_delay");
-                desc->ctrls->ax_options = set_clear (gconf_client_get_bool (client, CONFIG_ROOT "/bouncekeys_beep_reject", NULL),
+        if (set_ctrl_from_gsettings (desc, settings, "bouncekeys-enable", XkbBounceKeysMask)) {
+                desc->ctrls->debounce_delay = get_int (settings, "bouncekeys-delay");
+                desc->ctrls->ax_options = set_clear (g_settings_get_boolean (settings, "bouncekeys-beep-reject"),
                                                      desc->ctrls->ax_options,
                                                      XkbAccessXFeedbackMask | XkbAX_BKRejectFBMask);
         }
 
         /* mouse keys */
-        if (set_ctrl_from_gconf (desc,
-                                 client,
-                                 CONFIG_ROOT "/mousekeys_enable",
-                                 XkbMouseKeysMask | XkbMouseKeysAccelMask)) {
+        if (set_ctrl_from_gsettings (desc, settings, "mousekeys-enable", XkbMouseKeysMask | XkbMouseKeysAccelMask)) {
                 desc->ctrls->mk_interval     = 100;     /* msec between mousekey events */
                 desc->ctrls->mk_curve        = 50;
 
                 /* We store pixels / sec, XKB wants pixels / event */
-                desc->ctrls->mk_max_speed    = get_int (client,
-                        CONFIG_ROOT "/mousekeys_max_speed") / (1000 / desc->ctrls->mk_interval);
+                desc->ctrls->mk_max_speed    = get_int (settings, "mousekeys-max-speed") / (1000 / desc->ctrls->mk_interval);
                 if (desc->ctrls->mk_max_speed <= 0)
                         desc->ctrls->mk_max_speed = 1;
 
-                desc->ctrls->mk_time_to_max = get_int (client, /* events before max */
-                                                       CONFIG_ROOT "/mousekeys_accel_time") / desc->ctrls->mk_interval;
+                desc->ctrls->mk_time_to_max = get_int (settings, /* events before max */
+                                                       "mousekeys-accel-time") / desc->ctrls->mk_interval;
                 if (desc->ctrls->mk_time_to_max <= 0)
                         desc->ctrls->mk_time_to_max = 1;
 
-                desc->ctrls->mk_delay = get_int (client, /* ms before 1st event */
-                                                 CONFIG_ROOT "/mousekeys_init_delay");
+                desc->ctrls->mk_delay = get_int (settings, /* ms before 1st event */
+                                                 "mousekeys-init-delay");
         }
 
         /* slow keys */
-        if (set_ctrl_from_gconf (desc,
-                                 client,
-                                 CONFIG_ROOT "/slowkeys_enable",
-                                 XkbSlowKeysMask)) {
-                desc->ctrls->ax_options = set_clear (gconf_client_get_bool (client, CONFIG_ROOT "/slowkeys_beep_press", NULL),
+        if (set_ctrl_from_gsettings (desc, settings, "slowkeys-enable", XkbSlowKeysMask)) {
+                desc->ctrls->ax_options = set_clear (g_settings_get_boolean (settings, "slowkeys-beep-press"),
                                                      desc->ctrls->ax_options,
                                                      XkbAccessXFeedbackMask | XkbAX_SKPressFBMask);
-                desc->ctrls->ax_options = set_clear (gconf_client_get_bool (client, CONFIG_ROOT "/slowkeys_beep_accept", NULL),
+                desc->ctrls->ax_options = set_clear (g_settings_get_boolean (settings, "slowkeys-beep-accept"),
                                                      desc->ctrls->ax_options,
                                                      XkbAccessXFeedbackMask | XkbAX_SKAcceptFBMask);
-                desc->ctrls->ax_options = set_clear (gconf_client_get_bool (client, CONFIG_ROOT "/slowkeys_beep_reject", NULL),
+                desc->ctrls->ax_options = set_clear (g_settings_get_boolean (settings, "slowkeys-beep-reject"),
                                                      desc->ctrls->ax_options,
                                                      XkbAccessXFeedbackMask | XkbAX_SKRejectFBMask);
-                desc->ctrls->slow_keys_delay = get_int (client,
-                                                        CONFIG_ROOT "/slowkeys_delay");
+                desc->ctrls->slow_keys_delay = get_int (settings, "slowkeys-delay");
                 /* anything larger than 500 seems to loose all keyboard input */
                 if (desc->ctrls->slow_keys_delay > 500)
                         desc->ctrls->slow_keys_delay = 500;
         }
 
         /* sticky keys */
-        if (set_ctrl_from_gconf (desc,
-                                 client,
-                                 CONFIG_ROOT "/stickykeys_enable",
-                                 XkbStickyKeysMask)) {
+        if (set_ctrl_from_gsettings (desc, settings, "stickykeys-enable", XkbStickyKeysMask)) {
                 desc->ctrls->ax_options |= XkbAX_LatchToLockMask;
-                desc->ctrls->ax_options = set_clear (gconf_client_get_bool (client, CONFIG_ROOT "/stickykeys_two_key_off", NULL),
+                desc->ctrls->ax_options = set_clear (g_settings_get_boolean (settings, "stickykeys-two-key-off"),
                                                      desc->ctrls->ax_options,
                                                      XkbAccessXFeedbackMask | XkbAX_TwoKeysMask);
-                desc->ctrls->ax_options = set_clear (gconf_client_get_bool (client, CONFIG_ROOT "/stickykeys_modifier_beep", NULL),
+                desc->ctrls->ax_options = set_clear (g_settings_get_boolean (settings, "stickykeys-modifier-beep"),
                                                      desc->ctrls->ax_options,
                                                      XkbAccessXFeedbackMask | XkbAX_StickyKeysFBMask);
         }
 
         /* toggle keys */
-        desc->ctrls->ax_options = set_clear (gconf_client_get_bool (client, CONFIG_ROOT "/togglekeys_enable", NULL),
+        desc->ctrls->ax_options = set_clear (g_settings_get_boolean (settings, "togglekeys-enable"),
                                              desc->ctrls->ax_options,
                                              XkbAccessXFeedbackMask | XkbAX_IndicatorFBMask);
 
@@ -370,36 +351,30 @@ ax_response_callback (GsdA11yKeyboardManager *manager,
                       guint                   revert_controls_mask,
                       gboolean                enabled)
 {
-        GConfClient *client;
+        GSettings *settings;
         GdkScreen *screen;
         GError *err;
 
+        settings = manager->priv->settings;
+
         switch (response_id) {
         case GTK_RESPONSE_DELETE_EVENT:
         case GTK_RESPONSE_REJECT:
         case GTK_RESPONSE_CANCEL:
 
-                client = gconf_client_get_default ();
-
                 /* we're reverting, so we invert sense of 'enabled' flag */
                 d ("cancelling AccessX request");
                 if (revert_controls_mask == XkbStickyKeysMask) {
-                        gconf_client_set_bool (client,
-                                               CONFIG_ROOT "/stickykeys_enable",
-                                               !enabled,
-                                               NULL);
+                        g_settings_set_boolean (settings,
+                                                "stickykeys-enable",
+                                                !enabled);
+                } else if (revert_controls_mask == XkbSlowKeysMask) {
+                        g_settings_set_boolean (settings,
+                                                "slowkeys-enable",
+                                                !enabled);
                 }
-                else if (revert_controls_mask == XkbSlowKeysMask) {
-                        gconf_client_set_bool (client,
-                                               CONFIG_ROOT "/slowkeys_enable",
-                                               !enabled,
-                                               NULL);
-                }
-                gconf_client_suggest_sync (client, NULL);
-                set_server_from_gconf (manager, client);
-
-                g_object_unref (client);
 
+                set_server_from_gsettings (manager);
                 break;
 
         case GTK_RESPONSE_HELP:
@@ -460,12 +435,9 @@ static void
 maybe_show_status_icon (GsdA11yKeyboardManager *manager)
 {
         gboolean     show;
-        GConfClient *client;
 
         /* for now, show if accessx is enabled */
-        client = gconf_client_get_default ();
-        show = gconf_client_get_bool (client, CONFIG_ROOT "/enable", NULL);
-        g_object_unref (client);
+        show = g_settings_get_boolean (manager->priv->settings, "enable");
 
         if (!show && manager->priv->status_icon == NULL)
                 return;
@@ -811,114 +783,93 @@ ax_stickykeys_warning_post (GsdA11yKeyboardManager *manager,
 }
 
 static void
-set_gconf_from_server (GsdA11yKeyboardManager *manager)
+set_gsettings_from_server (GsdA11yKeyboardManager *manager)
 {
-        GConfClient    *client;
-        GConfChangeSet *cs;
         XkbDescRec     *desc;
         gboolean        changed = FALSE;
         gboolean        slowkeys_changed;
         gboolean        stickykeys_changed;
+        GSettings      *settings;
 
-        cs = gconf_change_set_new ();
         desc = get_xkb_desc_rec (manager);
         if (! desc) {
                 return;
         }
 
-        client = gconf_client_get_default ();
+        settings = manager->priv->settings;
+        g_settings_delay (settings);
 
         /*
           fprintf (stderr, "changed to : 0x%x\n", desc->ctrls->enabled_ctrls);
           fprintf (stderr, "changed to : 0x%x (2)\n", desc->ctrls->ax_options);
         */
 
-        changed |= set_bool (client,
-                             cs,
-                             CONFIG_ROOT "/enable",
+        changed |= set_bool (settings,
+                             "enable",
                              desc->ctrls->enabled_ctrls & XkbAccessXKeysMask);
 
-        changed |= set_bool (client,
-                             cs,
-                             CONFIG_ROOT "/feature_state_change_beep",
+        changed |= set_bool (settings,
+                             "feature-state-change-beep",
                              desc->ctrls->ax_options & (XkbAX_FeatureFBMask | XkbAX_SlowWarnFBMask));
-        changed |= set_bool (client,
-                             cs,
-                             CONFIG_ROOT "/timeout_enable",
+        changed |= set_bool (settings,
+                             "timeout-enable",
                              desc->ctrls->enabled_ctrls & XkbAccessXTimeoutMask);
-        changed |= set_int (client,
-                            cs,
-                            CONFIG_ROOT "/timeout",
+        changed |= set_int (settings,
+                            "disable-timeout",
                             desc->ctrls->ax_timeout);
 
-        changed |= set_bool (client,
-                             cs,
-                             CONFIG_ROOT "/bouncekeys_enable",
+        changed |= set_bool (settings,
+                             "bouncekeys-enable",
                              desc->ctrls->enabled_ctrls & XkbBounceKeysMask);
-        changed |= set_int (client,
-                            cs,
-                            CONFIG_ROOT "/bouncekeys_delay",
+        changed |= set_int (settings,
+                            "bouncekeys-delay",
                             desc->ctrls->debounce_delay);
-        changed |= set_bool (client,
-                             cs,
-                             CONFIG_ROOT "/bouncekeys_beep_reject",
+        changed |= set_bool (settings,
+                             "bouncekeys-beep-reject",
                              desc->ctrls->ax_options & XkbAX_BKRejectFBMask);
 
-        changed |= set_bool (client,
-                             cs,
-                             CONFIG_ROOT "/mousekeys_enable",
+        changed |= set_bool (settings,
+                             "mousekeys-enable",
                              desc->ctrls->enabled_ctrls & XkbMouseKeysMask);
-        changed |= set_int (client,
-                            cs,
-                            CONFIG_ROOT "/mousekeys_max_speed",
+        changed |= set_int (settings,
+                            "mousekeys-max-speed",
                             desc->ctrls->mk_max_speed * (1000 / desc->ctrls->mk_interval));
         /* NOTE : mk_time_to_max is measured in events not time */
-        changed |= set_int (client,
-                            cs,
-                            CONFIG_ROOT "/mousekeys_accel_time",
+        changed |= set_int (settings,
+                            "mousekeys-accel-time",
                             desc->ctrls->mk_time_to_max * desc->ctrls->mk_interval);
-        changed |= set_int (client,
-                            cs,
-                            CONFIG_ROOT "/mousekeys_init_delay",
+        changed |= set_int (settings,
+                            "mousekeys-init-delay",
                             desc->ctrls->mk_delay);
 
-        slowkeys_changed = set_bool (client,
-                                     cs,
-                                     CONFIG_ROOT "/slowkeys_enable",
+        slowkeys_changed = set_bool (settings,
+                                     "slowkeys-enable",
                                      desc->ctrls->enabled_ctrls & XkbSlowKeysMask);
-        changed |= set_bool (client,
-                             cs,
-                             CONFIG_ROOT "/slowkeys_beep_press",
+        changed |= set_bool (settings,
+                             "slowkeys-beep-press",
                              desc->ctrls->ax_options & XkbAX_SKPressFBMask);
-        changed |= set_bool (client,
-                             cs,
-                             CONFIG_ROOT "/slowkeys_beep_accept",
+        changed |= set_bool (settings,
+                             "slowkeys-beep-accept",
                              desc->ctrls->ax_options & XkbAX_SKAcceptFBMask);
-        changed |= set_bool (client,
-                             cs,
-                             CONFIG_ROOT "/slowkeys_beep_reject",
+        changed |= set_bool (settings,
+                             "slowkeys-beep-reject",
                              desc->ctrls->ax_options & XkbAX_SKRejectFBMask);
-        changed |= set_int (client,
-                            cs,
-                            CONFIG_ROOT "/slowkeys_delay",
+        changed |= set_int (settings,
+                            "slowkeys-delay",
                             desc->ctrls->slow_keys_delay);
 
-        stickykeys_changed = set_bool (client,
-                                       cs,
-                                       CONFIG_ROOT "/stickykeys_enable",
+        stickykeys_changed = set_bool (settings,
+                                       "stickykeys-enable",
                                        desc->ctrls->enabled_ctrls & XkbStickyKeysMask);
-        changed |= set_bool (client,
-                             cs,
-                             CONFIG_ROOT "/stickykeys_two_key_off",
+        changed |= set_bool (settings,
+                             "stickykeys-two-key-off",
                              desc->ctrls->ax_options & XkbAX_TwoKeysMask);
-        changed |= set_bool (client,
-                             cs,
-                             CONFIG_ROOT "/stickykeys_modifier_beep",
+        changed |= set_bool (settings,
+                             "stickykeys-modifier-beep",
                              desc->ctrls->ax_options & XkbAX_StickyKeysFBMask);
 
-        changed |= set_bool (client,
-                             cs,
-                             CONFIG_ROOT "/togglekeys_enable",
+        changed |= set_bool (settings,
+                             "togglekeys-enable",
                              desc->ctrls->ax_options & XkbAX_IndicatorFBMask);
 
         if (!changed && stickykeys_changed ^ slowkeys_changed) {
@@ -945,15 +896,7 @@ set_gconf_from_server (GsdA11yKeyboardManager *manager)
 
         XkbFreeKeyboard (desc, XkbAllComponentsMask, True);
 
-        changed |= (stickykeys_changed | slowkeys_changed);
-
-        if (changed) {
-                gconf_client_commit_change_set (client, cs, FALSE, NULL);
-                gconf_client_suggest_sync (client, NULL);
-        }
-        gconf_change_set_unref (cs);
-
-        g_object_unref (client);
+        g_settings_apply (settings);
 }
 
 static GdkFilterReturn
@@ -967,7 +910,7 @@ cb_xkb_event_filter (GdkXEvent              *xevent,
         if (xev->xany.type == (manager->priv->xkbEventBase + XkbEventCode) &&
             xkbEv->any.xkb_type == XkbControlsNotify) {
                 d ("XKB state changed");
-                set_gconf_from_server (manager);
+                set_gsettings_from_server (manager);
         } else if (xev->xany.type == (manager->priv->xkbEventBase + XkbEventCode) &&
                    xkbEv->any.xkb_type == XkbAccessXNotify) {
                 if (xkbEv->accessx.detail == XkbAXN_AXKWarning) {
@@ -975,7 +918,7 @@ cb_xkb_event_filter (GdkXEvent              *xevent,
                         /*
                          * TODO: when XkbAXN_AXKWarnings start working, we need to
                          * invoke ax_keys_warning_dialog_run here instead of in
-                         * set_gconf_from_server().
+                         * set_gsettings_from_server().
                          */
                 }
         }
@@ -984,31 +927,18 @@ cb_xkb_event_filter (GdkXEvent              *xevent,
 }
 
 static void
-keyboard_callback (GConfClient            *client,
-                   guint                   cnxn_id,
-                   GConfEntry             *entry,
+keyboard_callback (GSettings              *settings,
+                   const char             *key,
                    GsdA11yKeyboardManager *manager)
 {
-        set_server_from_gconf (manager, client);
+        set_server_from_gsettings (manager);
         maybe_show_status_icon (manager);
 }
 
-static void
-register_config_callback (GsdA11yKeyboardManager  *manager,
-                          GConfClient             *client,
-                          const char              *path,
-                          GConfClientNotifyFunc    func,
-                          guint                   *notify)
-{
-        gconf_client_add_dir (client, path, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
-        *notify = gconf_client_notify_add (client, path, func, manager, NULL, NULL);
-}
-
 static gboolean
 start_a11y_keyboard_idle_cb (GsdA11yKeyboardManager *manager)
 {
         guint        event_mask;
-        GConfClient *client;
 
         g_debug ("Starting a11y_keyboard manager");
         gnome_settings_profile_start (NULL);
@@ -1016,15 +946,11 @@ start_a11y_keyboard_idle_cb (GsdA11yKeyboardManager *manager)
         if (!xkb_enabled (manager))
                 goto out;
 
-        client = gconf_client_get_default ();
-
-        register_config_callback (manager,
-                                  client,
-                                  CONFIG_ROOT,
-                                  (GConfClientNotifyFunc) keyboard_callback,
-                                  &manager->priv->gconf_notify);
+        manager->priv->settings = g_settings_new (KEYBOARD_A11Y_SCHEMA);
+        g_signal_connect (G_OBJECT (manager->priv->settings), "changed",
+                          G_CALLBACK (keyboard_callback), manager);
 
-	set_devicepresence_handler (manager);
+        set_devicepresence_handler (manager);
 
         /* Save current xkb state so we can restore it on exit
          */
@@ -1034,8 +960,7 @@ start_a11y_keyboard_idle_cb (GsdA11yKeyboardManager *manager)
         event_mask |= XkbAccessXNotifyMask; /* make default when AXN_AXKWarning works */
 
         /* be sure to init before starting to monitor the server */
-        set_server_from_gconf (manager, client);
-        g_object_unref (client);
+        set_server_from_gsettings (manager);
 
         XkbSelectEvents (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
                          XkbUseCoreKbd,
@@ -1100,21 +1025,16 @@ gsd_a11y_keyboard_manager_stop (GsdA11yKeyboardManager *manager)
 
         g_debug ("Stopping a11y_keyboard manager");
 
-	if (p->device_manager != NULL) {
-		g_object_unref (p->device_manager);
-		p->device_manager = NULL;
-	}
+        if (p->device_manager != NULL) {
+                g_object_unref (p->device_manager);
+                p->device_manager = NULL;
+        }
 
         if (p->status_icon)
                 gtk_status_icon_set_visible (p->status_icon, FALSE);
 
-        if (p->gconf_notify != 0) {
-                GConfClient *client = gconf_client_get_default ();
-                gconf_client_remove_dir (client, CONFIG_ROOT, NULL);
-                gconf_client_notify_remove (client, p->gconf_notify);
-                g_object_unref (client);
-                p->gconf_notify = 0;
-        }
+        g_object_unref (p->settings);
+        p->settings = NULL;
 
         gdk_window_remove_filter (NULL,
                                   (GdkFilterFunc) cb_xkb_event_filter,
diff --git a/plugins/a11y-keyboard/gsd-a11y-preferences-dialog.c b/plugins/a11y-keyboard/gsd-a11y-preferences-dialog.c
index 644f4a6..2d9f3e7 100644
--- a/plugins/a11y-keyboard/gsd-a11y-preferences-dialog.c
+++ b/plugins/a11y-keyboard/gsd-a11y-preferences-dialog.c
@@ -46,16 +46,17 @@
 
 #define GTKBUILDER_UI_FILE "gsd-a11y-preferences-dialog.ui"
 
-#define KEY_A11Y_DIR              "/desktop/gnome/accessibility"
-#define KEY_STICKY_KEYS_ENABLED   KEY_A11Y_DIR "/keyboard/stickykeys_enable"
-#define KEY_BOUNCE_KEYS_ENABLED   KEY_A11Y_DIR "/keyboard/bouncekeys_enable"
-#define KEY_SLOW_KEYS_ENABLED     KEY_A11Y_DIR "/keyboard/slowkeys_enable"
-#define KEY_MOUSE_KEYS_ENABLED    KEY_A11Y_DIR "/keyboard/mousekeys_enable"
+#define INTERFACE_SCHEMA          "org.gnome.desktop.interface"
 
-#define KEY_AT_DIR                "/desktop/gnome/applications/at"
-#define KEY_AT_SCREEN_KEYBOARD_ENABLED  KEY_AT_DIR "/screen_keyboard_enabled"
-#define KEY_AT_SCREEN_MAGNIFIER_ENABLED KEY_AT_DIR "/screen_magnifier_enabled"
-#define KEY_AT_SCREEN_READER_ENABLED    KEY_AT_DIR "/screen_reader_enabled"
+#define KEYBOARD_A11Y_SCHEMA      "org.gnome.desktop.a11y.keyboard"
+#define KEY_STICKY_KEYS_ENABLED   "stickykeys-enable"
+#define KEY_BOUNCE_KEYS_ENABLED   "bouncekeys-enable"
+#define KEY_SLOW_KEYS_ENABLED     "slowkeys-enable"
+
+#define KEY_AT_SCHEMA                "org.gnome.desktop.a11y.applications"
+#define KEY_AT_SCREEN_KEYBOARD_ENABLED  "screen-keyboard-enabled"
+#define KEY_AT_SCREEN_MAGNIFIER_ENABLED "screen-magnifier-enabled"
+#define KEY_AT_SCREEN_READER_ENABLED    "screen-reader-enabled"
 
 #define FONT_RENDER_DIR        "org.gnome.desktop.font-rendering"
 #define KEY_FONT_DPI           "dpi"
@@ -78,7 +79,6 @@
 #define DPI_DEFAULT        96
 
 #define KEY_GTK_THEME          "gtk-theme"
-#define KEY_COLOR_SCHEME       "/desktop/gnome/interface/gtk_color_scheme"
 #define KEY_METACITY_THEME     "/apps/metacity/general/theme"
 #define KEY_ICON_THEME         "icon-theme"
 
@@ -86,19 +86,12 @@
 
 struct GsdA11yPreferencesDialogPrivate
 {
-        GtkWidget *sticky_keys_checkbutton;
-        GtkWidget *slow_keys_checkbutton;
-        GtkWidget *bounce_keys_checkbutton;
-
         GtkWidget *large_print_checkbutton;
         GtkWidget *high_contrast_checkbutton;
 
-        GtkWidget *screen_reader_checkbutton;
-        GtkWidget *screen_keyboard_checkbutton;
-        GtkWidget *screen_magnifier_checkbutton;
-
-        guint      a11y_dir_cnxn;
-        guint      gsd_a11y_dir_cnxn;
+        GSettings *a11y_settings;
+        GSettings *interface_settings;
+        GSettings *apps_settings;
 };
 
 enum {
@@ -181,28 +174,6 @@ on_response (GsdA11yPreferencesDialog *dialog,
         }
 }
 
-static gboolean
-config_get_bool (const char *key,
-                 gboolean   *is_writable)
-{
-        int          enabled;
-        GConfClient *client;
-
-        client = gconf_client_get_default ();
-
-        if (is_writable) {
-                *is_writable = gconf_client_key_is_writable (client,
-                                                             key,
-                                                             NULL);
-        }
-
-        enabled = gconf_client_get_bool (client, key, NULL);
-
-        g_object_unref (client);
-
-        return enabled;
-}
-
 static double
 dpi_from_pixels_and_mm (int pixels,
                         int mm)
@@ -267,6 +238,8 @@ config_get_large_print (gboolean *is_writable)
 
         ret = (((double)DPI_FACTOR_LARGE * x_dpi) < u_dpi);
 
+        *is_writable = TRUE; /* FIXME */
+
         return ret;
 }
 
@@ -295,24 +268,19 @@ config_set_large_print (gboolean enabled)
 }
 
 static gboolean
-config_get_high_contrast (gboolean *is_writable)
+config_get_high_contrast (GsdA11yPreferencesDialog *dialog)
 {
         gboolean ret;
         char    *gtk_theme;
-        GSettings *settings;
 
         ret = FALSE;
 
-        settings = g_settings_new ("org.gnome.desktop.interface");
-        gtk_theme = g_settings_get_string (settings, KEY_GTK_THEME);
-        if (gtk_theme != NULL && strcmp (gtk_theme, HIGH_CONTRAST_THEME) == 0) {
+        gtk_theme = g_settings_get_string (dialog->priv->interface_settings, KEY_GTK_THEME);
+        if (gtk_theme != NULL && g_str_equal (gtk_theme, HIGH_CONTRAST_THEME)) {
                 ret = TRUE;
         }
 
         g_free (gtk_theme);
-        g_object_unref (settings);
-
-        *is_writable = TRUE; /* FIXME: how to know a key is writable or not? */
 
         return ret;
 }
@@ -341,55 +309,7 @@ config_set_high_contrast (gboolean enabled)
 }
 
 static gboolean
-config_get_sticky_keys (gboolean *is_writable)
-{
-        return config_get_bool (KEY_STICKY_KEYS_ENABLED, is_writable);
-}
-
-static void
-config_set_sticky_keys (gboolean enabled)
-{
-        GConfClient *client;
-
-        client = gconf_client_get_default ();
-        gconf_client_set_bool (client, KEY_STICKY_KEYS_ENABLED, enabled, NULL);
-        g_object_unref (client);
-}
-
-static gboolean
-config_get_bounce_keys (gboolean *is_writable)
-{
-        return config_get_bool (KEY_BOUNCE_KEYS_ENABLED, is_writable);
-}
-
-static void
-config_set_bounce_keys (gboolean enabled)
-{
-        GConfClient *client;
-
-        client = gconf_client_get_default ();
-        gconf_client_set_bool (client, KEY_BOUNCE_KEYS_ENABLED, enabled, NULL);
-        g_object_unref (client);
-}
-
-static gboolean
-config_get_slow_keys (gboolean *is_writable)
-{
-        return config_get_bool (KEY_SLOW_KEYS_ENABLED, is_writable);
-}
-
-static void
-config_set_slow_keys (gboolean enabled)
-{
-        GConfClient *client;
-
-        client = gconf_client_get_default ();
-        gconf_client_set_bool (client, KEY_SLOW_KEYS_ENABLED, enabled, NULL);
-        g_object_unref (client);
-}
-
-static gboolean
-config_have_at_gconf_condition (const char *condition)
+config_have_at_gsettings_condition (const char *condition)
 {
         DBusGProxy      *sm_proxy;
         DBusGConnection *connection;
@@ -430,75 +350,6 @@ config_have_at_gconf_condition (const char *condition)
         return is_handled;
 }
 
-static gboolean
-config_get_at_screen_reader (gboolean *is_writable)
-{
-        return config_get_bool (KEY_AT_SCREEN_READER_ENABLED, is_writable);
-}
-
-static gboolean
-config_get_at_screen_keyboard (gboolean *is_writable)
-{
-        return config_get_bool (KEY_AT_SCREEN_KEYBOARD_ENABLED, is_writable);
-}
-
-static gboolean
-config_get_at_screen_magnifier (gboolean *is_writable)
-{
-        return config_get_bool (KEY_AT_SCREEN_MAGNIFIER_ENABLED, is_writable);
-}
-
-static void
-config_set_at_screen_reader (gboolean enabled)
-{
-        GConfClient *client;
-
-        client = gconf_client_get_default ();
-        gconf_client_set_bool (client, KEY_AT_SCREEN_READER_ENABLED, enabled, NULL);
-        g_object_unref (client);
-}
-
-static void
-config_set_at_screen_keyboard (gboolean enabled)
-{
-        GConfClient *client;
-
-        client = gconf_client_get_default ();
-        gconf_client_set_bool (client, KEY_AT_SCREEN_KEYBOARD_ENABLED, enabled, NULL);
-        g_object_unref (client);
-}
-
-static void
-config_set_at_screen_magnifier (gboolean enabled)
-{
-        GConfClient *client;
-
-        client = gconf_client_get_default ();
-        gconf_client_set_bool (client, KEY_AT_SCREEN_MAGNIFIER_ENABLED, enabled, NULL);
-        g_object_unref (client);
-}
-
-static void
-on_sticky_keys_checkbutton_toggled (GtkToggleButton          *button,
-                                    GsdA11yPreferencesDialog *dialog)
-{
-        config_set_sticky_keys (gtk_toggle_button_get_active (button));
-}
-
-static void
-on_bounce_keys_checkbutton_toggled (GtkToggleButton          *button,
-                                 GsdA11yPreferencesDialog *dialog)
-{
-        config_set_bounce_keys (gtk_toggle_button_get_active (button));
-}
-
-static void
-on_slow_keys_checkbutton_toggled (GtkToggleButton          *button,
-                                  GsdA11yPreferencesDialog *dialog)
-{
-        config_set_slow_keys (gtk_toggle_button_get_active (button));
-}
-
 static void
 on_high_contrast_checkbutton_toggled (GtkToggleButton          *button,
                                       GsdA11yPreferencesDialog *dialog)
@@ -507,27 +358,6 @@ on_high_contrast_checkbutton_toggled (GtkToggleButton          *button,
 }
 
 static void
-on_at_screen_reader_checkbutton_toggled (GtkToggleButton          *button,
-                                         GsdA11yPreferencesDialog *dialog)
-{
-        config_set_at_screen_reader (gtk_toggle_button_get_active (button));
-}
-
-static void
-on_at_screen_keyboard_checkbutton_toggled (GtkToggleButton          *button,
-                                           GsdA11yPreferencesDialog *dialog)
-{
-        config_set_at_screen_keyboard (gtk_toggle_button_get_active (button));
-}
-
-static void
-on_at_screen_magnifier_checkbutton_toggled (GtkToggleButton          *button,
-                                            GsdA11yPreferencesDialog *dialog)
-{
-        config_set_at_screen_magnifier (gtk_toggle_button_get_active (button));
-}
-
-static void
 on_large_print_checkbutton_toggled (GtkToggleButton          *button,
                                     GsdA11yPreferencesDialog *dialog)
 {
@@ -535,42 +365,6 @@ on_large_print_checkbutton_toggled (GtkToggleButton          *button,
 }
 
 static void
-ui_set_sticky_keys (GsdA11yPreferencesDialog *dialog,
-                    gboolean                  enabled)
-{
-        gboolean active;
-
-        active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->sticky_keys_checkbutton));
-        if (active != enabled) {
-                gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->sticky_keys_checkbutton), enabled);
-        }
-}
-
-static void
-ui_set_bounce_keys (GsdA11yPreferencesDialog *dialog,
-                    gboolean                  enabled)
-{
-        gboolean active;
-
-        active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->bounce_keys_checkbutton));
-        if (active != enabled) {
-                gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->bounce_keys_checkbutton), enabled);
-        }
-}
-
-static void
-ui_set_slow_keys (GsdA11yPreferencesDialog *dialog,
-                  gboolean                  enabled)
-{
-        gboolean active;
-
-        active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->slow_keys_checkbutton));
-        if (active != enabled) {
-                gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->slow_keys_checkbutton), enabled);
-        }
-}
-
-static void
 ui_set_high_contrast (GsdA11yPreferencesDialog *dialog,
                       gboolean                  enabled)
 {
@@ -583,42 +377,6 @@ ui_set_high_contrast (GsdA11yPreferencesDialog *dialog,
 }
 
 static void
-ui_set_at_screen_reader (GsdA11yPreferencesDialog *dialog,
-                         gboolean                  enabled)
-{
-        gboolean active;
-
-        active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->screen_reader_checkbutton));
-        if (active != enabled) {
-                gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->screen_reader_checkbutton), enabled);
-        }
-}
-
-static void
-ui_set_at_screen_keyboard (GsdA11yPreferencesDialog *dialog,
-                           gboolean                  enabled)
-{
-        gboolean active;
-
-        active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->screen_keyboard_checkbutton));
-        if (active != enabled) {
-                gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->screen_keyboard_checkbutton), enabled);
-        }
-}
-
-static void
-ui_set_at_screen_magnifier (GsdA11yPreferencesDialog *dialog,
-                            gboolean                  enabled)
-{
-        gboolean active;
-
-        active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->screen_magnifier_checkbutton));
-        if (active != enabled) {
-                gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->screen_magnifier_checkbutton), enabled);
-        }
-}
-
-static void
 ui_set_large_print (GsdA11yPreferencesDialog *dialog,
                     gboolean                  enabled)
 {
@@ -631,200 +389,94 @@ ui_set_large_print (GsdA11yPreferencesDialog *dialog,
 }
 
 static void
-key_changed_cb (GConfClient              *client,
-                guint                     cnxn_id,
-                GConfEntry               *entry,
-                GsdA11yPreferencesDialog *dialog)
-{
-        const char *key;
-        GConfValue *value;
-
-        key = gconf_entry_get_key (entry);
-        value = gconf_entry_get_value (entry);
-
-        if (strcmp (key, KEY_STICKY_KEYS_ENABLED) == 0) {
-                if (value->type == GCONF_VALUE_BOOL) {
-                        gboolean enabled;
-
-                        enabled = gconf_value_get_bool (value);
-                        ui_set_sticky_keys (dialog, enabled);
-                } else {
-                        g_warning ("Error retrieving configuration key '%s': Invalid type",
-                                   key);
-                }
-        } else if (strcmp (key, KEY_BOUNCE_KEYS_ENABLED) == 0) {
-                if (value->type == GCONF_VALUE_BOOL) {
-                        gboolean enabled;
-
-                        enabled = gconf_value_get_bool (value);
-                        ui_set_bounce_keys (dialog, enabled);
-                } else {
-                        g_warning ("Error retrieving configuration key '%s': Invalid type",
-                                   key);
-                }
-        } else if (strcmp (key, KEY_SLOW_KEYS_ENABLED) == 0) {
-                if (value->type == GCONF_VALUE_BOOL) {
-                        gboolean enabled;
-
-                        enabled = gconf_value_get_bool (value);
-                        ui_set_slow_keys (dialog, enabled);
-                } else {
-                        g_warning ("Error retrieving configuration key '%s': Invalid type",
-                                   key);
-                }
-        } else if (strcmp (key, KEY_AT_SCREEN_READER_ENABLED) == 0) {
-                if (value->type == GCONF_VALUE_BOOL) {
-                        gboolean enabled;
-
-                        enabled = gconf_value_get_bool (value);
-                        ui_set_at_screen_reader (dialog, enabled);
-                } else {
-                        g_warning ("Error retrieving configuration key '%s': Invalid type",
-                                   key);
-                }
-        } else if (strcmp (key, KEY_AT_SCREEN_KEYBOARD_ENABLED) == 0) {
-                if (value->type == GCONF_VALUE_BOOL) {
-                        gboolean enabled;
-
-                        enabled = gconf_value_get_bool (value);
-                        ui_set_at_screen_keyboard (dialog, enabled);
-                } else {
-                        g_warning ("Error retrieving configuration key '%s': Invalid type",
-                                   key);
-                }
-        } else if (strcmp (key, KEY_AT_SCREEN_MAGNIFIER_ENABLED) == 0) {
-                if (value->type == GCONF_VALUE_BOOL) {
-                        gboolean enabled;
-
-                        enabled = gconf_value_get_bool (value);
-                        ui_set_at_screen_magnifier (dialog, enabled);
-                } else {
-                        g_warning ("Error retrieving configuration key '%s': Invalid type",
-                                   key);
-                }
-        } else {
-                g_debug ("Config key not handled: %s", key);
-        }
-}
-
-static void
 setup_dialog (GsdA11yPreferencesDialog *dialog,
               GtkBuilder               *builder)
 {
         GtkWidget   *widget;
         gboolean     enabled;
         gboolean     is_writable;
-        GConfClient *client;
-
-        widget = GTK_WIDGET (gtk_builder_get_object (builder,
-                                                     "sticky_keys_checkbutton"));
-        dialog->priv->sticky_keys_checkbutton = widget;
-        g_signal_connect (widget,
-                          "toggled",
-                          G_CALLBACK (on_sticky_keys_checkbutton_toggled),
-                          NULL);
-        enabled = config_get_sticky_keys (&is_writable);
-        ui_set_sticky_keys (dialog, enabled);
-        if (! is_writable) {
-                gtk_widget_set_sensitive (widget, FALSE);
-        }
-
-        widget = GTK_WIDGET (gtk_builder_get_object (builder,
-                                                     "bounce_keys_checkbutton"));
-        dialog->priv->bounce_keys_checkbutton = widget;
-        g_signal_connect (widget,
-                          "toggled",
-                          G_CALLBACK (on_bounce_keys_checkbutton_toggled),
-                          NULL);
-        enabled = config_get_bounce_keys (&is_writable);
-        ui_set_bounce_keys (dialog, enabled);
-        if (! is_writable) {
-                gtk_widget_set_sensitive (widget, FALSE);
-        }
-
-        widget = GTK_WIDGET (gtk_builder_get_object (builder,
-                                                     "slow_keys_checkbutton"));
-        dialog->priv->slow_keys_checkbutton = widget;
-        g_signal_connect (widget,
-                          "toggled",
-                          G_CALLBACK (on_slow_keys_checkbutton_toggled),
-                          NULL);
-        enabled = config_get_slow_keys (&is_writable);
-        ui_set_slow_keys (dialog, enabled);
-        if (! is_writable) {
-                gtk_widget_set_sensitive (widget, FALSE);
-        }
+        GSettings   *settings;
 
+        dialog->priv->a11y_settings = g_settings_new (KEYBOARD_A11Y_SCHEMA);
+        settings = dialog->priv->a11y_settings;
+
+        dialog->priv->interface_settings = g_settings_new (INTERFACE_SCHEMA);
+        dialog->priv->apps_settings = g_settings_new (KEY_AT_SCHEMA);
+
+        /* Sticky keys */
+        widget = GTK_WIDGET (gtk_builder_get_object (builder, "sticky_keys_checkbutton"));
+        g_settings_bind (settings, KEY_STICKY_KEYS_ENABLED,
+                         G_OBJECT (widget), "active", G_SETTINGS_BIND_DEFAULT);
+        g_settings_bind_writable (settings, KEY_STICKY_KEYS_ENABLED,
+                                  G_OBJECT (widget), "sensitive", TRUE);
+
+        /* Bounce keys */
+        widget = GTK_WIDGET (gtk_builder_get_object (builder, "bounce_keys_checkbutton"));
+        g_settings_bind (settings, KEY_BOUNCE_KEYS_ENABLED,
+                         G_OBJECT (widget), "active", G_SETTINGS_BIND_DEFAULT);
+        g_settings_bind_writable (settings, KEY_BOUNCE_KEYS_ENABLED,
+                                  G_OBJECT (widget), "sensitive", TRUE);
+
+        /* Slow keys */
+        widget = GTK_WIDGET (gtk_builder_get_object (builder, "slow_keys_checkbutton"));
+        g_settings_bind (settings, KEY_SLOW_KEYS_ENABLED,
+                         G_OBJECT (widget), "active", G_SETTINGS_BIND_DEFAULT);
+        g_settings_bind_writable (settings, KEY_SLOW_KEYS_ENABLED,
+                                  G_OBJECT (widget), "sensitive", TRUE);
+
+        /* High contrast */
         widget = GTK_WIDGET (gtk_builder_get_object (builder,
                                                      "high_contrast_checkbutton"));
+        g_settings_bind_writable (dialog->priv->interface_settings, KEY_GTK_THEME,
+                                  G_OBJECT (widget), "sensitive", TRUE);
         dialog->priv->high_contrast_checkbutton = widget;
         g_signal_connect (widget,
                           "toggled",
                           G_CALLBACK (on_high_contrast_checkbutton_toggled),
                           NULL);
-        enabled = config_get_high_contrast (&is_writable);
+        enabled = config_get_high_contrast (dialog);
         ui_set_high_contrast (dialog, enabled);
-        if (! is_writable) {
-                gtk_widget_set_sensitive (widget, FALSE);
-        }
 
-        widget = GTK_WIDGET (gtk_builder_get_object (builder,
-                                                     "at_screen_keyboard_checkbutton"));
-        dialog->priv->screen_keyboard_checkbutton = widget;
-        g_signal_connect (widget,
-                          "toggled",
-                          G_CALLBACK (on_at_screen_keyboard_checkbutton_toggled),
-                          NULL);
-        enabled = config_get_at_screen_keyboard (&is_writable);
-        ui_set_at_screen_keyboard (dialog, enabled);
-        if (! is_writable) {
-                gtk_widget_set_sensitive (widget, FALSE);
-        }
+        /* On-screen keyboard */
+        widget = GTK_WIDGET (gtk_builder_get_object (builder, "at_screen_keyboard_checkbutton"));
+        g_settings_bind (dialog->priv->apps_settings, KEY_AT_SCREEN_KEYBOARD_ENABLED,
+                         G_OBJECT (widget), "active", G_SETTINGS_BIND_DEFAULT);
+        g_settings_bind_writable (dialog->priv->apps_settings, KEY_AT_SCREEN_KEYBOARD_ENABLED,
+                                  G_OBJECT (widget), "sensitive", TRUE);
         gtk_widget_set_no_show_all (widget, TRUE);
-        if (config_have_at_gconf_condition ("GNOME " KEY_AT_SCREEN_KEYBOARD_ENABLED)) {
+        if (config_have_at_gsettings_condition ("GSettings " KEYBOARD_A11Y_SCHEMA " " KEY_AT_SCREEN_KEYBOARD_ENABLED)) {
                 gtk_widget_show_all (widget);
         } else {
                 gtk_widget_hide (widget);
         }
 
-        widget = GTK_WIDGET (gtk_builder_get_object (builder,
-                                                     "at_screen_reader_checkbutton"));
-        dialog->priv->screen_reader_checkbutton = widget;
-        g_signal_connect (widget,
-                          "toggled",
-                          G_CALLBACK (on_at_screen_reader_checkbutton_toggled),
-                          NULL);
-        enabled = config_get_at_screen_reader (&is_writable);
-        ui_set_at_screen_reader (dialog, enabled);
-        if (! is_writable) {
-                gtk_widget_set_sensitive (widget, FALSE);
-        }
+        /* Screen reader */
+        widget = GTK_WIDGET (gtk_builder_get_object (builder, "at_screen_reader_checkbutton"));
+        g_settings_bind (dialog->priv->apps_settings, KEY_AT_SCREEN_READER_ENABLED,
+                         G_OBJECT (widget), "active", G_SETTINGS_BIND_DEFAULT);
+        g_settings_bind_writable (dialog->priv->apps_settings, KEY_AT_SCREEN_READER_ENABLED,
+                                  G_OBJECT (widget), "sensitive", TRUE);
         gtk_widget_set_no_show_all (widget, TRUE);
-        if (config_have_at_gconf_condition ("GNOME " KEY_AT_SCREEN_READER_ENABLED)) {
+        if (config_have_at_gsettings_condition ("GSettings " KEYBOARD_A11Y_SCHEMA " " KEY_AT_SCREEN_READER_ENABLED)) {
                 gtk_widget_show_all (widget);
         } else {
                 gtk_widget_hide (widget);
         }
 
-        widget = GTK_WIDGET (gtk_builder_get_object (builder,
-                                                     "at_screen_magnifier_checkbutton"));
-        dialog->priv->screen_magnifier_checkbutton = widget;
-        g_signal_connect (widget,
-                          "toggled",
-                          G_CALLBACK (on_at_screen_magnifier_checkbutton_toggled),
-                          NULL);
-        enabled = config_get_at_screen_magnifier (&is_writable);
-        ui_set_at_screen_magnifier (dialog, enabled);
-        if (! is_writable) {
-                gtk_widget_set_sensitive (widget, FALSE);
-        }
+        /* Screen magnifier */
+        widget = GTK_WIDGET (gtk_builder_get_object (builder, "at_screen_magnifier_checkbutton"));
+        g_settings_bind (dialog->priv->apps_settings, KEY_AT_SCREEN_MAGNIFIER_ENABLED,
+                         G_OBJECT (widget), "active", G_SETTINGS_BIND_DEFAULT);
+        g_settings_bind_writable (dialog->priv->apps_settings, KEY_AT_SCREEN_MAGNIFIER_ENABLED,
+                                  G_OBJECT (widget), "sensitive", TRUE);
         gtk_widget_set_no_show_all (widget, TRUE);
-        if (config_have_at_gconf_condition ("GNOME " KEY_AT_SCREEN_MAGNIFIER_ENABLED)) {
+        if (config_have_at_gsettings_condition ("GSettings " KEYBOARD_A11Y_SCHEMA " " KEY_AT_SCREEN_MAGNIFIER_ENABLED)) {
                 gtk_widget_show_all (widget);
         } else {
                 gtk_widget_hide (widget);
         }
 
+        /* Large print */
         widget = GTK_WIDGET (gtk_builder_get_object (builder,
                                                      "large_print_checkbutton"));
         dialog->priv->large_print_checkbutton = widget;
@@ -837,32 +489,6 @@ setup_dialog (GsdA11yPreferencesDialog *dialog,
         if (! is_writable) {
                 gtk_widget_set_sensitive (widget, FALSE);
         }
-
-
-        client = gconf_client_get_default ();
-        gconf_client_add_dir (client,
-                              KEY_A11Y_DIR,
-                              GCONF_CLIENT_PRELOAD_ONELEVEL,
-                              NULL);
-        dialog->priv->a11y_dir_cnxn = gconf_client_notify_add (client,
-                                                               KEY_A11Y_DIR,
-                                                               (GConfClientNotifyFunc)key_changed_cb,
-                                                               dialog,
-                                                               NULL,
-                                                               NULL);
-
-        gconf_client_add_dir (client,
-                              KEY_AT_DIR,
-                              GCONF_CLIENT_PRELOAD_ONELEVEL,
-                              NULL);
-        dialog->priv->gsd_a11y_dir_cnxn = gconf_client_notify_add (client,
-                                                                   KEY_AT_DIR,
-                                                                   (GConfClientNotifyFunc)key_changed_cb,
-                                                                   dialog,
-                                                                   NULL,
-                                                                   NULL);
-
-        g_object_unref (client);
 }
 
 static void
@@ -918,7 +544,6 @@ static void
 gsd_a11y_preferences_dialog_finalize (GObject *object)
 {
         GsdA11yPreferencesDialog *dialog;
-        GConfClient              *client;
 
         g_return_if_fail (object != NULL);
         g_return_if_fail (GSD_IS_A11Y_PREFERENCES_DIALOG (object));
@@ -927,16 +552,9 @@ gsd_a11y_preferences_dialog_finalize (GObject *object)
 
         g_return_if_fail (dialog->priv != NULL);
 
-        client = gconf_client_get_default ();
-
-        if (dialog->priv->a11y_dir_cnxn > 0) {
-                gconf_client_notify_remove (client, dialog->priv->a11y_dir_cnxn);
-        }
-        if (dialog->priv->gsd_a11y_dir_cnxn > 0) {
-                gconf_client_notify_remove (client, dialog->priv->gsd_a11y_dir_cnxn);
-        }
-
-        g_object_unref (client);
+        g_object_unref (dialog->priv->a11y_settings);
+        g_object_unref (dialog->priv->interface_settings);
+        g_object_unref (dialog->priv->apps_settings);
 
         G_OBJECT_CLASS (gsd_a11y_preferences_dialog_parent_class)->finalize (object);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]