summaryrefslogtreecommitdiff
path: root/plugins/a11y-keyboard
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2012-10-01 22:58:54 +0200
committerStefano Karapetsas <[email protected]>2012-10-01 22:58:54 +0200
commitd2c7965aa092cecb857bd0301b7c9ff2dc10f9f8 (patch)
tree016ada3eb78c3c6f438abab5635ba17474d47a2b /plugins/a11y-keyboard
parent03478b4d1d9fdc5f2f2fdbf9c41d963dabc0d00b (diff)
downloadmate-settings-daemon-d2c7965aa092cecb857bd0301b7c9ff2dc10f9f8.tar.bz2
mate-settings-daemon-d2c7965aa092cecb857bd0301b7c9ff2dc10f9f8.tar.xz
migrate to gsettingsmate-settings-daemon-1.5.0
Diffstat (limited to 'plugins/a11y-keyboard')
-rw-r--r--plugins/a11y-keyboard/msd-a11y-keyboard-manager.c310
-rw-r--r--plugins/a11y-keyboard/msd-a11y-preferences-dialog.c385
2 files changed, 260 insertions, 435 deletions
diff --git a/plugins/a11y-keyboard/msd-a11y-keyboard-manager.c b/plugins/a11y-keyboard/msd-a11y-keyboard-manager.c
index 7505b14..5c04082 100644
--- a/plugins/a11y-keyboard/msd-a11y-keyboard-manager.c
+++ b/plugins/a11y-keyboard/msd-a11y-keyboard-manager.c
@@ -36,7 +36,7 @@
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
-#include <mateconf/mateconf-client.h>
+#include <gio/gio.h>
#include <X11/XKBlib.h>
#include <X11/extensions/XKBstr.h>
@@ -54,7 +54,7 @@
#include "msd-a11y-keyboard-manager.h"
#include "msd-a11y-preferences-dialog.h"
-#define CONFIG_ROOT "/desktop/mate/accessibility/keyboard"
+#define CONFIG_SCHEMA "org.mate.accessibility-keyboard"
#define NOTIFICATION_TIMEOUT 30
#define MSD_A11Y_KEYBOARD_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), MSD_TYPE_A11Y_KEYBOARD_MANAGER, MsdA11yKeyboardManagerPrivate))
@@ -70,7 +70,7 @@ struct MsdA11yKeyboardManagerPrivate
GtkStatusIcon *status_icon;
XkbDescRec *original_xkb_desc;
- guint mateconf_notify;
+ GSettings *settings;
#ifdef HAVE_LIBMATENOTIFY
NotifyNotification *notification;
@@ -81,8 +81,7 @@ static void msd_a11y_keyboard_manager_class_init (MsdA11yKeyboardManagerCla
static void msd_a11y_keyboard_manager_init (MsdA11yKeyboardManager *a11y_keyboard_manager);
static void msd_a11y_keyboard_manager_finalize (GObject *object);
static void msd_a11y_keyboard_manager_ensure_status_icon (MsdA11yKeyboardManager *manager);
-static void set_server_from_mateconf (MsdA11yKeyboardManager *manager,
- MateConfClient *client);
+static void set_server_from_settings (MsdA11yKeyboardManager *manager);
G_DEFINE_TYPE (MsdA11yKeyboardManager, msd_a11y_keyboard_manager, G_TYPE_OBJECT)
@@ -111,10 +110,7 @@ devicepresence_filter (GdkXEvent *xevent,
{
XDevicePresenceNotifyEvent *dpn = (XDevicePresenceNotifyEvent *) xev;
if (dpn->devchange == DeviceEnabled) {
- MateConfClient *client;
- client = mateconf_client_get_default ();
- set_server_from_mateconf (data, client);
- g_object_unref (client);
+ set_server_from_settings (data);
}
}
return GDK_FILTER_CONTINUE;
@@ -199,10 +195,10 @@ get_xkb_desc_rec (MsdA11yKeyboardManager *manager)
}
static int
-get_int (MateConfClient *client,
- char const *key)
+get_int (GSettings *settings,
+ char const *key)
{
- int res = mateconf_client_get_int (client, key, NULL);
+ int res = g_settings_get_int (settings, key);
if (res <= 0) {
res = 1;
}
@@ -210,36 +206,36 @@ get_int (MateConfClient *client,
}
static gboolean
-set_int (MateConfClient *client,
- MateConfChangeSet *cs,
+set_int (GSettings *settings,
char const *key,
int val)
{
- mateconf_change_set_set_int (cs, key, val);
+ int pre_val = g_settings_get_int (settings, key);
+ g_settings_set_int (settings, key, val);
#ifdef DEBUG_ACCESSIBILITY
- if (val != mateconf_client_get_int (client, key, NULL)) {
+ if (val != pre_val) {
g_warning ("%s changed", key);
}
#endif
- return val != mateconf_client_get_int (client, key, NULL);
+ return val != pre_val;
}
static gboolean
-set_bool (MateConfClient *client,
- MateConfChangeSet *cs,
+set_bool (GSettings *settings,
char const *key,
int val)
{
gboolean bval = (val != 0);
+ gboolean pre_val = g_settings_get_boolean (settings, key);
- mateconf_change_set_set_bool (cs, key, bval ? TRUE : FALSE);
+ g_settings_set_boolean (settings, key, bval ? TRUE : FALSE);
#ifdef DEBUG_ACCESSIBILITY
- if (bval != mateconf_client_get_bool (client, key, NULL)) {
- d ("%s changed", key);
- return TRUE;
- }
+ if (bval != pre_val) {
+ d ("%s changed", key);
+ return TRUE;
+ }
#endif
- return (bval != mateconf_client_get_bool (client, key, NULL));
+ return (bval != pre_val);
}
static unsigned long
@@ -254,19 +250,18 @@ set_clear (gboolean flag,
}
static gboolean
-set_ctrl_from_mateconf (XkbDescRec *desc,
- MateConfClient *client,
+set_ctrl_from_settings (XkbDescRec *desc,
+ GSettings *settings,
char const *key,
unsigned long mask)
{
- gboolean result = mateconf_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_mateconf (MsdA11yKeyboardManager *manager,
- MateConfClient *client)
+set_server_from_settings (MsdA11yKeyboardManager *manager)
{
XkbDescRec *desc;
gboolean enable_accessX;
@@ -279,18 +274,17 @@ set_server_from_mateconf (MsdA11yKeyboardManager *manager,
}
/* general */
- enable_accessX = mateconf_client_get_bool (client, CONFIG_ROOT "/enable", NULL);
+ enable_accessX = g_settings_get_boolean (manager->priv->settings, "enable");
desc->ctrls->enabled_ctrls = set_clear (enable_accessX,
desc->ctrls->enabled_ctrls,
XkbAccessXKeysMask);
- if (set_ctrl_from_mateconf (desc, client, CONFIG_ROOT "/timeout_enable",
+ if (set_ctrl_from_settings (desc, manager->priv->settings, "timeout-enable",
XkbAccessXTimeoutMask)) {
- desc->ctrls->ax_timeout = get_int (client,
- CONFIG_ROOT "/timeout");
+ desc->ctrls->ax_timeout = get_int (manager->priv->settings, "timeout");
/* disable only the master flag via the server we will disable
- * the rest on the rebound without affecting mateconf 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;
@@ -298,82 +292,82 @@ set_server_from_mateconf (MsdA11yKeyboardManager *manager,
desc->ctrls->axt_opts_mask = 0;
}
- desc->ctrls->ax_options = set_clear (mateconf_client_get_bool (client, CONFIG_ROOT "/feature_state_change_beep", NULL),
+ desc->ctrls->ax_options = set_clear (g_settings_get_boolean (manager->priv->settings, "feature-state-change-beep"),
desc->ctrls->ax_options,
XkbAccessXFeedbackMask | XkbAX_FeatureFBMask | XkbAX_SlowWarnFBMask);
/* bounce keys */
- if (set_ctrl_from_mateconf (desc,
- client,
- CONFIG_ROOT "/bouncekeys_enable",
+ if (set_ctrl_from_settings (desc,
+ manager->priv->settings,
+ "bouncekeys-enable",
XkbBounceKeysMask)) {
- desc->ctrls->debounce_delay = get_int (client,
- CONFIG_ROOT "/bouncekeys_delay");
- desc->ctrls->ax_options = set_clear (mateconf_client_get_bool (client, CONFIG_ROOT "/bouncekeys_beep_reject", NULL),
+ desc->ctrls->debounce_delay = get_int (manager->priv->settings,
+ "bouncekeys-delay");
+ desc->ctrls->ax_options = set_clear (g_settings_get_boolean (manager->priv->settings, "bouncekeys-beep-reject"),
desc->ctrls->ax_options,
XkbAccessXFeedbackMask | XkbAX_BKRejectFBMask);
}
/* mouse keys */
- if (set_ctrl_from_mateconf (desc,
- client,
- CONFIG_ROOT "/mousekeys_enable",
+ if (set_ctrl_from_settings (desc,
+ manager->priv->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 (manager->priv->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 (manager->priv->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 (manager->priv->settings, /* ms before 1st event */
+ "mousekeys-init-delay");
}
/* slow keys */
- if (set_ctrl_from_mateconf (desc,
- client,
- CONFIG_ROOT "/slowkeys_enable",
+ if (set_ctrl_from_settings (desc,
+ manager->priv->settings,
+ "slowkeys-enable",
XkbSlowKeysMask)) {
- desc->ctrls->ax_options = set_clear (mateconf_client_get_bool (client, CONFIG_ROOT "/slowkeys_beep_press", NULL),
+ desc->ctrls->ax_options = set_clear (g_settings_get_boolean (manager->priv->settings, "slowkeys-beep-press"),
desc->ctrls->ax_options,
XkbAccessXFeedbackMask | XkbAX_SKPressFBMask);
- desc->ctrls->ax_options = set_clear (mateconf_client_get_bool (client, CONFIG_ROOT "/slowkeys_beep_accept", NULL),
+ desc->ctrls->ax_options = set_clear (g_settings_get_boolean (manager->priv->settings, "slowkeys-beep-accept"),
desc->ctrls->ax_options,
XkbAccessXFeedbackMask | XkbAX_SKAcceptFBMask);
- desc->ctrls->ax_options = set_clear (mateconf_client_get_bool (client, CONFIG_ROOT "/slowkeys_beep_reject", NULL),
+ desc->ctrls->ax_options = set_clear (g_settings_get_boolean (manager->priv->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 (manager->priv->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_mateconf (desc,
- client,
- CONFIG_ROOT "/stickykeys_enable",
+ if (set_ctrl_from_settings (desc,
+ manager->priv->settings,
+ "stickykeys-enable",
XkbStickyKeysMask)) {
desc->ctrls->ax_options |= XkbAX_LatchToLockMask;
- desc->ctrls->ax_options = set_clear (mateconf_client_get_bool (client, CONFIG_ROOT "/stickykeys_two_key_off", NULL),
+ desc->ctrls->ax_options = set_clear (g_settings_get_boolean (manager->priv->settings, "stickykeys-two-key-off"),
desc->ctrls->ax_options,
XkbAccessXFeedbackMask | XkbAX_TwoKeysMask);
- desc->ctrls->ax_options = set_clear (mateconf_client_get_bool (client, CONFIG_ROOT "/stickykeys_modifier_beep", NULL),
+ desc->ctrls->ax_options = set_clear (g_settings_get_boolean (manager->priv->settings, "stickykeys-modifier-beep"),
desc->ctrls->ax_options,
XkbAccessXFeedbackMask | XkbAX_StickyKeysFBMask);
}
/* toggle keys */
- desc->ctrls->ax_options = set_clear (mateconf_client_get_bool (client, CONFIG_ROOT "/togglekeys_enable", NULL),
+ desc->ctrls->ax_options = set_clear (g_settings_get_boolean (manager->priv->settings, "togglekeys-enable"),
desc->ctrls->ax_options,
XkbAccessXFeedbackMask | XkbAX_IndicatorFBMask);
@@ -410,7 +404,6 @@ ax_response_callback (MsdA11yKeyboardManager *manager,
guint revert_controls_mask,
gboolean enabled)
{
- MateConfClient *client;
GdkScreen *screen;
GError *err;
@@ -419,26 +412,19 @@ ax_response_callback (MsdA11yKeyboardManager *manager,
case GTK_RESPONSE_REJECT:
case GTK_RESPONSE_CANCEL:
- client = mateconf_client_get_default ();
-
/* we're reverting, so we invert sense of 'enabled' flag */
d ("cancelling AccessX request");
if (revert_controls_mask == XkbStickyKeysMask) {
- mateconf_client_set_bool (client,
- CONFIG_ROOT "/stickykeys_enable",
- !enabled,
- NULL);
+ g_settings_set_boolean (manager->priv->settings,
+ "stickykeys-enable",
+ !enabled);
}
else if (revert_controls_mask == XkbSlowKeysMask) {
- mateconf_client_set_bool (client,
- CONFIG_ROOT "/slowkeys_enable",
- !enabled,
- NULL);
+ g_settings_set_boolean (manager->priv->settings,
+ "slowkeys-enable",
+ !enabled);
}
- mateconf_client_suggest_sync (client, NULL);
- set_server_from_mateconf (manager, client);
-
- g_object_unref (client);
+ set_server_from_settings (manager);
break;
@@ -500,12 +486,9 @@ static void
maybe_show_status_icon (MsdA11yKeyboardManager *manager)
{
gboolean show;
- MateConfClient *client;
/* for now, show if accessx is enabled */
- client = mateconf_client_get_default ();
- show = mateconf_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;
@@ -855,114 +838,93 @@ ax_stickykeys_warning_post (MsdA11yKeyboardManager *manager,
}
static void
-set_mateconf_from_server (MsdA11yKeyboardManager *manager)
+set_settings_from_server (MsdA11yKeyboardManager *manager)
{
- MateConfClient *client;
- MateConfChangeSet *cs;
+ GSettings *settings;
XkbDescRec *desc;
gboolean changed = FALSE;
gboolean slowkeys_changed;
gboolean stickykeys_changed;
- cs = mateconf_change_set_new ();
desc = get_xkb_desc_rec (manager);
if (! desc) {
return;
}
- client = mateconf_client_get_default ();
+ settings = g_settings_new (CONFIG_SCHEMA);
+ 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,
+ "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) {
@@ -992,12 +954,10 @@ set_mateconf_from_server (MsdA11yKeyboardManager *manager)
changed |= (stickykeys_changed | slowkeys_changed);
if (changed) {
- mateconf_client_commit_change_set (client, cs, FALSE, NULL);
- mateconf_client_suggest_sync (client, NULL);
+ g_settings_apply (settings);
}
- mateconf_change_set_unref (cs);
- g_object_unref (client);
+ g_object_unref (settings);
}
static GdkFilterReturn
@@ -1011,7 +971,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_mateconf_from_server (manager);
+ set_settings_from_server (manager);
} else if (xev->xany.type == (manager->priv->xkbEventBase + XkbEventCode) &&
xkbEv->any.xkb_type == XkbAccessXNotify) {
if (xkbEv->accessx.detail == XkbAXN_AXKWarning) {
@@ -1019,7 +979,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_mateconf_from_server().
+ * set_settings_from_server().
*/
}
}
@@ -1028,31 +988,18 @@ cb_xkb_event_filter (GdkXEvent *xevent,
}
static void
-keyboard_callback (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
+keyboard_callback (GSettings *settings,
+ gchar *key,
MsdA11yKeyboardManager *manager)
{
- set_server_from_mateconf (manager, client);
+ set_server_from_settings (manager);
maybe_show_status_icon (manager);
}
-static void
-register_config_callback (MsdA11yKeyboardManager *manager,
- MateConfClient *client,
- const char *path,
- MateConfClientNotifyFunc func,
- guint *notify)
-{
- mateconf_client_add_dir (client, path, MATECONF_CLIENT_PRELOAD_ONELEVEL, NULL);
- *notify = mateconf_client_notify_add (client, path, func, manager, NULL, NULL);
-}
-
static gboolean
start_a11y_keyboard_idle_cb (MsdA11yKeyboardManager *manager)
{
guint event_mask;
- MateConfClient *client;
g_debug ("Starting a11y_keyboard manager");
mate_settings_profile_start (NULL);
@@ -1060,13 +1007,8 @@ start_a11y_keyboard_idle_cb (MsdA11yKeyboardManager *manager)
if (!xkb_enabled (manager))
goto out;
- client = mateconf_client_get_default ();
-
- register_config_callback (manager,
- client,
- CONFIG_ROOT,
- (MateConfClientNotifyFunc) keyboard_callback,
- &manager->priv->mateconf_notify);
+ manager->priv->settings = g_settings_new (CONFIG_SCHEMA);
+ g_signal_connect (manager->priv->settings, "changed", G_CALLBACK (keyboard_callback), manager);
#ifdef HAVE_X11_EXTENSIONS_XINPUT_H
set_devicepresence_handler (manager);
@@ -1082,8 +1024,7 @@ start_a11y_keyboard_idle_cb (MsdA11yKeyboardManager *manager)
#endif
/* be sure to init before starting to monitor the server */
- set_server_from_mateconf (manager, client);
- g_object_unref (client);
+ set_server_from_settings (manager);
XkbSelectEvents (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()),
XkbUseCoreKbd,
@@ -1155,12 +1096,9 @@ msd_a11y_keyboard_manager_stop (MsdA11yKeyboardManager *manager)
if (p->status_icon)
gtk_status_icon_set_visible (p->status_icon, FALSE);
- if (p->mateconf_notify != 0) {
- MateConfClient *client = mateconf_client_get_default ();
- mateconf_client_remove_dir (client, CONFIG_ROOT, NULL);
- mateconf_client_notify_remove (client, p->mateconf_notify);
- g_object_unref (client);
- p->mateconf_notify = 0;
+ if (p->settings != NULL) {
+ g_object_unref (p->settings);
+ p->settings = NULL;
}
gdk_window_remove_filter (NULL,
diff --git a/plugins/a11y-keyboard/msd-a11y-preferences-dialog.c b/plugins/a11y-keyboard/msd-a11y-preferences-dialog.c
index a5db11c..d1aaf20 100644
--- a/plugins/a11y-keyboard/msd-a11y-preferences-dialog.c
+++ b/plugins/a11y-keyboard/msd-a11y-preferences-dialog.c
@@ -32,7 +32,7 @@
#include <dbus/dbus-glib.h>
-#include <mateconf/mateconf-client.h>
+#include <gio/gio.h>
#include "msd-a11y-preferences-dialog.h"
@@ -45,19 +45,20 @@
#define GTKBUILDER_UI_FILE "msd-a11y-preferences-dialog.ui"
-#define KEY_A11Y_DIR "/desktop/mate/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 KEY_A11Y_SCHEMA "org.mate.accessibility-keyboard"
+#define KEY_STICKY_KEYS_ENABLED "stickykeys-enable"
+#define KEY_BOUNCE_KEYS_ENABLED "bouncekeys-enable"
+#define KEY_SLOW_KEYS_ENABLED "slowkeys-enable"
+#define KEY_MOUSE_KEYS_ENABLED "mousekeys-enable"
-#define KEY_AT_DIR "/desktop/mate/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 KEY_AT_SCHEMA "org.mate.applications-at"
+#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_SCHEMA "org.mate.font-rendering"
+#define KEY_FONT_DPI "dpi"
-#define FONT_RENDER_DIR "/desktop/mate/font_rendering"
-#define KEY_FONT_DPI FONT_RENDER_DIR "/dpi"
/* X servers sometimes lie about the screen's physical dimensions, so we cannot
* compute an accurate DPI value. When this happens, the user gets fonts that
* are too huge or too tiny. So, we see what the server returns: if it reports
@@ -65,7 +66,7 @@
* DPI_HIGH_REASONABLE_VALUE], then we assume that it is lying and we use
* DPI_FALLBACK instead.
*
- * See get_dpi_from_mateconf_or_server() below, and also
+ * See get_dpi_from_gsettings_or_server() below, and also
* https://bugzilla.novell.com/show_bug.cgi?id=217790
*/
#define DPI_LOW_REASONABLE_VALUE 50
@@ -76,10 +77,13 @@
#define DPI_FACTOR_LARGEST 2.0
#define DPI_DEFAULT 96
-#define KEY_GTK_THEME "/desktop/mate/interface/gtk_theme"
-#define KEY_COLOR_SCHEME "/desktop/mate/interface/gtk_color_scheme"
-#define KEY_MARCO_THEME "/apps/marco/general/theme"
-#define KEY_ICON_THEME "/desktop/mate/interface/icon_theme"
+#define KEY_INTERFACE_SCHEMA "org.mate.interface"
+#define KEY_GTK_THEME "gtk-theme"
+#define KEY_COLOR_SCHEME "gtk-color-scheme"
+#define KEY_ICON_THEME "icon-theme"
+
+#define KEY_MARCO_SCHEMA "org.mate.Marco"
+#define KEY_MARCO_THEME "theme"
#define HIGH_CONTRAST_THEME "HighContrast"
@@ -96,8 +100,10 @@ struct MsdA11yPreferencesDialogPrivate
GtkWidget *screen_keyboard_checkbutton;
GtkWidget *screen_magnifier_checkbutton;
- guint a11y_dir_cnxn;
- guint msd_a11y_dir_cnxn;
+ GSettings *settings_a11y;
+ GSettings *settings_at;
+ GSettings *settings_interface;
+ GSettings *settings_marco;
};
enum {
@@ -180,46 +186,18 @@ on_response (MsdA11yPreferencesDialog *dialog,
}
}
-static char *
-config_get_string (const char *key,
- gboolean *is_writable)
-{
- char *str;
- MateConfClient *client;
-
- client = mateconf_client_get_default ();
-
- if (is_writable) {
- *is_writable = mateconf_client_key_is_writable (client,
- key,
- NULL);
- }
-
- str = mateconf_client_get_string (client, key, NULL);
-
- g_object_unref (client);
-
- return str;
-}
-
static gboolean
-config_get_bool (const char *key,
+config_get_bool (GSettings *settings,
+ const char *key,
gboolean *is_writable)
{
int enabled;
- MateConfClient *client;
-
- client = mateconf_client_get_default ();
if (is_writable) {
- *is_writable = mateconf_client_key_is_writable (client,
- key,
- NULL);
+ *is_writable = g_settings_is_writable (settings, key);
}
- enabled = mateconf_client_get_bool (client, key, NULL);
-
- g_object_unref (client);
+ enabled = g_settings_get_boolean (settings, key);
return enabled;
}
@@ -273,25 +251,25 @@ get_dpi_from_x_server (void)
static gboolean
config_get_large_print (gboolean *is_writable)
{
+ GSettings *settings;
gboolean ret;
- MateConfClient *client;
- MateConfValue *value;
gdouble x_dpi;
gdouble u_dpi;
+ gdouble gs_dpi;
- client = mateconf_client_get_default ();
- value = mateconf_client_get_without_default (client, KEY_FONT_DPI, NULL);
+ settings = g_settings_new (FONT_RENDER_SCHEMA);
- if (value != NULL) {
- u_dpi = mateconf_value_get_float (value);
- mateconf_value_free (value);
+ gs_dpi = g_settings_get_double (settings, KEY_FONT_DPI);
+
+ if (gs_dpi != 0) {
+ u_dpi = gs_dpi;
} else {
u_dpi = DPI_DEFAULT;
}
x_dpi = get_dpi_from_x_server ();
- g_object_unref (client);
+ g_object_unref (settings);
g_debug ("MsdA11yPreferences: got x-dpi=%f user-dpi=%f", x_dpi, u_dpi);
@@ -303,9 +281,9 @@ config_get_large_print (gboolean *is_writable)
static void
config_set_large_print (gboolean enabled)
{
- MateConfClient *client;
+ GSettings *settings;
- client = mateconf_client_get_default ();
+ settings = g_settings_new (FONT_RENDER_SCHEMA);
if (enabled) {
gdouble x_dpi;
@@ -316,23 +294,25 @@ config_set_large_print (gboolean enabled)
g_debug ("MsdA11yPreferences: setting x-dpi=%f user-dpi=%f", x_dpi, u_dpi);
- mateconf_client_set_float (client, KEY_FONT_DPI, u_dpi, NULL);
+ g_settings_set_double (settings, KEY_FONT_DPI, u_dpi);
} else {
- mateconf_client_unset (client, KEY_FONT_DPI, NULL);
+ g_settings_reset (settings, KEY_FONT_DPI);
}
- g_object_unref (client);
+ g_object_unref (settings);
}
static gboolean
-config_get_high_contrast (gboolean *is_writable)
+config_get_high_contrast (MsdA11yPreferencesDialog *dialog, gboolean *is_writable)
{
gboolean ret;
char *gtk_theme;
ret = FALSE;
- gtk_theme = config_get_string (KEY_GTK_THEME, is_writable);
+ is_writable = g_settings_is_writable (dialog->priv->settings_interface, KEY_GTK_THEME);
+ gtk_theme = g_settings_get_string (dialog->priv->settings_interface, KEY_GTK_THEME);
+
if (gtk_theme != NULL && strcmp (gtk_theme, HIGH_CONTRAST_THEME) == 0) {
ret = TRUE;
}
@@ -342,75 +322,57 @@ config_get_high_contrast (gboolean *is_writable)
}
static void
-config_set_high_contrast (gboolean enabled)
+config_set_high_contrast (MsdA11yPreferencesDialog *dialog, gboolean enabled)
{
- MateConfClient *client;
-
- client = mateconf_client_get_default ();
-
if (enabled) {
- mateconf_client_set_string (client, KEY_GTK_THEME, HIGH_CONTRAST_THEME, NULL);
- mateconf_client_set_string (client, KEY_ICON_THEME, HIGH_CONTRAST_THEME, NULL);
+ g_settings_set_string (dialog->priv->settings_interface, KEY_GTK_THEME, HIGH_CONTRAST_THEME);
+ g_settings_set_string (dialog->priv->settings_interface, KEY_ICON_THEME, HIGH_CONTRAST_THEME);
/* there isn't a high contrast marco theme afaik */
} else {
- mateconf_client_unset (client, KEY_GTK_THEME, NULL);
- mateconf_client_unset (client, KEY_ICON_THEME, NULL);
- mateconf_client_unset (client, KEY_MARCO_THEME, NULL);
+ g_settings_reset (dialog->priv->settings_interface, KEY_GTK_THEME);
+ g_settings_reset (dialog->priv->settings_interface, KEY_ICON_THEME);
+ g_settings_reset (dialog->priv->settings_marco, KEY_MARCO_THEME);
}
-
- g_object_unref (client);
}
static gboolean
-config_get_sticky_keys (gboolean *is_writable)
+config_get_sticky_keys (MsdA11yPreferencesDialog *dialog, gboolean *is_writable)
{
- return config_get_bool (KEY_STICKY_KEYS_ENABLED, is_writable);
+ return config_get_bool (dialog->priv->settings_a11y, KEY_STICKY_KEYS_ENABLED, is_writable);
}
static void
-config_set_sticky_keys (gboolean enabled)
+config_set_sticky_keys (MsdA11yPreferencesDialog *dialog, gboolean enabled)
{
- MateConfClient *client;
-
- client = mateconf_client_get_default ();
- mateconf_client_set_bool (client, KEY_STICKY_KEYS_ENABLED, enabled, NULL);
- g_object_unref (client);
+ g_settings_set_boolean (dialog->priv->settings_a11y, KEY_STICKY_KEYS_ENABLED, enabled);
}
static gboolean
-config_get_bounce_keys (gboolean *is_writable)
+config_get_bounce_keys (MsdA11yPreferencesDialog *dialog, gboolean *is_writable)
{
- return config_get_bool (KEY_BOUNCE_KEYS_ENABLED, is_writable);
+ return config_get_bool (dialog->priv->settings_a11y, KEY_BOUNCE_KEYS_ENABLED, is_writable);
}
static void
-config_set_bounce_keys (gboolean enabled)
+config_set_bounce_keys (MsdA11yPreferencesDialog *dialog, gboolean enabled)
{
- MateConfClient *client;
-
- client = mateconf_client_get_default ();
- mateconf_client_set_bool (client, KEY_BOUNCE_KEYS_ENABLED, enabled, NULL);
- g_object_unref (client);
+ g_settings_set_boolean (dialog->priv->settings_a11y, KEY_BOUNCE_KEYS_ENABLED, enabled);
}
static gboolean
-config_get_slow_keys (gboolean *is_writable)
+config_get_slow_keys (MsdA11yPreferencesDialog *dialog, gboolean *is_writable)
{
- return config_get_bool (KEY_SLOW_KEYS_ENABLED, is_writable);
+ return config_get_bool (dialog->priv->settings_a11y, KEY_SLOW_KEYS_ENABLED, is_writable);
}
static void
-config_set_slow_keys (gboolean enabled)
+config_set_slow_keys (MsdA11yPreferencesDialog *dialog, gboolean enabled)
{
- MateConfClient *client;
-
- client = mateconf_client_get_default ();
- mateconf_client_set_bool (client, KEY_SLOW_KEYS_ENABLED, enabled, NULL);
- g_object_unref (client);
+ g_settings_set_boolean (dialog->priv->settings_a11y, KEY_SLOW_KEYS_ENABLED, enabled);
}
static gboolean
-config_have_at_mateconf_condition (const char *condition)
+config_have_at_gsettings_condition (const char *condition)
{
DBusGProxy *sm_proxy;
DBusGConnection *connection;
@@ -452,100 +414,88 @@ config_have_at_mateconf_condition (const char *condition)
}
static gboolean
-config_get_at_screen_reader (gboolean *is_writable)
+config_get_at_screen_reader (MsdA11yPreferencesDialog *dialog, gboolean *is_writable)
{
- return config_get_bool (KEY_AT_SCREEN_READER_ENABLED, is_writable);
+ return config_get_bool (dialog->priv->settings_at, KEY_AT_SCREEN_READER_ENABLED, is_writable);
}
static gboolean
-config_get_at_screen_keyboard (gboolean *is_writable)
+config_get_at_screen_keyboard (MsdA11yPreferencesDialog *dialog, gboolean *is_writable)
{
- return config_get_bool (KEY_AT_SCREEN_KEYBOARD_ENABLED, is_writable);
+ return config_get_bool (dialog->priv->settings_at, KEY_AT_SCREEN_KEYBOARD_ENABLED, is_writable);
}
static gboolean
-config_get_at_screen_magnifier (gboolean *is_writable)
+config_get_at_screen_magnifier (MsdA11yPreferencesDialog *dialog, gboolean *is_writable)
{
- return config_get_bool (KEY_AT_SCREEN_MAGNIFIER_ENABLED, is_writable);
+ return config_get_bool (dialog->priv->settings_at, KEY_AT_SCREEN_MAGNIFIER_ENABLED, is_writable);
}
static void
-config_set_at_screen_reader (gboolean enabled)
+config_set_at_screen_reader (MsdA11yPreferencesDialog *dialog, gboolean enabled)
{
- MateConfClient *client;
-
- client = mateconf_client_get_default ();
- mateconf_client_set_bool (client, KEY_AT_SCREEN_READER_ENABLED, enabled, NULL);
- g_object_unref (client);
+ g_settings_set_boolean (dialog->priv->settings_at, KEY_AT_SCREEN_READER_ENABLED, enabled);
}
static void
-config_set_at_screen_keyboard (gboolean enabled)
+config_set_at_screen_keyboard (MsdA11yPreferencesDialog *dialog, gboolean enabled)
{
- MateConfClient *client;
-
- client = mateconf_client_get_default ();
- mateconf_client_set_bool (client, KEY_AT_SCREEN_KEYBOARD_ENABLED, enabled, NULL);
- g_object_unref (client);
+ g_settings_set_boolean (dialog->priv->settings_at, KEY_AT_SCREEN_KEYBOARD_ENABLED, enabled);
}
static void
-config_set_at_screen_magnifier (gboolean enabled)
+config_set_at_screen_magnifier (MsdA11yPreferencesDialog *dialog, gboolean enabled)
{
- MateConfClient *client;
-
- client = mateconf_client_get_default ();
- mateconf_client_set_bool (client, KEY_AT_SCREEN_MAGNIFIER_ENABLED, enabled, NULL);
- g_object_unref (client);
+ g_settings_set_boolean (dialog->priv->settings_at, KEY_AT_SCREEN_MAGNIFIER_ENABLED, enabled);
}
static void
on_sticky_keys_checkbutton_toggled (GtkToggleButton *button,
MsdA11yPreferencesDialog *dialog)
{
- config_set_sticky_keys (gtk_toggle_button_get_active (button));
+ config_set_sticky_keys (dialog, gtk_toggle_button_get_active (button));
}
static void
on_bounce_keys_checkbutton_toggled (GtkToggleButton *button,
MsdA11yPreferencesDialog *dialog)
{
- config_set_bounce_keys (gtk_toggle_button_get_active (button));
+ config_set_bounce_keys (dialog, gtk_toggle_button_get_active (button));
}
static void
on_slow_keys_checkbutton_toggled (GtkToggleButton *button,
MsdA11yPreferencesDialog *dialog)
{
- config_set_slow_keys (gtk_toggle_button_get_active (button));
+ config_set_slow_keys (dialog, gtk_toggle_button_get_active (button));
}
static void
on_high_contrast_checkbutton_toggled (GtkToggleButton *button,
MsdA11yPreferencesDialog *dialog)
{
- config_set_high_contrast (gtk_toggle_button_get_active (button));
+ config_set_high_contrast (dialog, gtk_toggle_button_get_active (button));
}
static void
on_at_screen_reader_checkbutton_toggled (GtkToggleButton *button,
MsdA11yPreferencesDialog *dialog)
{
- config_set_at_screen_reader (gtk_toggle_button_get_active (button));
+ config_set_at_screen_reader (dialog, gtk_toggle_button_get_active (button));
}
static void
on_at_screen_keyboard_checkbutton_toggled (GtkToggleButton *button,
MsdA11yPreferencesDialog *dialog)
{
- config_set_at_screen_keyboard (gtk_toggle_button_get_active (button));
+ config_set_at_screen_keyboard (dialog, gtk_toggle_button_get_active (button));
}
static void
on_at_screen_magnifier_checkbutton_toggled (GtkToggleButton *button,
MsdA11yPreferencesDialog *dialog)
{
- config_set_at_screen_magnifier (gtk_toggle_button_get_active (button));
+ config_set_at_screen_magnifier (dialog, gtk_toggle_button_get_active (button));
}
static void
@@ -652,77 +602,34 @@ ui_set_large_print (MsdA11yPreferencesDialog *dialog,
}
static void
-key_changed_cb (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
+key_changed_cb (GSettings *settings,
+ gchar *key,
MsdA11yPreferencesDialog *dialog)
{
- const char *key;
- MateConfValue *value;
-
- key = mateconf_entry_get_key (entry);
- value = mateconf_entry_get_value (entry);
-
- if (strcmp (key, KEY_STICKY_KEYS_ENABLED) == 0) {
- if (value->type == MATECONF_VALUE_BOOL) {
- gboolean enabled;
-
- enabled = mateconf_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 == MATECONF_VALUE_BOOL) {
- gboolean enabled;
-
- enabled = mateconf_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 == MATECONF_VALUE_BOOL) {
- gboolean enabled;
-
- enabled = mateconf_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 == MATECONF_VALUE_BOOL) {
- gboolean enabled;
-
- enabled = mateconf_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 == MATECONF_VALUE_BOOL) {
- gboolean enabled;
-
- enabled = mateconf_value_get_bool (value);
- ui_set_at_screen_keyboard (dialog, enabled);
- } else {
- g_warning ("Error retrieving configuration key '%s': Invalid type",
- key);
- }
+ if (g_strcmp0 (key, KEY_STICKY_KEYS_ENABLED) == 0) {
+ gboolean enabled;
+ enabled = g_settings_get_boolean (settings, key);
+ ui_set_sticky_keys (dialog, enabled);
+ } else if (g_strcmp0 (key, KEY_BOUNCE_KEYS_ENABLED) == 0) {
+ gboolean enabled;
+ enabled = g_settings_get_boolean (settings, key);
+ ui_set_bounce_keys (dialog, enabled);
+ } else if (g_strcmp0 (key, KEY_SLOW_KEYS_ENABLED) == 0) {
+ gboolean enabled;
+ enabled = g_settings_get_boolean (settings, key);
+ ui_set_slow_keys (dialog, enabled);
+ } else if (g_strcmp0 (key, KEY_AT_SCREEN_READER_ENABLED) == 0) {
+ gboolean enabled;
+ enabled = g_settings_get_boolean (settings, key);
+ ui_set_at_screen_reader (dialog, enabled);
+ } else if (g_strcmp0 (key, KEY_AT_SCREEN_KEYBOARD_ENABLED) == 0) {
+ gboolean enabled;
+ enabled = g_settings_get_boolean (settings, key);
+ ui_set_at_screen_keyboard (dialog, enabled);
} else if (strcmp (key, KEY_AT_SCREEN_MAGNIFIER_ENABLED) == 0) {
- if (value->type == MATECONF_VALUE_BOOL) {
- gboolean enabled;
-
- enabled = mateconf_value_get_bool (value);
- ui_set_at_screen_magnifier (dialog, enabled);
- } else {
- g_warning ("Error retrieving configuration key '%s': Invalid type",
- key);
- }
+ gboolean enabled;
+ enabled = g_settings_get_boolean (settings, key);
+ ui_set_at_screen_magnifier (dialog, enabled);
} else {
g_debug ("Config key not handled: %s", key);
}
@@ -735,7 +642,6 @@ setup_dialog (MsdA11yPreferencesDialog *dialog,
GtkWidget *widget;
gboolean enabled;
gboolean is_writable;
- MateConfClient *client;
widget = GTK_WIDGET (gtk_builder_get_object (builder,
"sticky_keys_checkbutton"));
@@ -744,7 +650,7 @@ setup_dialog (MsdA11yPreferencesDialog *dialog,
"toggled",
G_CALLBACK (on_sticky_keys_checkbutton_toggled),
NULL);
- enabled = config_get_sticky_keys (&is_writable);
+ enabled = config_get_sticky_keys (dialog, &is_writable);
ui_set_sticky_keys (dialog, enabled);
if (! is_writable) {
gtk_widget_set_sensitive (widget, FALSE);
@@ -757,7 +663,7 @@ setup_dialog (MsdA11yPreferencesDialog *dialog,
"toggled",
G_CALLBACK (on_bounce_keys_checkbutton_toggled),
NULL);
- enabled = config_get_bounce_keys (&is_writable);
+ enabled = config_get_bounce_keys (dialog, &is_writable);
ui_set_bounce_keys (dialog, enabled);
if (! is_writable) {
gtk_widget_set_sensitive (widget, FALSE);
@@ -770,7 +676,7 @@ setup_dialog (MsdA11yPreferencesDialog *dialog,
"toggled",
G_CALLBACK (on_slow_keys_checkbutton_toggled),
NULL);
- enabled = config_get_slow_keys (&is_writable);
+ enabled = config_get_slow_keys (dialog, &is_writable);
ui_set_slow_keys (dialog, enabled);
if (! is_writable) {
gtk_widget_set_sensitive (widget, FALSE);
@@ -783,7 +689,7 @@ setup_dialog (MsdA11yPreferencesDialog *dialog,
"toggled",
G_CALLBACK (on_high_contrast_checkbutton_toggled),
NULL);
- enabled = config_get_high_contrast (&is_writable);
+ enabled = config_get_high_contrast (dialog, &is_writable);
ui_set_high_contrast (dialog, enabled);
if (! is_writable) {
gtk_widget_set_sensitive (widget, FALSE);
@@ -796,13 +702,13 @@ setup_dialog (MsdA11yPreferencesDialog *dialog,
"toggled",
G_CALLBACK (on_at_screen_keyboard_checkbutton_toggled),
NULL);
- enabled = config_get_at_screen_keyboard (&is_writable);
+ enabled = config_get_at_screen_keyboard (dialog, &is_writable);
ui_set_at_screen_keyboard (dialog, enabled);
if (! is_writable) {
gtk_widget_set_sensitive (widget, FALSE);
}
gtk_widget_set_no_show_all (widget, TRUE);
- if (config_have_at_mateconf_condition ("MATE " KEY_AT_SCREEN_KEYBOARD_ENABLED)) {
+ if (config_have_at_gsettings_condition ("MATE " KEY_AT_SCHEMA " " KEY_AT_SCREEN_KEYBOARD_ENABLED)) {
gtk_widget_show_all (widget);
} else {
gtk_widget_hide (widget);
@@ -815,13 +721,13 @@ setup_dialog (MsdA11yPreferencesDialog *dialog,
"toggled",
G_CALLBACK (on_at_screen_reader_checkbutton_toggled),
NULL);
- enabled = config_get_at_screen_reader (&is_writable);
+ enabled = config_get_at_screen_reader (dialog, &is_writable);
ui_set_at_screen_reader (dialog, enabled);
if (! is_writable) {
gtk_widget_set_sensitive (widget, FALSE);
}
gtk_widget_set_no_show_all (widget, TRUE);
- if (config_have_at_mateconf_condition ("MATE " KEY_AT_SCREEN_READER_ENABLED)) {
+ if (config_have_at_gsettings_condition ("MATE " KEY_AT_SCHEMA " " KEY_AT_SCREEN_READER_ENABLED)) {
gtk_widget_show_all (widget);
} else {
gtk_widget_hide (widget);
@@ -834,13 +740,13 @@ setup_dialog (MsdA11yPreferencesDialog *dialog,
"toggled",
G_CALLBACK (on_at_screen_magnifier_checkbutton_toggled),
NULL);
- enabled = config_get_at_screen_magnifier (&is_writable);
+ enabled = config_get_at_screen_magnifier (dialog, &is_writable);
ui_set_at_screen_magnifier (dialog, enabled);
if (! is_writable) {
gtk_widget_set_sensitive (widget, FALSE);
}
gtk_widget_set_no_show_all (widget, TRUE);
- if (config_have_at_mateconf_condition ("MATE " KEY_AT_SCREEN_MAGNIFIER_ENABLED)) {
+ if (config_have_at_gsettings_condition ("MATE " KEY_AT_SCHEMA " " KEY_AT_SCREEN_MAGNIFIER_ENABLED)) {
gtk_widget_show_all (widget);
} else {
gtk_widget_hide (widget);
@@ -859,31 +765,14 @@ setup_dialog (MsdA11yPreferencesDialog *dialog,
gtk_widget_set_sensitive (widget, FALSE);
}
-
- client = mateconf_client_get_default ();
- mateconf_client_add_dir (client,
- KEY_A11Y_DIR,
- MATECONF_CLIENT_PRELOAD_ONELEVEL,
- NULL);
- dialog->priv->a11y_dir_cnxn = mateconf_client_notify_add (client,
- KEY_A11Y_DIR,
- (MateConfClientNotifyFunc)key_changed_cb,
- dialog,
- NULL,
- NULL);
-
- mateconf_client_add_dir (client,
- KEY_AT_DIR,
- MATECONF_CLIENT_PRELOAD_ONELEVEL,
- NULL);
- dialog->priv->msd_a11y_dir_cnxn = mateconf_client_notify_add (client,
- KEY_AT_DIR,
- (MateConfClientNotifyFunc)key_changed_cb,
- dialog,
- NULL,
- NULL);
-
- g_object_unref (client);
+ g_signal_connect (dialog->priv->settings_a11y,
+ "changed",
+ G_CALLBACK (key_changed_cb),
+ dialog);
+ g_signal_connect (dialog->priv->settings_at,
+ "changed",
+ G_CALLBACK (key_changed_cb),
+ dialog);
}
static void
@@ -896,6 +785,11 @@ msd_a11y_preferences_dialog_init (MsdA11yPreferencesDialog *dialog)
dialog->priv = MSD_A11Y_PREFERENCES_DIALOG_GET_PRIVATE (dialog);
+ dialog->priv->settings_a11y = g_settings_new (KEY_A11Y_SCHEMA);
+ dialog->priv->settings_at = g_settings_new (KEY_AT_SCHEMA);
+ dialog->priv->settings_interface = g_settings_new (KEY_INTERFACE_SCHEMA);
+ dialog->priv->settings_marco = g_settings_new (KEY_MARCO_SCHEMA);
+
builder = gtk_builder_new ();
gtk_builder_set_translation_domain (builder, PACKAGE);
if (gtk_builder_add_objects_from_file (builder, ui_file_path, objects,
@@ -940,7 +834,6 @@ static void
msd_a11y_preferences_dialog_finalize (GObject *object)
{
MsdA11yPreferencesDialog *dialog;
- MateConfClient *client;
g_return_if_fail (object != NULL);
g_return_if_fail (MSD_IS_A11Y_PREFERENCES_DIALOG (object));
@@ -949,16 +842,10 @@ msd_a11y_preferences_dialog_finalize (GObject *object)
g_return_if_fail (dialog->priv != NULL);
- client = mateconf_client_get_default ();
-
- if (dialog->priv->a11y_dir_cnxn > 0) {
- mateconf_client_notify_remove (client, dialog->priv->a11y_dir_cnxn);
- }
- if (dialog->priv->msd_a11y_dir_cnxn > 0) {
- mateconf_client_notify_remove (client, dialog->priv->msd_a11y_dir_cnxn);
- }
-
- g_object_unref (client);
+ g_object_unref (dialog->priv->settings_a11y);
+ g_object_unref (dialog->priv->settings_at);
+ g_object_unref (dialog->priv->settings_interface);
+ g_object_unref (dialog->priv->settings_marco);
G_OBJECT_CLASS (msd_a11y_preferences_dialog_parent_class)->finalize (object);
}