summaryrefslogtreecommitdiff
path: root/plugins
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
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')
-rw-r--r--plugins/Makefile.am1
-rw-r--r--plugins/a11y-keyboard/msd-a11y-keyboard-manager.c310
-rw-r--r--plugins/a11y-keyboard/msd-a11y-preferences-dialog.c385
-rw-r--r--plugins/background/msd-background-manager.c65
-rw-r--r--plugins/font/msd-font-manager.c37
-rw-r--r--plugins/housekeeping/msd-disk-space.c123
-rw-r--r--plugins/housekeeping/msd-housekeeping-manager.c6
-rw-r--r--plugins/housekeeping/msd-ldsm-dialog.c77
-rw-r--r--plugins/housekeeping/msd-ldsm-trash-empty.c24
-rw-r--r--plugins/keybindings/Makefile.am51
-rw-r--r--plugins/keybindings/keybindings.mate-settings-plugin.in8
-rw-r--r--plugins/keybindings/msd-keybindings-manager.c758
-rw-r--r--plugins/keybindings/msd-keybindings-manager.h61
-rw-r--r--plugins/keybindings/msd-keybindings-plugin.c104
-rw-r--r--plugins/keybindings/msd-keybindings-plugin.h63
-rw-r--r--plugins/keyboard/modmap-dialog.ui16
-rw-r--r--plugins/keyboard/msd-keyboard-manager.c154
-rw-r--r--plugins/keyboard/msd-keyboard-xkb.c314
-rw-r--r--plugins/keyboard/msd-keyboard-xkb.h5
-rw-r--r--plugins/keyboard/msd-xmodmap.c142
-rw-r--r--plugins/media-keys/acme.h43
-rw-r--r--plugins/media-keys/cut-n-paste/gvc-gstreamer-acme-vol.c41
-rw-r--r--plugins/media-keys/msd-media-keys-manager.c206
-rw-r--r--plugins/mouse/msd-mouse-manager.c281
-rw-r--r--plugins/smartcard/msd-smartcard-plugin.c16
-rw-r--r--plugins/sound/msd-sound-manager.c50
-rw-r--r--plugins/typing-break/msd-typing-break-manager.c44
-rw-r--r--plugins/xrandr/msd-xrandr-manager.c66
-rw-r--r--plugins/xsettings/msd-xsettings-manager.c444
29 files changed, 1031 insertions, 2864 deletions
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index f84cdf9..f1f227c 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -8,7 +8,6 @@ enabled_plugins = \
dummy \
font \
housekeeping \
- keybindings \
keyboard \
media-keys \
mouse \
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);
}
diff --git a/plugins/background/msd-background-manager.c b/plugins/background/msd-background-manager.c
index 6e92c69..d9c9604 100644
--- a/plugins/background/msd-background-manager.c
+++ b/plugins/background/msd-background-manager.c
@@ -38,7 +38,7 @@
#include <glib/gi18n.h>
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
-#include <mateconf/mateconf-client.h>
+#include <gio/gio.h>
#define MATE_DESKTOP_USE_UNSTABLE_API
#include <libmateui/mate-bg.h>
@@ -47,16 +47,17 @@
#include "mate-settings-profile.h"
#include "msd-background-manager.h"
-#define CAJA_SHOW_DESKTOP_KEY "/apps/caja/preferences/show_desktop"
+#define CAJA_SCHEMA "org.mate.caja.preferences"
+#define CAJA_SHOW_DESKTOP_KEY "show-desktop"
#define MSD_BACKGROUND_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), MSD_TYPE_BACKGROUND_MANAGER, MsdBackgroundManagerPrivate))
//class MsdBackgroundManager
//{
struct MsdBackgroundManagerPrivate {
- MateConfClient* client;
+ GSettings* bg_settings;
+ GSettings* caja_settings;
MateBG* bg;
- guint bg_notify_id;
guint timeout_id;
DBusConnection* dbus_connection;
@@ -248,31 +249,20 @@
}
static void
- mateconf_changed_callback (MateConfClient* client,
- guint cnxn_id,
- MateConfEntry* entry,
+ settings_changed_callback (GSettings* settings,
+ gchar* key,
MsdBackgroundManager* manager)
{
- mate_bg_load_from_preferences(manager->priv->bg,
- manager->priv->client);
+ mate_bg_load_from_preferences(manager->priv->bg);
}
static void
watch_bg_preferences (MsdBackgroundManager* manager)
{
- g_assert(manager->priv->bg_notify_id == 0);
-
- mateconf_client_add_dir(manager->priv->client,
- MATE_BG_KEY_DIR,
- MATECONF_CLIENT_PRELOAD_NONE,
- NULL);
-
- manager->priv->bg_notify_id = mateconf_client_notify_add(manager->priv->client,
- MATE_BG_KEY_DIR,
- (MateConfClientNotifyFunc)mateconf_changed_callback,
- manager,
- NULL,
- NULL);
+ g_signal_connect (manager->priv->bg_settings,
+ "changed",
+ G_CALLBACK (settings_changed_callback),
+ manager);
}
static void
@@ -293,7 +283,7 @@
manager);*/
watch_bg_preferences(manager);
- mate_bg_load_from_preferences(manager->priv->bg, manager->priv->client);
+ mate_bg_load_from_preferences(manager->priv->bg);
}
static gboolean
@@ -367,9 +357,8 @@
{
gboolean caja_show_desktop;
- caja_show_desktop = mateconf_client_get_bool(manager->priv->client,
- CAJA_SHOW_DESKTOP_KEY,
- NULL);
+ caja_show_desktop = g_settings_get_boolean (manager->priv->caja_settings,
+ CAJA_SHOW_DESKTOP_KEY);
if (!caja_is_running() || !caja_show_desktop)
{
@@ -439,7 +428,8 @@
g_debug("Starting background manager");
mate_settings_profile_start(NULL);
- manager->priv->client = mateconf_client_get_default();
+ manager->priv->bg_settings = g_settings_new (MATE_BG_SCHEMA);
+ manager->priv->caja_settings = g_settings_new (CAJA_SCHEMA);
/* If this is set, caja will draw the background and is
* almost definitely in our session. however, it may not be
@@ -448,9 +438,8 @@
* don't waste time setting the background only to have
* caja overwrite it.
*/
- caja_show_desktop = mateconf_client_get_bool(manager->priv->client,
- CAJA_SHOW_DESKTOP_KEY,
- NULL);
+ caja_show_desktop = g_settings_get_boolean (manager->priv->caja_settings,
+ CAJA_SHOW_DESKTOP_KEY);
if (!caja_show_desktop)
{
@@ -484,20 +473,16 @@
manager);
}
- if (manager->priv->bg_notify_id != 0)
+ if (p->bg_settings != NULL)
{
- mateconf_client_remove_dir(manager->priv->client,
- MATE_BG_KEY_DIR,
- NULL);
- mateconf_client_notify_remove(manager->priv->client,
- manager->priv->bg_notify_id);
- manager->priv->bg_notify_id = 0;
+ g_object_unref(p->bg_settings);
+ p->bg_settings = NULL;
}
- if (p->client != NULL)
+ if (p->caja_settings != NULL)
{
- g_object_unref(p->client);
- p->client = NULL;
+ g_object_unref(p->caja_settings);
+ p->caja_settings = NULL;
}
if (p->timeout_id != 0)
diff --git a/plugins/font/msd-font-manager.c b/plugins/font/msd-font-manager.c
index bcae037..8f930af 100644
--- a/plugins/font/msd-font-manager.c
+++ b/plugins/font/msd-font-manager.c
@@ -40,8 +40,7 @@
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
-#include <mateconf/mateconf.h>
-#include <mateconf/mateconf-client.h>
+#include <gio/gio.h>
#include "mate-settings-profile.h"
#include "msd-font-manager.h"
@@ -84,7 +83,7 @@ update_property (GString *props, const gchar* key, const gchar* value)
}
static void
-load_xcursor_theme (MateConfClient *client)
+load_xcursor_theme (GSettings *settings)
{
char *cursor_theme;
int size;
@@ -94,16 +93,12 @@ load_xcursor_theme (MateConfClient *client)
mate_settings_profile_start (NULL);
- size = mateconf_client_get_int (client,
- "/desktop/mate/peripherals/mouse/cursor_size",
- NULL);
+ size = g_settings_get_int (settings, "cursor-size");
if (size <= 0) {
return;
}
- cursor_theme = mateconf_client_get_string (client,
- "/desktop/mate/peripherals/mouse/cursor_theme",
- NULL);
+ cursor_theme = g_settings_get_string (settings, "cursor-theme");
if (cursor_theme == NULL) {
return;
}
@@ -186,22 +181,20 @@ empty_check_dir (char *font_dir)
}
static char*
-setup_font_dir (MateConfClient *client)
+setup_font_dir (GSettings *settings)
{
return empty_check_dir (setup_dir ("fonts", FALSE));
}
static char*
-setup_cursor_dir (MateConfClient *client)
+setup_cursor_dir (GSettings *settings)
{
char *cursor_dir;
char *cursor_font;
DIR *dir;
struct dirent *file_dirent;
- cursor_font = mateconf_client_get_string (client,
- "/desktop/mate/peripherals/mouse/cursor_font",
- NULL);
+ cursor_font = g_settings_get_string (settings, "cursor-font");
if (cursor_font != NULL) {
if (!g_path_is_absolute (cursor_font) ||
!g_file_test (cursor_font, G_FILE_TEST_IS_REGULAR)) {
@@ -251,7 +244,7 @@ setup_cursor_dir (MateConfClient *client)
}
static void
-load_font_paths (MateConfClient *client)
+load_font_paths (GSettings *settings)
{
char *font_dir_name;
char *cursor_dir_name;
@@ -268,8 +261,8 @@ load_font_paths (MateConfClient *client)
mate_settings_profile_start (NULL);
- font_dir_name = setup_font_dir (client);
- cursor_dir_name = setup_cursor_dir (client);
+ font_dir_name = setup_font_dir (settings);
+ cursor_dir_name = setup_cursor_dir (settings);
if (font_dir_name == NULL && cursor_dir_name == NULL)
goto done;
@@ -341,17 +334,17 @@ gboolean
msd_font_manager_start (MsdFontManager *manager,
GError **error)
{
- MateConfClient *client;
+ GSettings *settings;
g_debug ("Starting font manager");
mate_settings_profile_start (NULL);
- client = mateconf_client_get_default ();
+ settings = g_settings_new ("org.mate.peripherals-mouse");
- load_xcursor_theme (client);
- load_font_paths (client);
+ load_xcursor_theme (settings);
+ load_font_paths (settings);
- g_object_unref (client);
+ g_object_unref (settings);
mate_settings_profile_end (NULL);
diff --git a/plugins/housekeeping/msd-disk-space.c b/plugins/housekeeping/msd-disk-space.c
index e36be16..dbec2c9 100644
--- a/plugins/housekeeping/msd-disk-space.c
+++ b/plugins/housekeeping/msd-disk-space.c
@@ -35,7 +35,7 @@
#include <gio/gunixmounts.h>
#include <gio/gio.h>
#include <gtk/gtk.h>
-#include <mateconf/mateconf-client.h>
+#include <gio/gio.h>
#include "msd-disk-space.h"
#include "msd-ldsm-dialog.h"
@@ -46,14 +46,14 @@
#define CHECK_EVERY_X_SECONDS 60
-#define DISK_SPACE_ANALYZER "baobab"
+#define DISK_SPACE_ANALYZER "mate-disk-usage-analyzer"
-#define MATECONF_HOUSEKEEPING_DIR "/apps/mate_settings_daemon/plugins/housekeeping"
-#define MATECONF_FREE_PC_NOTIFY_KEY "free_percent_notify"
-#define MATECONF_FREE_PC_NOTIFY_AGAIN_KEY "free_percent_notify_again"
-#define MATECONF_FREE_SIZE_NO_NOTIFY "free_size_gb_no_notify"
-#define MATECONF_MIN_NOTIFY_PERIOD "min_notify_period"
-#define MATECONF_IGNORE_PATHS "ignore_paths"
+#define SETTINGS_HOUSEKEEPING_SCHEMA "org.mate.SettingsDaemon.plugins.housekeeping"
+#define SETTINGS_FREE_PC_NOTIFY_KEY "free-percent-notify"
+#define SETTINGS_FREE_PC_NOTIFY_AGAIN_KEY "free-percent-notify-again"
+#define SETTINGS_FREE_SIZE_NO_NOTIFY "free-size-gb-no-notify"
+#define SETTINGS_MIN_NOTIFY_PERIOD "min-notify-period"
+#define SETTINGS_IGNORE_PATHS "ignore-paths"
typedef struct
{
@@ -70,8 +70,7 @@ static double free_percent_notify_again = 0.01;
static unsigned int free_size_gb_no_notify = 2;
static unsigned int min_notify_period = 10;
static GSList *ignore_paths = NULL;
-static unsigned int mateconf_notify_id;
-static MateConfClient *client = NULL;
+static GSettings *settings = NULL;
static MsdLdsmDialog *dialog = NULL;
static guint64 *time_read;
@@ -570,70 +569,58 @@ ldsm_is_hash_item_in_ignore_paths (gpointer key,
static void
msd_ldsm_get_config ()
{
- GError *error = NULL;
-
- free_percent_notify = mateconf_client_get_float (client,
- MATECONF_HOUSEKEEPING_DIR "/" MATECONF_FREE_PC_NOTIFY_KEY,
- &error);
- if (error != NULL) {
- g_warning ("Error reading configuration from MateConf: %s", error->message ? error->message : "Unknown error");
- g_clear_error (&error);
- }
+ gchar **settings_list;
+
+ free_percent_notify = g_settings_get_double (settings,
+ SETTINGS_FREE_PC_NOTIFY_KEY);
if (free_percent_notify >= 1 || free_percent_notify < 0) {
+ /* FIXME define min and max in gschema! */
g_warning ("Invalid configuration of free_percent_notify: %f\n" \
"Using sensible default", free_percent_notify);
free_percent_notify = 0.05;
}
- free_percent_notify_again = mateconf_client_get_float (client,
- MATECONF_HOUSEKEEPING_DIR "/" MATECONF_FREE_PC_NOTIFY_AGAIN_KEY,
- &error);
- if (error != NULL) {
- g_warning ("Error reading configuration from MateConf: %s", error->message ? error->message : "Unknown error");
- g_clear_error (&error);
- }
+ free_percent_notify_again = g_settings_get_double (settings,
+ SETTINGS_FREE_PC_NOTIFY_AGAIN_KEY);
if (free_percent_notify_again >= 1 || free_percent_notify_again < 0) {
+ /* FIXME define min and max in gschema! */
g_warning ("Invalid configuration of free_percent_notify_again: %f\n" \
"Using sensible default\n", free_percent_notify_again);
free_percent_notify_again = 0.01;
}
- free_size_gb_no_notify = mateconf_client_get_int (client,
- MATECONF_HOUSEKEEPING_DIR "/" MATECONF_FREE_SIZE_NO_NOTIFY,
- &error);
- if (error != NULL) {
- g_warning ("Error reading configuration from MateConf: %s", error->message ? error->message : "Unknown error");
- g_clear_error (&error);
- }
- min_notify_period = mateconf_client_get_int (client,
- MATECONF_HOUSEKEEPING_DIR "/" MATECONF_MIN_NOTIFY_PERIOD,
- &error);
- if (error != NULL) {
- g_warning ("Error reading configuration from MateConf: %s", error->message ? error->message : "Unknown error");
- g_clear_error (&error);
- }
-
- if (ignore_paths != NULL) {
+ free_size_gb_no_notify = g_settings_get_int (settings,
+ SETTINGS_FREE_SIZE_NO_NOTIFY);
+ min_notify_period = g_settings_get_int (settings,
+ SETTINGS_MIN_NOTIFY_PERIOD);
+
+ if (ignore_paths != NULL) {
g_slist_foreach (ignore_paths, (GFunc) g_free, NULL);
g_slist_free (ignore_paths);
- }
- ignore_paths = mateconf_client_get_list (client,
- MATECONF_HOUSEKEEPING_DIR "/" MATECONF_IGNORE_PATHS,
- MATECONF_VALUE_STRING, &error);
- if (error != NULL) {
- g_warning ("Error reading configuration from MateConf: %s", error->message ? error->message : "Unknown error");
- g_clear_error (&error);
- } else {
+ ignore_paths = NULL;
+ }
+
+ settings_list = g_settings_get_strv (settings, SETTINGS_IGNORE_PATHS);
+ if (settings_list != NULL) {
+ gint i;
+
+ for (i = 0; i < G_N_ELEMENTS (settings_list); i++) {
+ if (settings_list[i] != NULL)
+ ignore_paths = g_slist_append (ignore_paths, g_strdup (settings_list[i]));
+ }
+
/* Make sure we dont leave stale entries in ldsm_notified_hash */
- g_hash_table_foreach_remove (ldsm_notified_hash,
- ldsm_is_hash_item_in_ignore_paths, NULL);
- }
+ g_hash_table_foreach_remove (ldsm_notified_hash,
+ ldsm_is_hash_item_in_ignore_paths, NULL);
+
+ g_strfreev (settings_list);
+ }
+
}
static void
-msd_ldsm_update_config (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
+msd_ldsm_update_config (GSettings *settings,
+ gchar *key,
gpointer user_data)
{
msd_ldsm_get_config ();
@@ -642,8 +629,6 @@ msd_ldsm_update_config (MateConfClient *client,
void
msd_ldsm_setup (gboolean check_now)
{
- GError *error = NULL;
-
if (ldsm_notified_hash || ldsm_timeout_id || ldsm_monitor) {
g_warning ("Low disk space monitor already initialized.");
return;
@@ -653,20 +638,9 @@ msd_ldsm_setup (gboolean check_now)
g_free,
ldsm_free_mount_info);
- client = mateconf_client_get_default ();
- if (client != NULL) {
- msd_ldsm_get_config ();
- mateconf_notify_id = mateconf_client_notify_add (client,
- MATECONF_HOUSEKEEPING_DIR,
- (MateConfClientNotifyFunc) msd_ldsm_update_config,
- NULL, NULL, &error);
- if (error != NULL) {
- g_warning ("Cannot register callback for MateConf notification");
- g_clear_error (&error);
- }
- } else {
- g_warning ("Failed to get default client");
- }
+ settings = g_settings_new (SETTINGS_HOUSEKEEPING_SCHEMA);
+ msd_ldsm_get_config ();
+ g_signal_connect (settings, "changed", G_CALLBACK (msd_ldsm_update_config), NULL);
ldsm_monitor = g_unix_mount_monitor_new ();
g_unix_mount_monitor_set_rate_limit (ldsm_monitor, 1000);
@@ -696,9 +670,8 @@ msd_ldsm_clean (void)
g_object_unref (ldsm_monitor);
ldsm_monitor = NULL;
- if (client) {
- mateconf_client_notify_remove (client, mateconf_notify_id);
- g_object_unref (client);
+ if (settings) {
+ g_object_unref (settings);
}
if (dialog) {
diff --git a/plugins/housekeeping/msd-housekeeping-manager.c b/plugins/housekeeping/msd-housekeeping-manager.c
index 2fbdf14..28de75f 100644
--- a/plugins/housekeeping/msd-housekeeping-manager.c
+++ b/plugins/housekeeping/msd-housekeeping-manager.c
@@ -275,7 +275,7 @@ msd_housekeeping_manager_start (MsdHousekeepingManager *manager,
manager->priv->settings = g_settings_new (GSETTINGS_THUMB_SCHEMA);
- g_signal_connect (gsettings, "changed", G_CALLBACK (bindings_callback), manager);
+ g_signal_connect (manager->priv->settings, "changed", G_CALLBACK (bindings_callback), manager);
/* Clean once, a few minutes after start-up */
do_cleanup_soon (manager);
@@ -297,9 +297,7 @@ msd_housekeeping_manager_stop (MsdHousekeepingManager *manager)
g_debug ("Stopping housekeeping manager");
- g_signal_handlers_disconnect_by_func (p->settings,
- bindings_callback,
- manager);
+ g_object_unref (p->settings);
if (p->short_term_cb) {
g_source_remove (p->short_term_cb);
diff --git a/plugins/housekeeping/msd-ldsm-dialog.c b/plugins/housekeeping/msd-ldsm-dialog.c
index 80ca857..7615206 100644
--- a/plugins/housekeeping/msd-ldsm-dialog.c
+++ b/plugins/housekeeping/msd-ldsm-dialog.c
@@ -18,11 +18,12 @@
*/
#include <glib/gi18n.h>
-#include <mateconf/mateconf-client.h>
+#include <gio/gio.h>
#include "msd-ldsm-dialog.h"
-#define MATECONF_CLIENT_IGNORE_PATHS "/apps/mate_settings_daemon/plugins/housekeeping/ignore_paths"
+#define SETTINGS_SCHEMA "org.mate.SettingsDaemon.plugins.housekeeping"
+#define SETTINGS_IGNORE_PATHS "ignore-paths"
enum
{
@@ -149,45 +150,47 @@ ignore_check_button_toggled_cb (GtkToggleButton *button,
gpointer user_data)
{
MsdLdsmDialog *dialog = (MsdLdsmDialog *)user_data;
- MateConfClient *client;
+ GSettings *settings;
GSList *ignore_paths;
GError *error = NULL;
gboolean ignore, ret, updated;
+ gchar **settings_list;
- client = mateconf_client_get_default ();
- if (client != NULL) {
- ignore_paths = mateconf_client_get_list (client,
- MATECONF_CLIENT_IGNORE_PATHS,
- MATECONF_VALUE_STRING, &error);
- if (error != NULL) {
- g_warning ("Cannot change ignore preference - failed to read existing configuration: %s",
- error->message ? error->message : "Unkown error");
- g_clear_error (&error);
- return;
- } else {
- ignore = gtk_toggle_button_get_active (button);
- updated = update_ignore_paths (&ignore_paths, dialog->priv->mount_path, ignore);
- }
-
- if (!updated)
- return;
-
- ret = mateconf_client_set_list (client,
- MATECONF_CLIENT_IGNORE_PATHS,
- MATECONF_VALUE_STRING,
- ignore_paths, &error);
- if (!ret || error != NULL) {
- g_warning ("Cannot change ignore preference - failed to commit changes: %s",
- error->message ? error->message : "Unkown error");
- g_clear_error (&error);
+ settings = g_settings_new (SETTINGS_SCHEMA);
+
+ settings_list = g_settings_get_strv (settings, SETTINGS_IGNORE_PATHS);
+ if (settings_list != NULL) {
+ gint i;
+
+ for (i = 0; i < G_N_ELEMENTS (settings_list); i++) {
+ if (settings_list[i] != NULL)
+ ignore_paths = g_slist_append (ignore_paths, g_strdup (settings_list[i]));
}
-
- g_slist_foreach (ignore_paths, (GFunc) g_free, NULL);
- g_slist_free (ignore_paths);
- g_object_unref (client);
- } else {
- g_warning ("Cannot change ignore preference - failed to get MateConfClient");
- }
+ g_strfreev (settings_list);
+ }
+
+
+ ignore = gtk_toggle_button_get_active (button);
+ updated = update_ignore_paths (&ignore_paths, dialog->priv->mount_path, ignore);
+
+ if (updated) {
+ GSList *l;
+ GPtrArray *array = g_ptr_array_new ();
+
+ for (l = ignore_paths; l != NULL; l = l->next)
+ g_ptr_array_add (array, l->data);
+ g_ptr_array_add (array, NULL);
+
+ if (!g_settings_set_strv (settings, "ignore-paths", (const gchar **) array->pdata)) {
+ g_warning ("Cannot change ignore preference - failed to commit changes");
+ }
+
+ g_ptr_array_free (array, FALSE);
+ }
+
+ g_slist_foreach (ignore_paths, (GFunc) g_free, NULL);
+ g_slist_free (ignore_paths);
+ g_object_unref (settings);
}
static void
@@ -231,7 +234,7 @@ msd_ldsm_dialog_init (MsdLdsmDialog *dialog)
/* Create the check button to ignore future warnings */
dialog->priv->ignore_check_button = gtk_check_button_new ();
/* The button should be inactive if the dialog was just called.
- * I suppose it could be possible for the user to manually edit the MateConf key between
+ * I suppose it could be possible for the user to manually edit the GSettings key between
* the mount being checked and the dialog appearing, but I don't think it matters
* too much */
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->ignore_check_button), FALSE);
diff --git a/plugins/housekeeping/msd-ldsm-trash-empty.c b/plugins/housekeeping/msd-ldsm-trash-empty.c
index 05f82cd..e218d6d 100644
--- a/plugins/housekeeping/msd-ldsm-trash-empty.c
+++ b/plugins/housekeeping/msd-ldsm-trash-empty.c
@@ -18,13 +18,14 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <mateconf/mateconf-client.h>
+#include <gio/gio.h>
#include <glib/gi18n.h>
#include <gio/gio.h>
#include "msd-ldsm-trash-empty.h"
-#define CAJA_CONFIRM_TRASH_KEY "/apps/caja/preferences/confirm_trash"
+#define CAJA_PREFS_SCHEMA "org.mate.caja.preferences"
+#define CAJA_CONFIRM_TRASH_KEY "confirm-trash"
/* Some of this code has been borrowed from the trash-applet, courtesy of Ryan Lortie */
@@ -325,21 +326,12 @@ trash_empty_confirmation_response (GtkDialog *dialog,
static gboolean
trash_empty_require_confirmation ()
{
- MateConfClient *client;
+ GSettings *settings;
gboolean require_confirmation = TRUE;
- GError *error = NULL;
-
- client = mateconf_client_get_default ();
- if (client) {
- require_confirmation = mateconf_client_get_bool (client, CAJA_CONFIRM_TRASH_KEY, &error);
- if (error) {
- g_warning ("Failed to read confirm_trash key from MateConf: %s", error->message ? error->message : "Unknown error");
- /* It's safest to assume that confirmation is required here */
- require_confirmation = TRUE;
- g_error_free (error);
- }
- g_object_unref (client);
- }
+
+ settings = g_settings_new (CAJA_PREFS_SCHEMA);
+ require_confirmation = g_settings_get_boolean (settings, CAJA_CONFIRM_TRASH_KEY);
+ g_object_unref (settings);
return require_confirmation;
}
diff --git a/plugins/keybindings/Makefile.am b/plugins/keybindings/Makefile.am
deleted file mode 100644
index d8e2b5f..0000000
--- a/plugins/keybindings/Makefile.am
+++ /dev/null
@@ -1,51 +0,0 @@
-NULL =
-
-plugin_LTLIBRARIES = \
- libkeybindings.la \
- $(NULL)
-
-libkeybindings_la_SOURCES = \
- msd-keybindings-plugin.h \
- msd-keybindings-plugin.c \
- msd-keybindings-manager.h \
- msd-keybindings-manager.c \
- $(NULL)
-
-libkeybindings_la_CPPFLAGS = \
- -I$(top_srcdir)/mate-settings-daemon \
- -I$(top_srcdir)/plugins/common \
- -DMATE_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \
- $(AM_CPPFLAGS)
-
-libkeybindings_la_CFLAGS = \
- $(SETTINGS_PLUGIN_CFLAGS) \
- $(AM_CFLAGS)
-
-libkeybindings_la_LDFLAGS = \
- $(MSD_PLUGIN_LDFLAGS) \
- $(NULL)
-
-libkeybindings_la_LIBADD = \
- $(top_builddir)/plugins/common/libcommon.la \
- $(SETTINGS_PLUGIN_LIBS) \
- $(NULL)
-
-plugin_in_files = \
- keybindings.mate-settings-plugin.in \
- $(NULL)
-
-plugin_DATA = $(plugin_in_files:.mate-settings-plugin.in=.mate-settings-plugin)
-
-EXTRA_DIST = \
- $(plugin_in_files) \
- $(NULL)
-
-CLEANFILES = \
- $(plugin_DATA) \
- $(NULL)
-
-DISTCLEANFILES = \
- $(plugin_DATA) \
- $(NULL)
-
-@MSD_INTLTOOL_PLUGIN_RULE@
diff --git a/plugins/keybindings/keybindings.mate-settings-plugin.in b/plugins/keybindings/keybindings.mate-settings-plugin.in
deleted file mode 100644
index f9c7208..0000000
--- a/plugins/keybindings/keybindings.mate-settings-plugin.in
+++ /dev/null
@@ -1,8 +0,0 @@
-[MATE Settings Plugin]
-Module=keybindings
-IAge=0
-_Name=Keybindings
-_Description=Keybindings plugin
-Authors=AUTHOR
-Copyright=Copyright © 2007 AUTHOR
-Website=
diff --git a/plugins/keybindings/msd-keybindings-manager.c b/plugins/keybindings/msd-keybindings-manager.c
deleted file mode 100644
index c1f876c..0000000
--- a/plugins/keybindings/msd-keybindings-manager.c
+++ /dev/null
@@ -1,758 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 William Jon McCann <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- */
-
-#include "config.h"
-
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-
-#include <locale.h>
-
-#include <glib.h>
-#include <glib/gi18n.h>
-#include <gdk/gdk.h>
-#include <gdk/gdkx.h>
-#include <gtk/gtk.h>
-#include <X11/keysym.h>
-#include <mateconf/mateconf-client.h>
-
-#include "mate-settings-profile.h"
-#include "msd-keybindings-manager.h"
-
-#include "msd-keygrab.h"
-#include "eggaccelerators.h"
-
-#define MATECONF_BINDING_DIR "/desktop/mate/keybindings"
-#define ALLOWED_KEYS_KEY MATECONF_BINDING_DIR "/allowed_keys"
-
-#define MSD_KEYBINDINGS_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), MSD_TYPE_KEYBINDINGS_MANAGER, MsdKeybindingsManagerPrivate))
-
-typedef struct {
- char *binding_str;
- char *action;
- char *mateconf_key;
- Key key;
- Key previous_key;
-} Binding;
-
-struct MsdKeybindingsManagerPrivate
-{
- GSList *binding_list;
- GSList *allowed_keys;
- GSList *screens;
- guint notify;
-};
-
-static void msd_keybindings_manager_class_init (MsdKeybindingsManagerClass *klass);
-static void msd_keybindings_manager_init (MsdKeybindingsManager *keybindings_manager);
-static void msd_keybindings_manager_finalize (GObject *object);
-
-G_DEFINE_TYPE (MsdKeybindingsManager, msd_keybindings_manager, G_TYPE_OBJECT)
-
-static gpointer manager_object = NULL;
-
-static GSList *
-get_screens_list (void)
-{
- GdkDisplay *display = gdk_display_get_default();
- int n_screens;
- GSList *list = NULL;
- int i;
-
- n_screens = gdk_display_get_n_screens (display);
-
- if (n_screens == 1) {
- list = g_slist_append (list, gdk_screen_get_default ());
- } else {
- for (i = 0; i < n_screens; i++) {
- GdkScreen *screen;
-
- screen = gdk_display_get_screen (display, i);
- if (screen != NULL) {
- list = g_slist_prepend (list, screen);
- }
- }
- list = g_slist_reverse (list);
- }
-
- return list;
-}
-
-static char *
-entry_get_string (MateConfEntry *entry)
-{
- MateConfValue *value = mateconf_entry_get_value (entry);
-
- if (value == NULL || value->type != MATECONF_VALUE_STRING) {
- return NULL;
- }
-
- return g_strdup (mateconf_value_get_string (value));
-}
-
-static gboolean
-parse_binding (Binding *binding)
-{
- gboolean success;
-
- g_return_val_if_fail (binding != NULL, FALSE);
-
- binding->key.keysym = 0;
- binding->key.state = 0;
- g_free (binding->key.keycodes);
- binding->key.keycodes = NULL;
-
- if (binding->binding_str == NULL ||
- binding->binding_str[0] == '\0' ||
- strcmp (binding->binding_str, "Disabled") == 0) {
- return FALSE;
- }
-
- success = egg_accelerator_parse_virtual (binding->binding_str,
- &binding->key.keysym,
- &binding->key.keycodes,
- &binding->key.state);
-
- if (!success)
- g_warning (_("Key binding (%s) is invalid"), binding->mateconf_key);
-
- return success;
-}
-
-static gint
-compare_bindings (gconstpointer a,
- gconstpointer b)
-{
- Binding *key_a = (Binding *) a;
- char *key_b = (char *) b;
-
- return strcmp (key_b, key_a->mateconf_key);
-}
-
-static gboolean
-bindings_get_entry (MsdKeybindingsManager *manager,
- MateConfClient *client,
- const char *subdir)
-{
- Binding *new_binding;
- GSList *tmp_elem;
- GSList *list;
- GSList *li;
- char *mateconf_key;
- char *action = NULL;
- char *key = NULL;
-
- g_return_val_if_fail (subdir != NULL, FALSE);
-
- mateconf_key = g_path_get_basename (subdir);
-
- if (!mateconf_key) {
- return FALSE;
- }
-
- /* Get entries for this binding */
- list = mateconf_client_all_entries (client, subdir, NULL);
-
- for (li = list; li != NULL; li = li->next) {
- MateConfEntry *entry = li->data;
- char *key_name = g_path_get_basename (mateconf_entry_get_key (entry));
-
- if (key_name == NULL) {
- /* ignore entry */
- } else if (strcmp (key_name, "action") == 0) {
- action = entry_get_string (entry);
- } else if (strcmp (key_name, "binding") == 0) {
- key = entry_get_string (entry);
- }
-
- g_free (key_name);
- mateconf_entry_free (entry);
- }
-
- g_slist_free (list);
-
- if (!action || !key) {
- g_warning (_("Key binding (%s) is incomplete"), mateconf_key);
- g_free (mateconf_key);
- g_free (action);
- g_free (key);
- return FALSE;
- }
-
- tmp_elem = g_slist_find_custom (manager->priv->binding_list,
- mateconf_key,
- compare_bindings);
-
- if (!tmp_elem) {
- new_binding = g_new0 (Binding, 1);
- } else {
- new_binding = (Binding *) tmp_elem->data;
- g_free (new_binding->binding_str);
- g_free (new_binding->action);
- g_free (new_binding->mateconf_key);
-
- new_binding->previous_key.keysym = new_binding->key.keysym;
- new_binding->previous_key.state = new_binding->key.state;
- new_binding->previous_key.keycodes = new_binding->key.keycodes;
- new_binding->key.keycodes = NULL;
- }
-
- new_binding->binding_str = key;
- new_binding->action = action;
- new_binding->mateconf_key = mateconf_key;
-
- if (parse_binding (new_binding)) {
- if (!tmp_elem)
- manager->priv->binding_list = g_slist_prepend (manager->priv->binding_list, new_binding);
- } else {
- g_free (new_binding->binding_str);
- g_free (new_binding->action);
- g_free (new_binding->mateconf_key);
- g_free (new_binding->previous_key.keycodes);
- g_free (new_binding);
-
- if (tmp_elem)
- manager->priv->binding_list = g_slist_delete_link (manager->priv->binding_list, tmp_elem);
- return FALSE;
- }
-
- return TRUE;
-}
-
-static gboolean
-same_keycode (const Key *key, const Key *other)
-{
- if (key->keycodes != NULL && other->keycodes != NULL) {
- guint *c;
-
- for (c = key->keycodes; *c; ++c) {
- if (key_uses_keycode (other, *c))
- return TRUE;
- }
- }
- return FALSE;
-}
-
-static gboolean
-same_key (const Key *key, const Key *other)
-{
- if (key->state == other->state) {
- if (key->keycodes != NULL && other->keycodes != NULL) {
- guint *c1, *c2;
-
- for (c1 = key->keycodes, c2 = other->keycodes;
- *c1 || *c2; ++c1, ++c2) {
- if (*c1 != *c2)
- return FALSE;
- }
- } else if (key->keycodes != NULL || other->keycodes != NULL)
- return FALSE;
-
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-static gboolean
-key_already_used (MsdKeybindingsManager *manager,
- Binding *binding)
-{
- GSList *li;
-
- for (li = manager->priv->binding_list; li != NULL; li = li->next) {
- Binding *tmp_binding = (Binding*) li->data;
-
- if (tmp_binding != binding &&
- same_keycode (&tmp_binding->key, &binding->key) &&
- tmp_binding->key.state == binding->key.state) {
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-static void
-binding_unregister_keys (MsdKeybindingsManager *manager)
-{
- GSList *li;
- gboolean need_flush = FALSE;
-
- gdk_error_trap_push ();
-
- for (li = manager->priv->binding_list; li != NULL; li = li->next) {
- Binding *binding = (Binding *) li->data;
-
- if (binding->key.keycodes) {
- need_flush = TRUE;
- grab_key_unsafe (&binding->key, FALSE, manager->priv->screens);
- }
- }
-
- if (need_flush)
- gdk_flush ();
- gdk_error_trap_pop ();
-}
-
-static void
-binding_register_keys (MsdKeybindingsManager *manager)
-{
- GSList *li;
- gboolean need_flush = FALSE;
-
- gdk_error_trap_push ();
-
- /* Now check for changes and grab new key if not already used */
- for (li = manager->priv->binding_list; li != NULL; li = li->next) {
- Binding *binding = (Binding *) li->data;
-
- if (manager->priv->allowed_keys != NULL &&
- !g_slist_find_custom (manager->priv->allowed_keys,
- binding->mateconf_key,
- (GCompareFunc) g_strcmp0)) {
- continue;
- }
-
- if (!same_key (&binding->previous_key, &binding->key)) {
- /* Ungrab key if it changed and not clashing with previously set binding */
- if (!key_already_used (manager, binding)) {
- gint i;
-
- need_flush = TRUE;
- if (binding->previous_key.keycodes) {
- grab_key_unsafe (&binding->previous_key, FALSE, manager->priv->screens);
- }
- grab_key_unsafe (&binding->key, TRUE, manager->priv->screens);
-
- binding->previous_key.keysym = binding->key.keysym;
- binding->previous_key.state = binding->key.state;
- g_free (binding->previous_key.keycodes);
- for (i = 0; binding->key.keycodes[i]; ++i);
- binding->previous_key.keycodes = g_new0 (guint, i);
- for (i = 0; binding->key.keycodes[i]; ++i)
- binding->previous_key.keycodes[i] = binding->key.keycodes[i];
- } else
- g_warning ("Key binding (%s) is already in use", binding->binding_str);
- }
- }
-
- if (need_flush)
- gdk_flush ();
- if (gdk_error_trap_pop ())
- g_warning ("Grab failed for some keys, another application may already have access the them.");
-}
-
-extern char **environ;
-
-static char *
-screen_exec_display_string (GdkScreen *screen)
-{
- GString *str;
- const char *old_display;
- char *p;
-
- g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
-
- old_display = gdk_display_get_name (gdk_screen_get_display (screen));
-
- str = g_string_new ("DISPLAY=");
- g_string_append (str, old_display);
-
- p = strrchr (str->str, '.');
- if (p && p > strchr (str->str, ':')) {
- g_string_truncate (str, p - str->str);
- }
-
- g_string_append_printf (str, ".%d", gdk_screen_get_number (screen));
-
- return g_string_free (str, FALSE);
-}
-
-/**
- * get_exec_environment:
- *
- * Description: Modifies the current program environment to
- * ensure that $DISPLAY is set such that a launched application
- * inheriting this environment would appear on screen.
- *
- * Returns: a newly-allocated %NULL-terminated array of strings or
- * %NULL on error. Use g_strfreev() to free it.
- *
- * mainly ripped from egg_screen_exec_display_string in
- * mate-panel/egg-screen-exec.c
- **/
-static char **
-get_exec_environment (XEvent *xevent)
-{
- char **retval = NULL;
- int i;
- int display_index = -1;
- GdkScreen *screen = NULL;
- GdkWindow *window = gdk_xid_table_lookup (xevent->xkey.root);
-
- if (window) {
- screen = gdk_drawable_get_screen (GDK_DRAWABLE (window));
- }
-
- g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
-
- for (i = 0; environ [i]; i++) {
- if (!strncmp (environ [i], "DISPLAY", 7)) {
- display_index = i;
- }
- }
-
- if (display_index == -1) {
- display_index = i++;
- }
-
- retval = g_new (char *, i + 1);
-
- for (i = 0; environ [i]; i++) {
- if (i == display_index) {
- retval [i] = screen_exec_display_string (screen);
- } else {
- retval [i] = g_strdup (environ [i]);
- }
- }
-
- retval [i] = NULL;
-
- return retval;
-}
-
-static GdkFilterReturn
-keybindings_filter (GdkXEvent *gdk_xevent,
- GdkEvent *event,
- MsdKeybindingsManager *manager)
-{
- XEvent *xevent = (XEvent *) gdk_xevent;
- GSList *li;
-
- if (xevent->type != KeyPress) {
- return GDK_FILTER_CONTINUE;
- }
-
- for (li = manager->priv->binding_list; li != NULL; li = li->next) {
- Binding *binding = (Binding *) li->data;
-
- if (match_key (&binding->key, xevent)) {
- GError *error = NULL;
- gboolean retval;
- gchar **argv = NULL;
- gchar **envp = NULL;
-
- g_return_val_if_fail (binding->action != NULL, GDK_FILTER_CONTINUE);
-
- if (!g_shell_parse_argv (binding->action,
- NULL, &argv,
- &error)) {
- return GDK_FILTER_CONTINUE;
- }
-
- envp = get_exec_environment (xevent);
-
- retval = g_spawn_async (NULL,
- argv,
- envp,
- G_SPAWN_SEARCH_PATH,
- NULL,
- NULL,
- NULL,
- &error);
- g_strfreev (argv);
- g_strfreev (envp);
-
- if (!retval) {
- GtkWidget *dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_WARNING,
- GTK_BUTTONS_CLOSE,
- _("Error while trying to run (%s)\n"\
- "which is linked to the key (%s)"),
- binding->action,
- binding->binding_str);
- g_signal_connect (dialog,
- "response",
- G_CALLBACK (gtk_widget_destroy),
- NULL);
- gtk_widget_show (dialog);
- }
- return GDK_FILTER_REMOVE;
- }
- }
- return GDK_FILTER_CONTINUE;
-}
-
-static void
-bindings_callback (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
- MsdKeybindingsManager *manager)
-{
- char** key_elems;
- char* binding_entry;
-
- if (strcmp (mateconf_entry_get_key (entry), ALLOWED_KEYS_KEY) == 0) {
- g_slist_foreach (manager->priv->allowed_keys, (GFunc)g_free, NULL);
- g_slist_free (manager->priv->allowed_keys);
- manager->priv->allowed_keys = mateconf_client_get_list (client,
- ALLOWED_KEYS_KEY,
- MATECONF_VALUE_STRING,
- NULL);
- }
- else {
- /* ensure we get binding dir not a sub component */
- key_elems = g_strsplit (mateconf_entry_get_key (entry), "/", 15);
- binding_entry = g_strdup_printf ("/%s/%s/%s/%s",
- key_elems[1],
- key_elems[2],
- key_elems[3],
- key_elems[4]);
- g_strfreev (key_elems);
-
- bindings_get_entry (manager, client, binding_entry);
- g_free (binding_entry);
- }
-
- binding_register_keys (manager);
-}
-
-static guint
-register_config_callback (MsdKeybindingsManager *manager,
- MateConfClient *client,
- const char *path,
- MateConfClientNotifyFunc func)
-{
- mateconf_client_add_dir (client, path, MATECONF_CLIENT_PRELOAD_RECURSIVE, NULL);
- return mateconf_client_notify_add (client, path, func, manager, NULL, NULL);
-}
-
-gboolean
-msd_keybindings_manager_start (MsdKeybindingsManager *manager,
- GError **error)
-{
- MateConfClient *client;
- GSList *list;
- GSList *li;
- GdkDisplay *dpy;
- GdkScreen *screen;
- int screen_num;
- int i;
-
- g_debug ("Starting keybindings manager");
- mate_settings_profile_start (NULL);
-
- client = mateconf_client_get_default ();
-
- manager->priv->notify = register_config_callback (manager,
- client,
- MATECONF_BINDING_DIR,
- (MateConfClientNotifyFunc) bindings_callback);
-
- manager->priv->allowed_keys = mateconf_client_get_list (client,
- ALLOWED_KEYS_KEY,
- MATECONF_VALUE_STRING,
- NULL);
-
- dpy = gdk_display_get_default ();
- screen_num = gdk_display_get_n_screens (dpy);
-
- for (i = 0; i < screen_num; i++) {
- screen = gdk_display_get_screen (dpy, i);
- gdk_window_add_filter (gdk_screen_get_root_window (screen),
- (GdkFilterFunc) keybindings_filter,
- manager);
- }
-
- list = mateconf_client_all_dirs (client, MATECONF_BINDING_DIR, NULL);
- manager->priv->screens = get_screens_list ();
-
- for (li = list; li != NULL; li = li->next) {
- bindings_get_entry (manager, client, li->data);
- g_free (li->data);
- }
-
- g_slist_free (list);
- g_object_unref (client);
-
- binding_register_keys (manager);
-
- mate_settings_profile_end (NULL);
-
- return TRUE;
-}
-
-void
-msd_keybindings_manager_stop (MsdKeybindingsManager *manager)
-{
- MsdKeybindingsManagerPrivate *p = manager->priv;
- GSList *l;
-
- g_debug ("Stopping keybindings manager");
-
- if (p->notify != 0) {
- MateConfClient *client = mateconf_client_get_default ();
- mateconf_client_remove_dir (client, MATECONF_BINDING_DIR, NULL);
- mateconf_client_notify_remove (client, p->notify);
- g_object_unref (client);
- p->notify = 0;
- }
-
- for (l = p->screens; l; l = l->next) {
- GdkScreen *screen = l->data;
- gdk_window_remove_filter (gdk_screen_get_root_window (screen),
- (GdkFilterFunc) keybindings_filter,
- manager);
- }
-
- binding_unregister_keys (manager);
-
- g_slist_free (p->screens);
- p->screens = NULL;
-
- for (l = p->binding_list; l; l = l->next) {
- Binding *b = l->data;
- g_free (b->binding_str);
- g_free (b->action);
- g_free (b->mateconf_key);
- g_free (b->previous_key.keycodes);
- g_free (b->key.keycodes);
- g_free (b);
- }
- g_slist_free (p->binding_list);
- p->binding_list = NULL;
-}
-
-static void
-msd_keybindings_manager_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- MsdKeybindingsManager *self;
-
- self = MSD_KEYBINDINGS_MANAGER (object);
-
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-msd_keybindings_manager_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- MsdKeybindingsManager *self;
-
- self = MSD_KEYBINDINGS_MANAGER (object);
-
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static GObject *
-msd_keybindings_manager_constructor (GType type,
- guint n_construct_properties,
- GObjectConstructParam *construct_properties)
-{
- MsdKeybindingsManager *keybindings_manager;
- MsdKeybindingsManagerClass *klass;
-
- klass = MSD_KEYBINDINGS_MANAGER_CLASS (g_type_class_peek (MSD_TYPE_KEYBINDINGS_MANAGER));
-
- keybindings_manager = MSD_KEYBINDINGS_MANAGER (G_OBJECT_CLASS (msd_keybindings_manager_parent_class)->constructor (type,
- n_construct_properties,
- construct_properties));
-
- return G_OBJECT (keybindings_manager);
-}
-
-static void
-msd_keybindings_manager_dispose (GObject *object)
-{
- MsdKeybindingsManager *keybindings_manager;
-
- keybindings_manager = MSD_KEYBINDINGS_MANAGER (object);
-
- G_OBJECT_CLASS (msd_keybindings_manager_parent_class)->dispose (object);
-}
-
-static void
-msd_keybindings_manager_class_init (MsdKeybindingsManagerClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->get_property = msd_keybindings_manager_get_property;
- object_class->set_property = msd_keybindings_manager_set_property;
- object_class->constructor = msd_keybindings_manager_constructor;
- object_class->dispose = msd_keybindings_manager_dispose;
- object_class->finalize = msd_keybindings_manager_finalize;
-
- g_type_class_add_private (klass, sizeof (MsdKeybindingsManagerPrivate));
-}
-
-static void
-msd_keybindings_manager_init (MsdKeybindingsManager *manager)
-{
- manager->priv = MSD_KEYBINDINGS_MANAGER_GET_PRIVATE (manager);
-
-}
-
-static void
-msd_keybindings_manager_finalize (GObject *object)
-{
- MsdKeybindingsManager *keybindings_manager;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (MSD_IS_KEYBINDINGS_MANAGER (object));
-
- keybindings_manager = MSD_KEYBINDINGS_MANAGER (object);
-
- g_return_if_fail (keybindings_manager->priv != NULL);
-
- G_OBJECT_CLASS (msd_keybindings_manager_parent_class)->finalize (object);
-}
-
-MsdKeybindingsManager *
-msd_keybindings_manager_new (void)
-{
- if (manager_object != NULL) {
- g_object_ref (manager_object);
- } else {
- manager_object = g_object_new (MSD_TYPE_KEYBINDINGS_MANAGER, NULL);
- g_object_add_weak_pointer (manager_object,
- (gpointer *) &manager_object);
- }
-
- return MSD_KEYBINDINGS_MANAGER (manager_object);
-}
diff --git a/plugins/keybindings/msd-keybindings-manager.h b/plugins/keybindings/msd-keybindings-manager.h
deleted file mode 100644
index 95b1bed..0000000
--- a/plugins/keybindings/msd-keybindings-manager.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 William Jon McCann <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- */
-
-#ifndef __MSD_KEYBINDINGS_MANAGER_H
-#define __MSD_KEYBINDINGS_MANAGER_H
-
-#include <glib-object.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define MSD_TYPE_KEYBINDINGS_MANAGER (msd_keybindings_manager_get_type ())
-#define MSD_KEYBINDINGS_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), MSD_TYPE_KEYBINDINGS_MANAGER, MsdKeybindingsManager))
-#define MSD_KEYBINDINGS_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), MSD_TYPE_KEYBINDINGS_MANAGER, MsdKeybindingsManagerClass))
-#define MSD_IS_KEYBINDINGS_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), MSD_TYPE_KEYBINDINGS_MANAGER))
-#define MSD_IS_KEYBINDINGS_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), MSD_TYPE_KEYBINDINGS_MANAGER))
-#define MSD_KEYBINDINGS_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), MSD_TYPE_KEYBINDINGS_MANAGER, MsdKeybindingsManagerClass))
-
-typedef struct MsdKeybindingsManagerPrivate MsdKeybindingsManagerPrivate;
-
-typedef struct
-{
- GObject parent;
- MsdKeybindingsManagerPrivate *priv;
-} MsdKeybindingsManager;
-
-typedef struct
-{
- GObjectClass parent_class;
-} MsdKeybindingsManagerClass;
-
-GType msd_keybindings_manager_get_type (void);
-
-MsdKeybindingsManager * msd_keybindings_manager_new (void);
-gboolean msd_keybindings_manager_start (MsdKeybindingsManager *manager,
- GError **error);
-void msd_keybindings_manager_stop (MsdKeybindingsManager *manager);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __MSD_KEYBINDINGS_MANAGER_H */
diff --git a/plugins/keybindings/msd-keybindings-plugin.c b/plugins/keybindings/msd-keybindings-plugin.c
deleted file mode 100644
index 5b0cebb..0000000
--- a/plugins/keybindings/msd-keybindings-plugin.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 William Jon McCann <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- */
-
-#include "config.h"
-
-#include <glib/gi18n-lib.h>
-#include <gmodule.h>
-
-#include "mate-settings-plugin.h"
-#include "msd-keybindings-plugin.h"
-#include "msd-keybindings-manager.h"
-
-struct MsdKeybindingsPluginPrivate {
- MsdKeybindingsManager *manager;
-};
-
-#define MSD_KEYBINDINGS_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), MSD_TYPE_KEYBINDINGS_PLUGIN, MsdKeybindingsPluginPrivate))
-
-MATE_SETTINGS_PLUGIN_REGISTER (MsdKeybindingsPlugin, msd_keybindings_plugin)
-
-static void
-msd_keybindings_plugin_init (MsdKeybindingsPlugin *plugin)
-{
- plugin->priv = MSD_KEYBINDINGS_PLUGIN_GET_PRIVATE (plugin);
-
- g_debug ("MsdKeybindingsPlugin initializing");
-
- plugin->priv->manager = msd_keybindings_manager_new ();
-}
-
-static void
-msd_keybindings_plugin_finalize (GObject *object)
-{
- MsdKeybindingsPlugin *plugin;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (MSD_IS_KEYBINDINGS_PLUGIN (object));
-
- g_debug ("MsdKeybindingsPlugin finalizing");
-
- plugin = MSD_KEYBINDINGS_PLUGIN (object);
-
- g_return_if_fail (plugin->priv != NULL);
-
- if (plugin->priv->manager != NULL) {
- g_object_unref (plugin->priv->manager);
- }
-
- G_OBJECT_CLASS (msd_keybindings_plugin_parent_class)->finalize (object);
-}
-
-static void
-impl_activate (MateSettingsPlugin *plugin)
-{
- gboolean res;
- GError *error;
-
- g_debug ("Activating keybindings plugin");
-
- error = NULL;
- res = msd_keybindings_manager_start (MSD_KEYBINDINGS_PLUGIN (plugin)->priv->manager, &error);
- if (! res) {
- g_warning ("Unable to start keybindings manager: %s", error->message);
- g_error_free (error);
- }
-}
-
-static void
-impl_deactivate (MateSettingsPlugin *plugin)
-{
- g_debug ("Deactivating keybindings plugin");
- msd_keybindings_manager_stop (MSD_KEYBINDINGS_PLUGIN (plugin)->priv->manager);
-}
-
-static void
-msd_keybindings_plugin_class_init (MsdKeybindingsPluginClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- MateSettingsPluginClass *plugin_class = MATE_SETTINGS_PLUGIN_CLASS (klass);
-
- object_class->finalize = msd_keybindings_plugin_finalize;
-
- plugin_class->activate = impl_activate;
- plugin_class->deactivate = impl_deactivate;
-
- g_type_class_add_private (klass, sizeof (MsdKeybindingsPluginPrivate));
-}
diff --git a/plugins/keybindings/msd-keybindings-plugin.h b/plugins/keybindings/msd-keybindings-plugin.h
deleted file mode 100644
index f45d0f8..0000000
--- a/plugins/keybindings/msd-keybindings-plugin.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 William Jon McCann <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- */
-
-#ifndef __MSD_KEYBINDINGS_PLUGIN_H__
-#define __MSD_KEYBINDINGS_PLUGIN_H__
-
-#include <glib.h>
-#include <glib-object.h>
-#include <gmodule.h>
-
-#include "mate-settings-plugin.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define MSD_TYPE_KEYBINDINGS_PLUGIN (msd_keybindings_plugin_get_type ())
-#define MSD_KEYBINDINGS_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), MSD_TYPE_KEYBINDINGS_PLUGIN, MsdKeybindingsPlugin))
-#define MSD_KEYBINDINGS_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), MSD_TYPE_KEYBINDINGS_PLUGIN, MsdKeybindingsPluginClass))
-#define MSD_IS_KEYBINDINGS_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), MSD_TYPE_KEYBINDINGS_PLUGIN))
-#define MSD_IS_KEYBINDINGS_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), MSD_TYPE_KEYBINDINGS_PLUGIN))
-#define MSD_KEYBINDINGS_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), MSD_TYPE_KEYBINDINGS_PLUGIN, MsdKeybindingsPluginClass))
-
-typedef struct MsdKeybindingsPluginPrivate MsdKeybindingsPluginPrivate;
-
-typedef struct
-{
- MateSettingsPlugin parent;
- MsdKeybindingsPluginPrivate *priv;
-} MsdKeybindingsPlugin;
-
-typedef struct
-{
- MateSettingsPluginClass parent_class;
-} MsdKeybindingsPluginClass;
-
-GType msd_keybindings_plugin_get_type (void) G_GNUC_CONST;
-
-/* All the plugins must implement this function */
-G_MODULE_EXPORT GType register_mate_settings_plugin (GTypeModule *module);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __MSD_KEYBINDINGS_PLUGIN_H__ */
diff --git a/plugins/keyboard/modmap-dialog.ui b/plugins/keyboard/modmap-dialog.ui
index 12c34a6..73d5a57 100644
--- a/plugins/keyboard/modmap-dialog.ui
+++ b/plugins/keyboard/modmap-dialog.ui
@@ -202,22 +202,6 @@
<property name="position">1</property>
</packing>
</child>
- <child>
- <object class="GtkCheckButton" id="checkbutton1">
- <property name="label" translatable="yes">_Do not show this message again</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="active">True</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
- </packing>
- </child>
</object>
<packing>
<property name="position">2</property>
diff --git a/plugins/keyboard/msd-keyboard-manager.c b/plugins/keyboard/msd-keyboard-manager.c
index 0969459..d4a25b3 100644
--- a/plugins/keyboard/msd-keyboard-manager.c
+++ b/plugins/keyboard/msd-keyboard-manager.c
@@ -59,23 +59,26 @@
#define HOST_NAME_MAX 255
#endif
-#define MSD_KEYBOARD_KEY "/desktop/mate/peripherals/keyboard"
+#define MSD_KEYBOARD_SCHEMA "org.mate.peripherals-keyboard"
-#define KEY_REPEAT MSD_KEYBOARD_KEY "/repeat"
-#define KEY_CLICK MSD_KEYBOARD_KEY "/click"
-#define KEY_RATE MSD_KEYBOARD_KEY "/rate"
-#define KEY_DELAY MSD_KEYBOARD_KEY "/delay"
-#define KEY_CLICK_VOLUME MSD_KEYBOARD_KEY "/click_volume"
+#define KEY_REPEAT "repeat"
+#define KEY_CLICK "click"
+#define KEY_RATE "rate"
+#define KEY_DELAY "delay"
+#define KEY_CLICK_VOLUME "click-volume"
-#define KEY_BELL_VOLUME MSD_KEYBOARD_KEY "/bell_volume"
-#define KEY_BELL_PITCH MSD_KEYBOARD_KEY "/bell_pitch"
-#define KEY_BELL_DURATION MSD_KEYBOARD_KEY "/bell_duration"
-#define KEY_BELL_MODE MSD_KEYBOARD_KEY "/bell_mode"
+#define KEY_BELL_VOLUME "bell-volume"
+#define KEY_BELL_PITCH "bell-pitch"
+#define KEY_BELL_DURATION "bell-duration"
+#define KEY_BELL_MODE "bell-mode"
+
+#define KEY_NUMLOCK_STATE "numlock-state"
+#define KEY_NUMLOCK_REMEMBER "remember-numlock-state"
struct MsdKeyboardManagerPrivate {
- gboolean have_xkb;
- gint xkb_event_base;
- guint notify;
+ gboolean have_xkb;
+ gint xkb_event_base;
+ GSettings *settings;
};
static void msd_keyboard_manager_class_init (MsdKeyboardManagerClass* klass);
@@ -126,29 +129,6 @@ static gboolean xkb_set_keyboard_autorepeat_rate(int delay, int rate)
}
#endif
-static char* msd_keyboard_get_hostname_key (const char *subkey)
-{
- char hostname[HOST_NAME_MAX + 1];
-
- if (gethostname (hostname, sizeof (hostname)) == 0 &&
- strcmp (hostname, "localhost") != 0 &&
- strcmp (hostname, "localhost.localdomain") != 0) {
- char *escaped;
- char *key;
-
- escaped = mateconf_escape_key (hostname, -1);
- key = g_strconcat (MSD_KEYBOARD_KEY
- "/host-",
- escaped,
- "/0/",
- subkey,
- NULL);
- g_free (escaped);
- return key;
- } else
- return NULL;
-}
-
#ifdef HAVE_X11_EXTENSIONS_XKB_H
typedef enum {
@@ -203,52 +183,20 @@ numlock_set_xkb_state (NumLockState new_state)
XkbLockModifiers (dpy, XkbUseCoreKbd, num_mask, new_state ? num_mask : 0);
}
-static char *
-numlock_mateconf_state_key (void)
-{
- char *key = msd_keyboard_get_hostname_key ("numlock_on");
- if (!key) {
- g_message ("NumLock remembering disabled because hostname is set to \"localhost\"");
- }
- return key;
-}
-
static NumLockState
-numlock_get_mateconf_state (MateConfClient *client)
+numlock_get_settings_state (GSettings *settings)
{
int curr_state;
- GError *err = NULL;
- char *key = numlock_mateconf_state_key ();
-
- if (!key) {
- return NUMLOCK_STATE_UNKNOWN;
- }
-
- curr_state = mateconf_client_get_bool (client, key, &err);
- if (err) {
- curr_state = NUMLOCK_STATE_UNKNOWN;
- g_error_free (err);
- }
-
- g_free (key);
+ curr_state = g_settings_get_enum (settings, KEY_NUMLOCK_STATE);
return curr_state;
}
-static void numlock_set_mateconf_state(MateConfClient *client, NumLockState new_state)
+static void numlock_set_settings_state(GSettings *settings, NumLockState new_state)
{
- //printf("numlock_set_mateconf_state\n");
- char* key;
-
if (new_state != NUMLOCK_STATE_ON && new_state != NUMLOCK_STATE_OFF) {
return;
}
-
- key = numlock_mateconf_state_key ();
-
- if (key) {
- mateconf_client_set_bool (client, key, new_state, NULL);
- g_free (key);
- }
+ g_settings_set_enum (settings, KEY_NUMLOCK_STATE, new_state);
}
static GdkFilterReturn
@@ -265,9 +213,9 @@ numlock_xkb_callback (GdkXEvent *xev_,
unsigned num_mask = numlock_NumLock_modifier_mask ();
unsigned locked_mods = xkbev->state.locked_mods;
int numlock_state = !! (num_mask & locked_mods);
- MateConfClient *client = mateconf_client_get_default ();
- numlock_set_mateconf_state (client, numlock_state);
- g_object_unref (client);
+ GSettings *settings = g_settings_new (MSD_KEYBOARD_SCHEMA);
+ numlock_set_settings_state (settings, numlock_state);
+ g_object_unref (settings);
}
}
return GDK_FILTER_CONTINUE;
@@ -287,9 +235,8 @@ numlock_install_xkb_callback (MsdKeyboardManager *manager)
#endif /* HAVE_X11_EXTENSIONS_XKB_H */
static void
-apply_settings (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
+apply_settings (GSettings *settings,
+ gchar *key,
MsdKeyboardManager *manager)
{
XKeyboardControl kbdcontrol;
@@ -306,23 +253,23 @@ apply_settings (MateConfClient *client,
gboolean rnumlock;
#endif /* HAVE_X11_EXTENSIONS_XKB_H */
- repeat = mateconf_client_get_bool (client, KEY_REPEAT, NULL);
- click = mateconf_client_get_bool (client, KEY_CLICK, NULL);
- rate = mateconf_client_get_int (client, KEY_RATE, NULL);
- delay = mateconf_client_get_int (client, KEY_DELAY, NULL);
- click_volume = mateconf_client_get_int (client, KEY_CLICK_VOLUME, NULL);
+ repeat = g_settings_get_boolean (settings, KEY_REPEAT);
+ click = g_settings_get_boolean (settings, KEY_CLICK);
+ rate = g_settings_get_int (settings, KEY_RATE);
+ delay = g_settings_get_int (settings, KEY_DELAY);
+ click_volume = g_settings_get_int (settings, KEY_CLICK_VOLUME);
#if 0
- bell_volume = mateconf_client_get_int (client, KEY_BELL_VOLUME, NULL);
+ bell_volume = g_settings_get_int (settings, KEY_BELL_VOLUME);
#endif
- bell_pitch = mateconf_client_get_int (client, KEY_BELL_PITCH, NULL);
- bell_duration = mateconf_client_get_int (client, KEY_BELL_DURATION, NULL);
+ bell_pitch = g_settings_get_int (settings, KEY_BELL_PITCH);
+ bell_duration = g_settings_get_int (settings, KEY_BELL_DURATION);
- volume_string = mateconf_client_get_string (client, KEY_BELL_MODE, NULL);
+ volume_string = g_settings_get_string (settings, KEY_BELL_MODE);
bell_volume = (volume_string && !strcmp (volume_string, "on")) ? 50 : 0;
g_free (volume_string);
#ifdef HAVE_X11_EXTENSIONS_XKB_H
- rnumlock = mateconf_client_get_bool (client, MSD_KEYBOARD_KEY "/remember_numlock_state", NULL);
+ rnumlock = g_settings_get_boolean (settings, KEY_NUMLOCK_REMEMBER);
#endif /* HAVE_X11_EXTENSIONS_XKB_H */
gdk_error_trap_push ();
@@ -361,7 +308,7 @@ apply_settings (MateConfClient *client,
#ifdef HAVE_X11_EXTENSIONS_XKB_H
if (manager->priv->have_xkb && rnumlock) {
- numlock_set_xkb_state (numlock_get_mateconf_state (client));
+ numlock_set_xkb_state (numlock_get_settings_state (settings));
}
#endif /* HAVE_X11_EXTENSIONS_XKB_H */
@@ -372,30 +319,22 @@ apply_settings (MateConfClient *client,
void
msd_keyboard_manager_apply_settings (MsdKeyboardManager *manager)
{
- MateConfClient *client;
-
- client = mateconf_client_get_default ();
- apply_settings (client, 0, NULL, manager);
- g_object_unref (client);
+ apply_settings (manager->priv->settings, NULL, manager);
}
static gboolean
start_keyboard_idle_cb (MsdKeyboardManager *manager)
{
- MateConfClient *client;
-
mate_settings_profile_start (NULL);
g_debug ("Starting keyboard manager");
manager->priv->have_xkb = 0;
- client = mateconf_client_get_default ();
-
- mateconf_client_add_dir (client, MSD_KEYBOARD_KEY, MATECONF_CLIENT_PRELOAD_RECURSIVE, NULL);
+ manager->priv->settings = g_settings_new (MSD_KEYBOARD_SCHEMA);
/* Essential - xkb initialization should happen before */
msd_keyboard_xkb_set_post_activation_callback ((PostActivationCallback) msd_load_modmap_files, NULL);
- msd_keyboard_xkb_init (client, manager);
+ msd_keyboard_xkb_init (manager);
#ifdef HAVE_X11_EXTENSIONS_XKB_H
numlock_xkb_init (manager);
@@ -404,11 +343,7 @@ start_keyboard_idle_cb (MsdKeyboardManager *manager)
/* apply current settings before we install the callback */
msd_keyboard_manager_apply_settings (manager);
- manager->priv->notify = mateconf_client_notify_add (client, MSD_KEYBOARD_KEY,
- (MateConfClientNotifyFunc) apply_settings, manager,
- NULL, NULL);
-
- g_object_unref (client);
+ g_signal_connect (manager->priv->settings, "changed", G_CALLBACK (apply_settings), manager);
#ifdef HAVE_X11_EXTENSIONS_XKB_H
numlock_install_xkb_callback (manager);
@@ -439,12 +374,9 @@ msd_keyboard_manager_stop (MsdKeyboardManager *manager)
g_debug ("Stopping keyboard manager");
- if (p->notify != 0) {
- MateConfClient *client = mateconf_client_get_default ();
- mateconf_client_remove_dir (client, MSD_KEYBOARD_KEY, NULL);
- mateconf_client_notify_remove (client, p->notify);
- g_object_unref (client);
- p->notify = 0;
+ if (p->settings != NULL) {
+ g_object_unref (p->settings);
+ p->settings = NULL;
}
#if HAVE_X11_EXTENSIONS_XKB_H
diff --git a/plugins/keyboard/msd-keyboard-xkb.c b/plugins/keyboard/msd-keyboard-xkb.c
index 9042f03..546c3d8 100644
--- a/plugins/keyboard/msd-keyboard-xkb.c
+++ b/plugins/keyboard/msd-keyboard-xkb.c
@@ -29,7 +29,7 @@
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
-#include <mateconf/mateconf-client.h>
+#include <gio/gio.h>
#include <libmatekbd/matekbd-status.h>
#include <libmatekbd/matekbd-keyboard-drawing.h>
@@ -44,8 +44,16 @@
#define GTK_RESPONSE_PRINT 2
+#define MATEKBD_DESKTOP_SCHEMA "org.mate.peripherals-keyboard-xkb.general"
+#define MATEKBD_KBD_SCHEMA "org.mate.peripherals-keyboard-xkb.kbd"
+
+#define KNOWN_FILES_KEY "known-file-list"
+
static MsdKeyboardManager* manager = NULL;
+static GSettings* settings_desktop;
+static GSettings* settings_kbd;
+
static XklEngine* xkl_engine;
static XklConfigRegistry* xkl_registry = NULL;
@@ -57,20 +65,9 @@ static MatekbdKeyboardConfig initial_sys_kbd_config;
static gboolean inited_ok = FALSE;
-static guint notify_desktop = 0;
-static guint notify_keyboard = 0;
-
static PostActivationCallback pa_callback = NULL;
static void *pa_callback_user_data = NULL;
-static const char KNOWN_FILES_KEY[] = "/desktop/mate/peripherals/keyboard/general/known_file_list";
-
-static const char DISABLE_INDICATOR_KEY[] = "/desktop/mate/peripherals/keyboard/general/disable_indicator";
-
-static const char DUPLICATE_LEDS_KEY[] = "/desktop/mate/peripherals/keyboard/general/duplicate_leds";
-
-static const char* mdm_keyboard_layout = NULL;
-
static GtkStatusIcon* icon = NULL;
static GHashTable* preview_dialogs = NULL;
@@ -107,6 +104,24 @@ static void msd_keyboard_log_appender(const char file[], const char function[],
}
#endif
+static void g_strv_delete_str (gchar **a, gchar *str)
+{
+ int i;
+ int j;
+ gchar **b;
+ b = g_new0 (gchar *, g_strv_length (a) - 1);
+
+ j = 0;
+ for (i = 0; a[i] != NULL; i++) {
+ if (g_strcmp0 (a[i], str) != 0) {
+ b[j] = g_strdup (a[i]);
+ j++;
+ }
+ }
+ g_strfreev (a);
+ a = b;
+}
+
static void
activation_error (void)
{
@@ -147,7 +162,7 @@ activation_error (void)
"Try using a simpler configuration or using a later version of the XFree software.")
: "",
"xprop -root | grep XKB",
- "mateconftool-2 -R /desktop/mate/peripherals/keyboard/kbd");
+ "gsettings list-keys org.mate.peripherals-keyboard-xkb.kbd");
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_widget_destroy), NULL);
msd_delayed_show_dialog (dialog);
@@ -156,22 +171,19 @@ activation_error (void)
static void
apply_desktop_settings (void)
{
- MateConfClient *conf_client;
gboolean show_leds;
int i;
if (!inited_ok)
return;
msd_keyboard_manager_apply_settings (manager);
- matekbd_desktop_config_load_from_mateconf (&current_config);
+ matekbd_desktop_config_load_from_gsettings (&current_config);
/* again, probably it would be nice to compare things
before activating them */
matekbd_desktop_config_activate (&current_config);
- conf_client = mateconf_client_get_default ();
- show_leds =
- mateconf_client_get_bool (conf_client, DUPLICATE_LEDS_KEY, NULL);
- g_object_unref (conf_client);
+ /* FIXME add an option to GSettings to duplicate leds? */
+ show_leds = FALSE;
for (i = sizeof (indicator_icons) / sizeof (indicator_icons[0]);
--i >= 0;) {
gtk_status_icon_set_visible (indicator_icons[i],
@@ -180,6 +192,12 @@ apply_desktop_settings (void)
}
static void
+apply_desktop_settings_cb (GSettings *settings, gchar *key, gpointer user_data)
+{
+ apply_desktop_settings ();
+}
+
+static void
popup_menu_launch_capplet ()
{
GError *error = NULL;
@@ -326,15 +344,10 @@ status_icon_popup_menu_cb (GtkStatusIcon * icon, guint button, guint time)
static void
show_hide_icon ()
{
- if (g_slist_length (current_kbd_config.layouts_variants) > 1) {
+ if (g_strv_length (current_kbd_config.layouts_variants) > 1) {
if (icon == NULL) {
- MateConfClient *conf_client =
- mateconf_client_get_default ();
- gboolean disable =
- mateconf_client_get_bool (conf_client,
- DISABLE_INDICATOR_KEY,
- NULL);
- g_object_unref (conf_client);
+ /* FIXME add an option to GSettings to disable this? */
+ gboolean disable = FALSE;
if (disable)
return;
@@ -380,8 +393,8 @@ filter_xkb_config (void)
XklConfigItem *item;
gchar *lname;
gchar *vname;
- GSList *lv;
- GSList *filtered;
+ gchar **lv;
+ int i;
gboolean any_change = FALSE;
xkl_debug (100, "Filtering configuration against the registry\n");
@@ -395,25 +408,20 @@ filter_xkb_config (void)
return FALSE;
}
}
- lv = current_kbd_config.layouts_variants;
+ lv = g_strdupv(current_kbd_config.layouts_variants);
item = xkl_config_item_new ();
- while (lv) {
- xkl_debug (100, "Checking [%s]\n", lv->data);
+ for (lv = 0; lv[i] != NULL; i++) {
+ xkl_debug (100, "Checking [%s]\n", lv[i]);
if (matekbd_keyboard_config_split_items
- (lv->data, &lname, &vname)) {
+ (lv[i], &lname, &vname)) {
g_snprintf (item->name, sizeof (item->name), "%s",
lname);
if (!xkl_config_registry_find_layout
(xkl_registry, item)) {
xkl_debug (100, "Bad layout [%s]\n",
lname);
- filtered = lv;
- lv = lv->next;
- g_free (filtered->data);
- current_kbd_config.layouts_variants =
- g_slist_delete_link
- (current_kbd_config.layouts_variants,
- filtered);
+ g_strv_delete_str (current_kbd_config.layouts_variants,
+ lv[i]);
any_change = TRUE;
continue;
}
@@ -426,20 +434,14 @@ filter_xkb_config (void)
xkl_debug (100,
"Bad variant [%s(%s)]\n",
lname, vname);
- filtered = lv;
- lv = lv->next;
- g_free (filtered->data);
- current_kbd_config.layouts_variants
- =
- g_slist_delete_link
+ g_strv_delete_str
(current_kbd_config.layouts_variants,
- filtered);
+ lv[i]);
any_change = TRUE;
continue;
}
}
}
- lv = lv->next;
}
g_object_unref (item);
return any_change;
@@ -448,108 +450,14 @@ filter_xkb_config (void)
static void
apply_xkb_settings (void)
{
- MateConfClient *conf_client;
MatekbdKeyboardConfig current_sys_kbd_config;
- int group_to_activate = -1;
- char *mdm_layout;
- char *s;
if (!inited_ok)
return;
- conf_client = mateconf_client_get_default ();
-
- /* With MDM the user can already set a layout from the login
- * screen. Try to keep that setting.
- * We clear mdm_keyboard_layout early, so we don't risk
- * recursion from mateconf notification.
- */
- mdm_layout = g_strdup (mdm_keyboard_layout);
- mdm_keyboard_layout = NULL;
-
- /* mdm's configuration and $MDM_KEYBOARD_LAYOUT separates layout and
- * variant with a space, but mateconf uses tabs; so convert to be robust
- * with both */
- for (s = mdm_layout; s && *s; ++s) {
- if (*s == ' ') {
- *s = '\t';
- }
- }
+ matekbd_keyboard_config_init (&current_sys_kbd_config, xkl_engine);
- if (mdm_layout != NULL) {
- GSList *layouts;
- GSList *found_node;
- int max_groups;
-
- max_groups =
- MAX (xkl_engine_get_max_num_groups (xkl_engine), 1);
- layouts =
- mateconf_client_get_list (conf_client,
- MATEKBD_KEYBOARD_CONFIG_KEY_LAYOUTS,
- MATECONF_VALUE_STRING, NULL);
-
- /* Use system layouts as a default if we do not have
- * user configuration */
- if (layouts == NULL) {
- GSList *i;
- int len;
-
- for (i = initial_sys_kbd_config.layouts_variants;
- i; i = g_slist_next (i)) {
- s = g_strdup (i->data);
-
- /* chop off empty variants to avoid duplicates */
- len = strlen (s);
- if (s[len - 1] == '\t')
- s[len - 1] = '\0';
- layouts = g_slist_append (layouts, s);
- }
- }
-
- /* Add the layout if it doesn't already exist. XKB limits the
- * total number of layouts. If we already have the maximum
- * number of layouts configured, we replace the last one. This
- * prevents the list from becoming full if the user has a habit
- * of selecting many different keyboard layouts in MDM. */
-
- found_node =
- g_slist_find_custom (layouts, mdm_layout,
- (GCompareFunc) g_strcmp0);
-
- if (!found_node) {
- /* Insert at the last valid place, or at the end of
- * list, whichever comes first */
- layouts =
- g_slist_insert (layouts, g_strdup (mdm_layout),
- max_groups - 1);
- if (g_slist_length (layouts) > max_groups) {
- GSList *last;
- GSList *free_layouts;
-
- last =
- g_slist_nth (layouts, max_groups - 1);
- free_layouts = last->next;
- last->next = NULL;
-
- g_slist_foreach (free_layouts,
- (GFunc) g_free, NULL);
- g_slist_free (free_layouts);
- }
-
- mateconf_client_set_list (conf_client,
- MATEKBD_KEYBOARD_CONFIG_KEY_LAYOUTS,
- MATECONF_VALUE_STRING, layouts,
- NULL);
- }
-
- g_slist_foreach (layouts, (GFunc) g_free, NULL);
- g_slist_free (layouts);
- }
-
- matekbd_keyboard_config_init (&current_sys_kbd_config,
- conf_client, xkl_engine);
-
- matekbd_keyboard_config_load_from_mateconf (&current_kbd_config,
+ matekbd_keyboard_config_load_from_gsettings (&current_kbd_config,
&initial_sys_kbd_config);
matekbd_keyboard_config_load_from_x_current (&current_sys_kbd_config,
@@ -572,47 +480,25 @@ apply_xkb_settings (void)
xkl_debug (100,
"Actual KBD configuration was not changed: redundant notification\n");
- if (mdm_layout != NULL) {
- /* If there are multiple layouts,
- * try to find the one closest to the mdm layout
- */
- GSList *l;
- int i;
- size_t len = strlen (mdm_layout);
- for (i = 0, l = current_kbd_config.layouts_variants; l;
- i++, l = l->next) {
- char *lv = l->data;
- if (strncmp (lv, mdm_layout, len) == 0
- && (lv[len] == '\0' || lv[len] == '\t')) {
- group_to_activate = i;
- break;
- }
- }
- }
-
- g_free (mdm_layout);
-
- if (group_to_activate != -1)
- xkl_engine_lock_group (current_config.engine,
- group_to_activate);
matekbd_keyboard_config_term (&current_sys_kbd_config);
show_hide_icon ();
}
static void
-msd_keyboard_xkb_analyze_sysconfig (void)
+apply_xkb_settings_cb (GSettings *settings, gchar *key, gpointer user_data)
{
- MateConfClient *conf_client;
+ apply_xkb_settings ();
+}
+static void
+msd_keyboard_xkb_analyze_sysconfig (void)
+{
if (!inited_ok)
return;
- conf_client = mateconf_client_get_default ();
- matekbd_keyboard_config_init (&initial_sys_kbd_config,
- conf_client, xkl_engine);
+ matekbd_keyboard_config_init (&initial_sys_kbd_config, xkl_engine);
matekbd_keyboard_config_load_from_x_initial (&initial_sys_kbd_config,
NULL);
- g_object_unref (conf_client);
}
static gboolean
@@ -625,7 +511,6 @@ msd_chk_file_list (void)
GSList *tmp = NULL;
GSList *tmp_l = NULL;
gboolean new_file_exist = FALSE;
- MateConfClient *conf_client;
home_dir = g_dir_open (g_get_home_dir (), 0, NULL);
while ((fname = g_dir_read_name (home_dir)) != NULL) {
@@ -636,12 +521,17 @@ msd_chk_file_list (void)
}
g_dir_close (home_dir);
- conf_client = mateconf_client_get_default ();
-
- last_login_file_list = mateconf_client_get_list (conf_client,
- KNOWN_FILES_KEY,
- MATECONF_VALUE_STRING,
- NULL);
+ gchar **settings_list;
+ settings_list = g_settings_get_strv (settings_desktop, KNOWN_FILES_KEY);
+ if (settings_list != NULL) {
+ gint i;
+ for (i = 0; i < G_N_ELEMENTS (settings_list); i++) {
+ if (settings_list[i] != NULL)
+ last_login_file_list =
+ g_slist_append (last_login_file_list, g_strdup (settings_list[i]));
+ }
+ g_strfreev (settings_list);
+ }
/* Compare between the two file list, currently available modmap files
and the files available in the last log in */
@@ -665,14 +555,15 @@ msd_chk_file_list (void)
}
if (new_file_exist) {
- mateconf_client_set_list (conf_client,
- KNOWN_FILES_KEY,
- MATECONF_VALUE_STRING,
- file_list, NULL);
+ GSList *l;
+ GPtrArray *array = g_ptr_array_new ();
+ for (l = file_list; l != NULL; l = l->next)
+ g_ptr_array_add (array, l->data);
+ g_ptr_array_add (array, NULL);
+ g_settings_set_strv (settings_desktop, KNOWN_FILES_KEY, (const gchar **) array->pdata);
+ g_ptr_array_free (array, FALSE);
}
- g_object_unref (conf_client);
-
g_slist_foreach (file_list, (GFunc) g_free, NULL);
g_slist_free (file_list);
@@ -708,16 +599,6 @@ msd_keyboard_xkb_evt_filter (GdkXEvent * xev, GdkEvent * event)
return GDK_FILTER_CONTINUE;
}
-static guint
-register_config_callback (MateConfClient * client,
- const char *path, MateConfClientNotifyFunc func)
-{
- mateconf_client_add_dir (client, path, MATECONF_CLIENT_PRELOAD_ONELEVEL,
- NULL);
- return mateconf_client_notify_add (client, path, func, NULL, NULL,
- NULL);
-}
-
/* When new Keyboard is plugged in - reload the settings */
static void
msd_keyboard_new_device (XklEngine * engine)
@@ -770,8 +651,7 @@ msd_keyboard_state_changed (XklEngine * engine, XklEngineStateChange type,
}
void
-msd_keyboard_xkb_init (MateConfClient * client,
- MsdKeyboardManager * kbd_manager)
+msd_keyboard_xkb_init (MsdKeyboardManager * kbd_manager)
{
int i;
Display *display = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
@@ -806,12 +686,13 @@ msd_keyboard_xkb_init (MateConfClient * client,
if (xkl_engine) {
inited_ok = TRUE;
- mdm_keyboard_layout = g_getenv ("MDM_KEYBOARD_LAYOUT");
+ settings_desktop = g_settings_new (MATEKBD_DESKTOP_SCHEMA);
+ settings_kbd = g_settings_new (MATEKBD_KBD_SCHEMA);
matekbd_desktop_config_init (&current_config,
- client, xkl_engine);
+ xkl_engine);
matekbd_keyboard_config_init (&current_kbd_config,
- client, xkl_engine);
+ xkl_engine);
xkl_engine_backup_names_prop (xkl_engine);
msd_keyboard_xkb_analyze_sysconfig ();
mate_settings_profile_start
@@ -820,17 +701,8 @@ msd_keyboard_xkb_init (MateConfClient * client,
mate_settings_profile_end
("msd_keyboard_xkb_chk_lcl_xmm");
- notify_desktop =
- register_config_callback (client,
- MATEKBD_DESKTOP_CONFIG_DIR,
- (MateConfClientNotifyFunc)
- apply_desktop_settings);
-
- notify_keyboard =
- register_config_callback (client,
- MATEKBD_KEYBOARD_CONFIG_DIR,
- (MateConfClientNotifyFunc)
- apply_xkb_settings);
+ g_signal_connect (settings_desktop, "changed", G_CALLBACK(apply_desktop_settings_cb), NULL);
+ g_signal_connect (settings_kbd, "changed", G_CALLBACK(apply_xkb_settings_cb), NULL);
gdk_window_add_filter (NULL, (GdkFilterFunc)
msd_keyboard_xkb_evt_filter, NULL);
@@ -865,7 +737,6 @@ msd_keyboard_xkb_init (MateConfClient * client,
void
msd_keyboard_xkb_shutdown (void)
{
- MateConfClient *client;
int i;
pa_callback = NULL;
@@ -890,27 +761,18 @@ msd_keyboard_xkb_shutdown (void)
gdk_window_remove_filter (NULL, (GdkFilterFunc)
msd_keyboard_xkb_evt_filter, NULL);
- client = mateconf_client_get_default ();
-
- if (notify_desktop != 0) {
- mateconf_client_remove_dir (client, MATEKBD_DESKTOP_CONFIG_DIR,
- NULL);
- mateconf_client_notify_remove (client, notify_desktop);
- notify_desktop = 0;
+ if (settings_desktop != NULL) {
+ g_object_unref (settings_desktop);
}
- if (notify_keyboard != 0) {
- mateconf_client_remove_dir (client, MATEKBD_KEYBOARD_CONFIG_DIR,
- NULL);
- mateconf_client_notify_remove (client, notify_keyboard);
- notify_keyboard = 0;
+ if (settings_kbd != NULL) {
+ g_object_unref (settings_kbd);
}
if (xkl_registry) {
g_object_unref (xkl_registry);
}
- g_object_unref (client);
g_object_unref (xkl_engine);
xkl_engine = NULL;
diff --git a/plugins/keyboard/msd-keyboard-xkb.h b/plugins/keyboard/msd-keyboard-xkb.h
index 7d2d558..816e341 100644
--- a/plugins/keyboard/msd-keyboard-xkb.h
+++ b/plugins/keyboard/msd-keyboard-xkb.h
@@ -24,13 +24,10 @@
#ifndef __MSD_KEYBOARD_XKB_H
#define __MSD_KEYBOARD_XKB_H
-#include <mateconf/mateconf.h>
-#include <mateconf/mateconf-client.h>
-
#include <libxklavier/xklavier.h>
#include "msd-keyboard-manager.h"
-void msd_keyboard_xkb_init(MateConfClient* client, MsdKeyboardManager* manager);
+void msd_keyboard_xkb_init(MsdKeyboardManager* manager);
void msd_keyboard_xkb_shutdown(void);
typedef void (*PostActivationCallback) (void* userData);
diff --git a/plugins/keyboard/msd-xmodmap.c b/plugins/keyboard/msd-xmodmap.c
index 5baf37c..7539382 100644
--- a/plugins/keyboard/msd-xmodmap.c
+++ b/plugins/keyboard/msd-xmodmap.c
@@ -26,43 +26,33 @@
#include <glib.h>
#include <gtk/gtk.h>
-#include <mateconf/mateconf-client.h>
+#include <gio/gio.h>
#include "msd-xmodmap.h"
-static const char DISABLE_XMM_WARNING_KEY[] =
- "/desktop/mate/peripherals/keyboard/disable_xmm_and_xkb_warning";
-
-static const char LOADED_FILES_KEY[] =
- "/desktop/mate/peripherals/keyboard/general/update_handlers";
-
-
-static void
-check_button_callback (GtkWidget *chk_button,
- gpointer data)
-{
- MateConfClient *client;
-
- client = mateconf_client_get_default ();
-
- mateconf_client_set_bool (client,
- DISABLE_XMM_WARNING_KEY,
- gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (chk_button)),
- NULL);
-
- g_object_unref (client);
-}
+#define KEYBOARD_SCHEMA "org.mate.peripherals-keyboard-xkb.general"
+#define LOADED_FILES_KEY "update-handlers"
void
msd_load_modmap_files (void)
{
- MateConfClient *client;
+ GSettings *settings;
GSList *tmp;
GSList *loaded_file_list;
- client = mateconf_client_get_default ();
+ settings = g_settings_new (KEYBOARD_SCHEMA);
- loaded_file_list = mateconf_client_get_list (client, LOADED_FILES_KEY, MATECONF_VALUE_STRING, NULL);
+ gchar **settings_list;
+ settings_list = g_settings_get_strv (settings, LOADED_FILES_KEY);
+ if (settings_list != NULL) {
+ gint i;
+ for (i = 0; i < G_N_ELEMENTS (settings_list); i++) {
+ if (settings_list[i] != NULL)
+ loaded_file_list =
+ g_slist_append (loaded_file_list, g_strdup (settings_list[i]));
+ }
+ g_strfreev (settings_list);
+ }
for (tmp = loaded_file_list; tmp != NULL; tmp = tmp->next) {
gchar *file;
@@ -79,7 +69,7 @@ msd_load_modmap_files (void)
}
g_slist_free (loaded_file_list);
- g_object_unref (client);
+ g_object_unref (settings);
}
static void
@@ -88,8 +78,6 @@ response_callback (GtkWidget *dialog,
void *data)
{
if (id == GTK_RESPONSE_OK) {
- GtkWidget *chk_button = g_object_get_data (G_OBJECT (dialog), "check_button");
- check_button_callback (chk_button, NULL);
msd_load_modmap_files ();
}
gtk_widget_destroy (dialog);
@@ -140,7 +128,7 @@ remove_button_clicked_callback (GtkWidget *button,
GtkListStore *tree = NULL;
GtkTreeSelection *selection;
GtkWidget *treeview;
- MateConfClient *client;
+ GSettings *settings;
GSList *filenames = NULL;
GSList *tmp = NULL;
GSList *loaded_files = NULL;
@@ -159,20 +147,31 @@ remove_button_clicked_callback (GtkWidget *button,
/* Remove the selected file */
- client = mateconf_client_get_default ();
+ settings = g_settings_new (KEYBOARD_SCHEMA);
+
+ gchar **settings_list;
+ settings_list = g_settings_get_strv (settings, LOADED_FILES_KEY);
+ if (settings_list != NULL) {
+ gint i;
+ for (i = 0; i < G_N_ELEMENTS (settings_list); i++) {
+ if (settings_list[i] != NULL)
+ loaded_files =
+ g_slist_append (loaded_files, g_strdup (settings_list[i]));
+ }
+ g_strfreev (settings_list);
+ }
- loaded_files = mateconf_client_get_list (client,
- LOADED_FILES_KEY,
- MATECONF_VALUE_STRING,
- NULL);
loaded_files = remove_string_from_list (loaded_files, (char *)filenames->data);
- mateconf_client_set_list (client,
- LOADED_FILES_KEY,
- MATECONF_VALUE_STRING,
- loaded_files,
- NULL);
- g_object_unref (client);
+ GSList *l;
+ GPtrArray *array = g_ptr_array_new ();
+ for (l = loaded_files; l != NULL; l = l->next)
+ g_ptr_array_add (array, l->data);
+ g_ptr_array_add (array, NULL);
+ g_settings_set_strv (settings, LOADED_FILES_KEY, (const gchar **) array->pdata);
+ g_ptr_array_free (array, FALSE);
+
+ g_object_unref (settings);
tree = g_object_get_data (G_OBJECT (dialog), "tree");
@@ -201,7 +200,7 @@ load_button_clicked_callback (GtkWidget *button,
GSList *filenames = NULL;
GSList *tmp = NULL;
GSList *loaded_files = NULL;
- MateConfClient *client;
+ GSettings *settings;
dialog = data;
@@ -216,12 +215,19 @@ load_button_clicked_callback (GtkWidget *button,
return;
/* Add the files to left-tree-view */
- client = mateconf_client_get_default ();
-
- loaded_files = mateconf_client_get_list (client,
- LOADED_FILES_KEY,
- MATECONF_VALUE_STRING,
- NULL);
+ settings = g_settings_new (KEYBOARD_SCHEMA);
+
+ gchar **settings_list;
+ settings_list = g_settings_get_strv (settings, LOADED_FILES_KEY);
+ if (settings_list != NULL) {
+ gint i;
+ for (i = 0; i < G_N_ELEMENTS (settings_list); i++) {
+ if (settings_list[i] != NULL)
+ loaded_files =
+ g_slist_append (loaded_files, g_strdup (settings_list[i]));
+ }
+ g_strfreev (settings_list);
+ }
if (g_slist_find_custom (loaded_files, filenames->data, (GCompareFunc) strcmp)) {
g_free (filenames->data);
@@ -230,12 +236,14 @@ load_button_clicked_callback (GtkWidget *button,
}
loaded_files = g_slist_append (loaded_files, filenames->data);
- mateconf_client_set_list (client,
- LOADED_FILES_KEY,
- MATECONF_VALUE_STRING,
- loaded_files,
- NULL);
+ GSList *l;
+ GPtrArray *array = g_ptr_array_new ();
+ for (l = loaded_files; l != NULL; l = l->next)
+ g_ptr_array_add (array, l->data);
+ g_ptr_array_add (array, NULL);
+ g_settings_set_strv (settings, LOADED_FILES_KEY, (const gchar **) array->pdata);
+ g_ptr_array_free (array, FALSE);
tree = g_object_get_data (G_OBJECT (dialog), "tree");
@@ -250,7 +258,7 @@ load_button_clicked_callback (GtkWidget *button,
}
out:
- g_object_unref (client);
+ g_object_unref (settings);
g_slist_foreach (loaded_files, (GFunc) g_free, NULL);
g_slist_free (loaded_files);
}
@@ -273,12 +281,11 @@ msd_modmap_dialog_call (void)
GtkTreeViewColumn *column;
GtkWidget *add_button;
GtkWidget *remove_button;
- GtkWidget *chk_button;
GSList *tmp;
GDir *homeDir;
GSList *loaded_files;
const char *fname;
- MateConfClient *client;
+ GSettings *settings;
homeDir = g_dir_open (g_get_home_dir (), 0, NULL);
if (homeDir == NULL)
@@ -315,13 +322,6 @@ msd_modmap_dialog_call (void)
"clicked",
G_CALLBACK (remove_button_clicked_callback),
load_dialog);
- chk_button = GTK_WIDGET (gtk_builder_get_object (builder,
- "checkbutton1"));
- g_signal_connect (chk_button,
- "toggled",
- G_CALLBACK (check_button_callback),
- NULL);
- g_object_set_data (G_OBJECT (load_dialog), "check_button", chk_button);
treeview = GTK_WIDGET (gtk_builder_get_object (builder, "treeview1"));
g_object_set_data (G_OBJECT (load_dialog), "treeview1", treeview);
treeview = GTK_WIDGET (gtk_builder_get_object (builder, "treeview2"));
@@ -369,9 +369,19 @@ msd_modmap_dialog_call (void)
gtk_tree_view_append_column (GTK_TREE_VIEW (treeview1), column);
gtk_tree_view_column_set_sort_column_id (column, 0);
- client = mateconf_client_get_default ();
- loaded_files = mateconf_client_get_list (client, LOADED_FILES_KEY, MATECONF_VALUE_STRING, NULL);
- g_object_unref (client);
+ settings = g_settings_new (KEYBOARD_SCHEMA);
+
+ gchar **settings_list;
+ settings_list = g_settings_get_strv (settings, LOADED_FILES_KEY);
+ if (settings_list != NULL) {
+ gint i;
+ for (i = 0; i < G_N_ELEMENTS (settings_list); i++) {
+ if (settings_list[i] != NULL)
+ loaded_files =
+ g_slist_append (loaded_files, g_strdup (settings_list[i]));
+ }
+ g_strfreev (settings_list);
+ }
/* Add the data */
for (tmp = loaded_files; tmp != NULL; tmp = tmp->next) {
diff --git a/plugins/media-keys/acme.h b/plugins/media-keys/acme.h
index 41228e0..b911c13 100644
--- a/plugins/media-keys/acme.h
+++ b/plugins/media-keys/acme.h
@@ -23,8 +23,7 @@
#include "msd-keygrab.h"
-#define MATECONF_BINDING_DIR "/apps/mate_settings_daemon/keybindings"
-#define MATECONF_MISC_DIR "/apps/mate_settings_daemon"
+#define BINDING_SCHEMA "org.mate.SettingsDaemon.plugins.media-keys"
enum {
TOUCHPAD_KEY,
@@ -51,28 +50,28 @@ enum {
static struct {
int key_type;
- const char *mateconf_key;
+ const char *settings_key;
Key *key;
} keys[HANDLED_KEYS] = {
- { TOUCHPAD_KEY, MATECONF_BINDING_DIR "/touchpad", NULL },
- { MUTE_KEY, MATECONF_BINDING_DIR "/volume_mute",NULL },
- { VOLUME_DOWN_KEY, MATECONF_BINDING_DIR "/volume_down", NULL },
- { VOLUME_UP_KEY, MATECONF_BINDING_DIR "/volume_up", NULL },
- { POWER_KEY, MATECONF_BINDING_DIR "/power", NULL },
- { EJECT_KEY, MATECONF_BINDING_DIR "/eject", NULL },
- { HOME_KEY, MATECONF_BINDING_DIR "/home", NULL },
- { MEDIA_KEY, MATECONF_BINDING_DIR "/media", NULL },
- { CALCULATOR_KEY, MATECONF_BINDING_DIR "/calculator", NULL },
- { SEARCH_KEY, MATECONF_BINDING_DIR "/search", NULL },
- { EMAIL_KEY, MATECONF_BINDING_DIR "/email", NULL },
- { SCREENSAVER_KEY, MATECONF_BINDING_DIR "/screensaver", NULL },
- { HELP_KEY, MATECONF_BINDING_DIR "/help", NULL },
- { WWW_KEY, MATECONF_BINDING_DIR "/www", NULL },
- { PLAY_KEY, MATECONF_BINDING_DIR "/play", NULL },
- { PAUSE_KEY, MATECONF_BINDING_DIR "/pause", NULL },
- { STOP_KEY, MATECONF_BINDING_DIR "/stop", NULL },
- { PREVIOUS_KEY, MATECONF_BINDING_DIR "/previous", NULL },
- { NEXT_KEY, MATECONF_BINDING_DIR "/next", NULL },
+ { TOUCHPAD_KEY, "touchpad", NULL },
+ { MUTE_KEY, "volume-mute",NULL },
+ { VOLUME_DOWN_KEY, "volume-down", NULL },
+ { VOLUME_UP_KEY, "volume-up", NULL },
+ { POWER_KEY, "power", NULL },
+ { EJECT_KEY, "eject", NULL },
+ { HOME_KEY, "home", NULL },
+ { MEDIA_KEY, "media", NULL },
+ { CALCULATOR_KEY, "calculator", NULL },
+ { SEARCH_KEY, "search", NULL },
+ { EMAIL_KEY, "email", NULL },
+ { SCREENSAVER_KEY, "screensaver", NULL },
+ { HELP_KEY, "help", NULL },
+ { WWW_KEY, "www", NULL },
+ { PLAY_KEY, "play", NULL },
+ { PAUSE_KEY, "pause", NULL },
+ { STOP_KEY, "stop", NULL },
+ { PREVIOUS_KEY, "previous", NULL },
+ { NEXT_KEY, "next", NULL },
};
#endif /* __ACME_H__ */
diff --git a/plugins/media-keys/cut-n-paste/gvc-gstreamer-acme-vol.c b/plugins/media-keys/cut-n-paste/gvc-gstreamer-acme-vol.c
index d0ef380..3fc4d1f 100644
--- a/plugins/media-keys/cut-n-paste/gvc-gstreamer-acme-vol.c
+++ b/plugins/media-keys/cut-n-paste/gvc-gstreamer-acme-vol.c
@@ -34,14 +34,15 @@
#include <gst/interfaces/mixer.h>
#include <gst/interfaces/propertyprobe.h>
-#include <mateconf/mateconf-client.h>
+#include <gio/gio.h>
#include <string.h>
#define TIMEOUT 4
-#define DEFAULT_MIXER_DEVICE_KEY "/desktop/mate/sound/default_mixer_device"
-#define DEFAULT_MIXER_TRACKS_KEY "/desktop/mate/sound/default_mixer_tracks"
+#define MATE_SOUND_SCHEMA "org.mate.sound"
+#define DEFAULT_MIXER_DEVICE_KEY "default-mixer-device"
+#define DEFAULT_MIXER_TRACKS_KEY "default-mixer-tracks"
#define ACME_VOLUME_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), ACME_TYPE_VOLUME, AcmeVolumePrivate))
@@ -51,7 +52,7 @@ struct AcmeVolumePrivate {
guint timer_id;
gdouble volume;
gboolean mute;
- MateConfClient *mateconf_client;
+ GSettings *settings;
};
G_DEFINE_TYPE (AcmeVolume, acme_volume, G_TYPE_OBJECT)
@@ -76,9 +77,9 @@ acme_volume_finalize (GObject *object)
g_source_remove (self->_priv->timer_id);
acme_volume_close_real (self);
- if (self->_priv->mateconf_client != NULL) {
- g_object_unref (self->_priv->mateconf_client);
- self->_priv->mateconf_client = NULL;
+ if (self->_priv->settings != NULL) {
+ g_object_unref (self->_priv->settings);
+ self->_priv->settings = NULL;
}
G_OBJECT_CLASS (acme_volume_parent_class)->finalize (object);
@@ -266,7 +267,7 @@ acme_volume_open (AcmeVolume *self)
return TRUE;
}
- mixer_device = mateconf_client_get_string (self->_priv->mateconf_client, DEFAULT_MIXER_DEVICE_KEY, NULL);
+ mixer_device = g_settings_get_string (self->_priv->settings, DEFAULT_MIXER_DEVICE_KEY);
if (mixer_device != NULL)
factory_and_device = g_strsplit (mixer_device, ":", 2);
@@ -296,19 +297,21 @@ acme_volume_open (AcmeVolume *self)
if (self->_priv->mixer != NULL) {
const GList *m;
GSList *tracks, *t;
- GError *error = NULL;
- /* Try to use tracks saved in MateConf
+ /* Try to use tracks saved in GSettings
Note: errors need to be treated , for example if the user set a non type list for this key
or if the elements type_list are not "matched" */
- tracks = mateconf_client_get_list (self->_priv->mateconf_client, DEFAULT_MIXER_TRACKS_KEY,
- MATECONF_VALUE_STRING, &error);
-
- if (error) {
- g_warning("ERROR: %s\n", error->message);
- g_error_free(error);
+ gchar **settings_list;
+ settings_list = g_settings_get_strv (self->_priv->settings, DEFAULT_MIXER_TRACKS_KEY);
+ if (settings_list != NULL) {
+ gint i;
+ for (i = 0; i < G_N_ELEMENTS (settings_list); i++) {
+ if (settings_list[i] != NULL)
+ tracks = g_slist_append (tracks, g_strdup (settings_list[i]));
+ }
+ g_strfreev (settings_list);
}
-
+
/* We use these tracks ONLY if they are supported on the system with the following mixer */
for (m = gst_mixer_list_tracks (self->_priv->mixer); m != NULL; m = m->next) {
GstMixerTrack *track = GST_MIXER_TRACK (m->data);
@@ -322,7 +325,7 @@ acme_volume_open (AcmeVolume *self)
g_slist_foreach (tracks, (GFunc)g_free, NULL);
g_slist_free (tracks);
- /* If no track stored in MateConf is avaiable try to use Master track */
+ /* If no track stored in GSettings is avaiable try to use Master track */
if (self->_priv->mixer_tracks == NULL) {
for (m = gst_mixer_list_tracks (self->_priv->mixer); m != NULL; m = m->next) {
GstMixerTrack *track = GST_MIXER_TRACK (m->data);
@@ -374,7 +377,7 @@ static void
acme_volume_init (AcmeVolume *self)
{
self->_priv = ACME_VOLUME_GET_PRIVATE (self);
- self->_priv->mateconf_client = mateconf_client_get_default ();
+ self->_priv->settings = g_settings_new (MATE_SOUND_SCHEMA);
}
static void
diff --git a/plugins/media-keys/msd-media-keys-manager.c b/plugins/media-keys/msd-media-keys-manager.c
index d75c031..7ee48dc 100644
--- a/plugins/media-keys/msd-media-keys-manager.c
+++ b/plugins/media-keys/msd-media-keys-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 <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
@@ -62,7 +62,8 @@
#define MSD_MEDIA_KEYS_DBUS_PATH MSD_DBUS_PATH "/MediaKeys"
#define MSD_MEDIA_KEYS_DBUS_NAME MSD_DBUS_NAME ".MediaKeys"
-#define TOUCHPAD_ENABLED_KEY "/desktop/mate/peripherals/touchpad/touchpad_enabled"
+#define TOUCHPAD_SCHEMA "org.mate.peripherals-touchpad"
+#define TOUCHPAD_ENABLED_KEY "touchpad-enabled"
#define VOLUME_STEP 6 /* percents for one volume button press */
#define MAX_VOLUME 65536.0
@@ -84,7 +85,7 @@ struct MsdMediaKeysManagerPrivate
AcmeVolume *volume;
#endif /* HAVE_PULSE */
GtkWidget *dialog;
- MateConfClient *conf_client;
+ GSettings *settings;
GVolumeMonitor *volume_monitor;
/* Multihead stuff */
@@ -159,12 +160,13 @@ get_term_command (MsdMediaKeysManager *manager)
char *cmd_term;
char *cmd = NULL;
- cmd_term = mateconf_client_get_string (manager->priv->conf_client,
- "/desktop/mate/applications/terminal/exec", NULL);
+ GSettings *settings_terminal;
+ settings_terminal = g_settings_new ("org.mate.applications-terminal");
+
+ cmd_term = g_settings_get_string (settings_terminal, "exec");
if ((cmd_term != NULL) && (strcmp (cmd_term, "") != 0)) {
char *cmd_args;
- cmd_args = mateconf_client_get_string (manager->priv->conf_client,
- "/desktop/mate/applications/terminal/exec_arg", NULL);
+ cmd_args = g_settings_get_string (settings_terminal, "exec_arg");
if ((cmd_args != NULL) && (strcmp (cmd_term, "") != 0)) {
cmd = g_strdup_printf ("%s %s -e", cmd_term, cmd_args);
} else {
@@ -176,6 +178,8 @@ get_term_command (MsdMediaKeysManager *manager)
g_free (cmd_term);
+ g_object_unref (settings_terminal);
+
return cmd;
}
@@ -274,21 +278,20 @@ is_valid_shortcut (const char *string)
}
static void
-update_kbd_cb (MateConfClient *client,
- guint id,
- MateConfEntry *entry,
+update_kbd_cb (GSettings *settings,
+ gchar *settings_key,
MsdMediaKeysManager *manager)
{
int i;
gboolean need_flush = TRUE;
- g_return_if_fail (entry->key != NULL);
+ g_return_if_fail (settings_key != NULL);
gdk_error_trap_push ();
/* Find the key that was modified */
for (i = 0; i < HANDLED_KEYS; i++) {
- if (strcmp (entry->key, keys[i].mateconf_key) == 0) {
+ if (g_strcmp0 (settings_key, keys[i].settings_key) == 0) {
char *tmp;
Key *key;
@@ -300,8 +303,8 @@ update_kbd_cb (MateConfClient *client,
g_free (keys[i].key);
keys[i].key = NULL;
- tmp = mateconf_client_get_string (manager->priv->conf_client,
- keys[i].mateconf_key, NULL);
+ tmp = g_settings_get_string (settings,
+ keys[i].settings_key);
if (is_valid_shortcut (tmp) == FALSE) {
g_free (tmp);
@@ -345,16 +348,16 @@ static void init_kbd(MsdMediaKeysManager* manager)
char* tmp;
Key* key;
- manager->priv->notify[i] = mateconf_client_notify_add(manager->priv->conf_client,
- keys[i].mateconf_key,
- (MateConfClientNotifyFunc) update_kbd_cb,
- manager,
- NULL,
- NULL);
+ gchar* signal_name;
+ signal_name = g_strdup_printf ("changed::%s", keys[i].settings_key);
+ g_signal_connect (manager->priv->settings,
+ signal_name,
+ G_CALLBACK (update_kbd_cb),
+ manager);
+ g_free (signal_name);
- tmp = mateconf_client_get_string(manager->priv->conf_client,
- keys[i].mateconf_key,
- NULL);
+ tmp = g_settings_get_string (manager->priv->settings,
+ keys[i].settings_key);
if (!is_valid_shortcut(tmp))
{
@@ -463,115 +466,67 @@ dialog_show (MsdMediaKeysManager *manager)
}
static void
-do_unknown_action (MsdMediaKeysManager *manager,
- const char *url)
+do_uri_action (MsdMediaKeysManager *manager, gchar *uri)
{
- char *string;
-
- g_return_if_fail (url != NULL);
+ GError *error = NULL;
+ GAppInfo *app_info;
- string = mateconf_client_get_string (manager->priv->conf_client,
- "/desktop/mate/url-handlers/unknown/command",
- NULL);
+ app_info = g_app_info_get_default_for_uri_scheme (uri);
- if ((string != NULL) && (strcmp (string, "") != 0)) {
- char *cmd;
- cmd = g_strdup_printf (string, url);
- execute (manager, cmd, FALSE, FALSE);
- g_free (cmd);
+ if (app_info != NULL) {
+ if (!g_app_info_launch (app_info, NULL, NULL, &error)) {
+ g_warning ("Could not launch '%s': %s",
+ g_app_info_get_commandline (app_info),
+ error->message);
+ g_error_free (error);
+ }
+ }
+ else {
+ g_warning ("Could not find default application for '%s' scheme", uri);
}
- g_free (string);
}
static void
do_help_action (MsdMediaKeysManager *manager)
{
- char *string;
-
- string = mateconf_client_get_string (manager->priv->conf_client,
- "/desktop/mate/url-handlers/ghelp/command",
- NULL);
-
- if ((string != NULL) && (strcmp (string, "") != 0)) {
- char *cmd;
- cmd = g_strdup_printf (string, "");
- execute (manager, cmd, FALSE, FALSE);
- g_free (cmd);
- } else {
- do_unknown_action (manager, "ghelp:");
+ GError *error = NULL;
+ if (!g_app_info_launch_default_for_uri ("http://wiki.mate-desktop.org/docs", NULL, &error)) {
+ g_warning ("Could not launch help application: %s", error->message);
+ g_error_free (error);
}
-
- g_free (string);
}
static void
do_mail_action (MsdMediaKeysManager *manager)
{
- char *string;
-
- string = mateconf_client_get_string (manager->priv->conf_client,
- "/desktop/mate/url-handlers/mailto/command",
- NULL);
-
- if ((string != NULL) && (strcmp (string, "") != 0)) {
- char *cmd;
- cmd = g_strdup_printf (string, "");
- execute (manager,
- cmd,
- FALSE,
- mateconf_client_get_bool (manager->priv->conf_client,
- "/desktop/mate/url-handlers/mailto/needs_terminal", NULL));
- g_free (cmd);
- }
- g_free (string);
+ do_uri_action (manager, "mailto");
}
static void
do_media_action (MsdMediaKeysManager *manager)
{
- char *command;
-
- command = mateconf_client_get_string (manager->priv->conf_client,
- "/desktop/mate/applications/media/exec", NULL);
- if ((command != NULL) && (strcmp (command, "") != 0)) {
- execute (manager,
- command,
- FALSE,
- mateconf_client_get_bool (manager->priv->conf_client,
- "/desktop/mate/applications/media/needs_term", NULL));
+ GError *error = NULL;
+ GAppInfo *app_info;
+
+ app_info = g_app_info_get_default_for_type ("audio/x-vorbis+ogg", FALSE);
+
+ if (app_info != NULL) {
+ if (!g_app_info_launch (app_info, NULL, NULL, &error)) {
+ g_warning ("Could not launch '%s': %s",
+ g_app_info_get_commandline (app_info),
+ error->message);
+ g_error_free (error);
+ }
+ }
+ else {
+ g_warning ("Could not find default application for '%s' mime-type", "audio/x-vorbis+ogg");
}
- g_free (command);
}
static void
-do_www_action (MsdMediaKeysManager *manager,
- const char *url)
+do_www_action (MsdMediaKeysManager *manager)
{
- char *string;
-
- string = mateconf_client_get_string (manager->priv->conf_client,
- "/desktop/mate/url-handlers/http/command",
- NULL);
-
- if ((string != NULL) && (strcmp (string, "") != 0)) {
- gchar *cmd;
-
- if (url == NULL) {
- cmd = g_strdup_printf (string, "");
- } else {
- cmd = g_strdup_printf (string, url);
- }
-
- execute (manager,
- cmd,
- FALSE,
- mateconf_client_get_bool (manager->priv->conf_client,
- "/desktop/mate/url-handlers/http/needs_terminal", NULL));
- g_free (cmd);
- } else {
- do_unknown_action (manager, url ? url : "");
- }
- g_free (string);
+ do_uri_action (manager, "http");
}
static void
@@ -649,8 +604,8 @@ do_eject_action (MsdMediaKeysManager *manager)
static void
do_touchpad_action (MsdMediaKeysManager *manager)
{
- MateConfClient *client = manager->priv->conf_client;
- gboolean state = mateconf_client_get_bool (client, TOUCHPAD_ENABLED_KEY, NULL);
+ GSettings *settings = g_settings_new (TOUCHPAD_SCHEMA);
+ gboolean state = g_settings_get_boolean (settings, TOUCHPAD_ENABLED_KEY);
dialog_init (manager);
msd_media_keys_window_set_action_custom (MSD_MEDIA_KEYS_WINDOW (manager->priv->dialog),
@@ -658,7 +613,8 @@ do_touchpad_action (MsdMediaKeysManager *manager)
FALSE);
dialog_show (manager);
- mateconf_client_set_bool (client, TOUCHPAD_ENABLED_KEY, !state, NULL);
+ g_settings_set_boolean (settings, TOUCHPAD_ENABLED_KEY, !state);
+ g_object_unref (settings);
}
#ifdef HAVE_PULSE
@@ -706,9 +662,7 @@ do_sound_action (MsdMediaKeysManager *manager,
return;
#endif
- vol_step = mateconf_client_get_int (manager->priv->conf_client,
- MATECONF_MISC_DIR "/volume_step",
- NULL);
+ vol_step = g_settings_get_int (manager->priv->settings, "volume-step");
if (vol_step <= 0 || vol_step > 100)
vol_step = VOLUME_STEP;
@@ -1044,7 +998,7 @@ do_action (MsdMediaKeysManager *manager,
do_help_action (manager);
break;
case WWW_KEY:
- do_www_action (manager, NULL);
+ do_www_action (manager);
break;
case MEDIA_KEY:
do_media_action (manager);
@@ -1152,12 +1106,7 @@ start_media_keys_idle_cb (MsdMediaKeysManager *manager)
g_debug ("Starting media_keys manager");
mate_settings_profile_start (NULL);
manager->priv->volume_monitor = g_volume_monitor_get ();
- manager->priv->conf_client = mateconf_client_get_default ();
-
- mateconf_client_add_dir (manager->priv->conf_client,
- MATECONF_BINDING_DIR,
- MATECONF_CLIENT_PRELOAD_ONELEVEL,
- NULL);
+ manager->priv->settings = g_settings_new (BINDING_SCHEMA);
init_screens (manager);
init_kbd (manager);
@@ -1242,20 +1191,9 @@ msd_media_keys_manager_stop (MsdMediaKeysManager *manager)
manager);
}
- if (priv->conf_client) {
- mateconf_client_remove_dir (priv->conf_client,
- MATECONF_BINDING_DIR,
- NULL);
-
- for (i = 0; i < HANDLED_KEYS; ++i) {
- if (priv->notify[i] != 0) {
- mateconf_client_notify_remove (priv->conf_client, priv->notify[i]);
- priv->notify[i] = 0;
- }
- }
-
- g_object_unref (priv->conf_client);
- priv->conf_client = NULL;
+ if (priv->settings) {
+ g_object_unref (priv->settings);
+ priv->settings = NULL;
}
if (priv->volume_monitor != NULL) {
diff --git a/plugins/mouse/msd-mouse-manager.c b/plugins/mouse/msd-mouse-manager.c
index d7cb8e4..69b61a6 100644
--- a/plugins/mouse/msd-mouse-manager.c
+++ b/plugins/mouse/msd-mouse-manager.c
@@ -44,43 +44,45 @@
#include <X11/extensions/XInput.h>
#include <X11/extensions/XIproto.h>
#endif
-#include <mateconf/mateconf.h>
-#include <mateconf/mateconf-client.h>
+#include <gio/gio.h>
#include "mate-settings-profile.h"
#include "msd-mouse-manager.h"
#define MSD_MOUSE_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), MSD_TYPE_MOUSE_MANAGER, MsdMouseManagerPrivate))
-#define MATECONF_MOUSE_DIR "/desktop/mate/peripherals/mouse"
-#define MATECONF_MOUSE_A11Y_DIR "/desktop/mate/accessibility/mouse"
-#define MATECONF_TOUCHPAD_DIR "/desktop/mate/peripherals/touchpad"
-
-#define KEY_LEFT_HANDED MATECONF_MOUSE_DIR "/left_handed"
-#define KEY_MOTION_ACCELERATION MATECONF_MOUSE_DIR "/motion_acceleration"
-#define KEY_MOTION_THRESHOLD MATECONF_MOUSE_DIR "/motion_threshold"
-#define KEY_LOCATE_POINTER MATECONF_MOUSE_DIR "/locate_pointer"
-#define KEY_DWELL_ENABLE MATECONF_MOUSE_A11Y_DIR "/dwell_enable"
-#define KEY_DELAY_ENABLE MATECONF_MOUSE_A11Y_DIR "/delay_enable"
-#define KEY_TOUCHPAD_DISABLE_W_TYPING MATECONF_TOUCHPAD_DIR "/disable_while_typing"
+#define MATE_MOUSE_SCHEMA "org.mate.peripherals-mouse"
+#define KEY_MOUSE_LEFT_HANDED "left-handed"
+#define KEY_MOUSE_MOTION_ACCELERATION "motion-acceleration"
+#define KEY_MOUSE_MOTION_THRESHOLD "motion-threshold"
+#define KEY_MOUSE_LOCATE_POINTER "locate-pointer"
+
+#define MATE_TOUCHPAD_SCHEMA "org.mate.peripherals-touchpad"
+#define KEY_TOUCHPAD_DISABLE_W_TYPING "disable-while-typing"
#ifdef HAVE_X11_EXTENSIONS_XINPUT_H
-#define KEY_TAP_TO_CLICK MATECONF_TOUCHPAD_DIR "/tap_to_click"
-#define KEY_SCROLL_METHOD MATECONF_TOUCHPAD_DIR "/scroll_method"
-#define KEY_PAD_HORIZ_SCROLL MATECONF_TOUCHPAD_DIR "/horiz_scroll_enabled"
-#define KEY_TOUCHPAD_ENABLED MATECONF_TOUCHPAD_DIR "/touchpad_enabled"
+#define KEY_TOUCHPAD_TAP_TO_CLICK "tap-to-click"
+#define KEY_TOUCHPAD_SCROLL_METHOD "scroll-method"
+#define KEY_TOUCHPAD_PAD_HORIZ_SCROLL "horiz-scroll-enabled"
+#define KEY_TOUCHPAD_ENABLED "touchpad-enabled"
#endif
+/* FIXME: currently there is no mate-mousetweaks, so I comment this
+ *
+ *#define MATE_MOUSE_A11Y_SCHEMA "org.mate.accessibility-mouse"
+ *#define KEY_MOUSE_A11Y_DWELL_ENABLE "dwell-enable"
+ *#define KEY_MOUSE_A11Y_DELAY_ENABLE "delay-enable"
+ */
+
struct MsdMouseManagerPrivate
{
- guint notify;
- guint notify_a11y;
- guint notify_touchpad;
+ GSettings *settings_mouse;
+ GSettings *settings_touchpad;
gboolean mousetweaks_daemon_running;
gboolean syndaemon_spawned;
GPid syndaemon_pid;
- gboolean locate_pointer_spawned;
- GPid locate_pointer_pid;
+ gboolean locate_pointer_spawned;
+ GPid locate_pointer_pid;
};
static void msd_mouse_manager_class_init (MsdMouseManagerClass *klass);
@@ -325,14 +327,14 @@ set_xinput_devices_left_handed (gboolean left_handed)
* around too, otherwise a tap would be a right-click */
device = device_is_touchpad (device_info[i]);
if (device != NULL) {
- MateConfClient *client = mateconf_client_get_default ();
- gboolean tap = mateconf_client_get_bool (client, KEY_TAP_TO_CLICK, NULL);
+ GSettings *settings = g_settings_new (MATE_TOUCHPAD_SCHEMA);
+ gboolean tap = g_settings_get_boolean (settings, KEY_TOUCHPAD_TAP_TO_CLICK);
gboolean single_button = touchpad_has_single_button (device);
if (tap && !single_button)
set_tap_to_click (tap, left_handed);
XCloseDevice (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), device);
- g_object_unref (client);
+ g_object_unref (settings);
if (single_button)
continue;
@@ -569,10 +571,7 @@ set_disable_w_typing (MsdMouseManager *manager, gboolean state)
manager->priv->syndaemon_spawned = (error == NULL);
if (error) {
- MateConfClient *client;
- client = mateconf_client_get_default ();
- mateconf_client_set_bool (client, KEY_TOUCHPAD_DISABLE_W_TYPING, FALSE, NULL);
- g_object_unref (client);
+ g_settings_set_boolean (manager->priv->settings_touchpad, KEY_TOUCHPAD_DISABLE_W_TYPING, FALSE);
g_error_free (error);
}
@@ -825,15 +824,12 @@ set_locate_pointer (MsdMouseManager *manager,
manager->priv->locate_pointer_spawned = (error == NULL);
if (error) {
- MateConfClient *client;
- client = mateconf_client_get_default ();
- mateconf_client_set_bool (client, KEY_LOCATE_POINTER, FALSE, NULL);
- g_object_unref (client);
+ g_settings_set_boolean (manager->priv->settings_mouse, KEY_MOUSE_LOCATE_POINTER, FALSE);
g_error_free (error);
}
}
- else if (manager->priv->locate_pointer_spawned) {
+ else if (manager->priv->locate_pointer_spawned) {
kill (manager->priv->locate_pointer_pid, SIGHUP);
g_spawn_close_pid (manager->priv->locate_pointer_pid);
manager->priv->locate_pointer_spawned = FALSE;
@@ -845,6 +841,10 @@ set_mousetweaks_daemon (MsdMouseManager *manager,
gboolean dwell_enable,
gboolean delay_enable)
{
+ /* FIXME there is no mate-mousetweaks */
+ return;
+
+
GError *error = NULL;
gchar *comm;
gboolean run_daemon = dwell_enable || delay_enable;
@@ -863,19 +863,23 @@ set_mousetweaks_daemon (MsdMouseManager *manager,
if (error->code == G_SPAWN_ERROR_NOENT &&
(dwell_enable || delay_enable)) {
GtkWidget *dialog;
- MateConfClient *client;
-
- client = mateconf_client_get_default ();
+
+ /* uncomment this when (and if) we'll fork mousetweaks */
+
+ /*
+ GSettings *settings;
+ settings = g_settings_new (MATE_MOUSE_A11Y_SCHEMA);
if (dwell_enable)
- mateconf_client_set_bool (client,
- KEY_DWELL_ENABLE,
- FALSE, NULL);
+ g_settings_set_boolean (settings,
+ MATE_MOUSE_A11Y_KEY_DWELL_ENABLE,
+ FALSE);
else if (delay_enable)
- mateconf_client_set_bool (client,
- KEY_DELAY_ENABLE,
- FALSE, NULL);
- g_object_unref (client);
-
+ g_settings_set_boolean (settings,
+ MATE_MOUSE_A11Y_KEY_DELAY_ENABLE,
+ FALSE);
+ g_object_unref (settings);
+ */
+
dialog = gtk_message_dialog_new (NULL, 0,
GTK_MESSAGE_WARNING,
GTK_BUTTONS_OK,
@@ -898,93 +902,60 @@ set_mousetweaks_daemon (MsdMouseManager *manager,
static void
set_mouse_settings (MsdMouseManager *manager)
{
- MateConfClient *client = mateconf_client_get_default ();
- gboolean left_handed = mateconf_client_get_bool (client, KEY_LEFT_HANDED, NULL);
+ gboolean left_handed = g_settings_get_boolean (manager->priv->settings_mouse, KEY_MOUSE_LEFT_HANDED);
set_left_handed (manager, left_handed);
- set_motion_acceleration (manager, mateconf_client_get_float (client, KEY_MOTION_ACCELERATION , NULL));
- set_motion_threshold (manager, mateconf_client_get_int (client, KEY_MOTION_THRESHOLD, NULL));
+ set_motion_acceleration (manager, g_settings_get_double (manager->priv->settings_mouse, KEY_MOUSE_MOTION_ACCELERATION));
+ set_motion_threshold (manager, g_settings_get_int (manager->priv->settings_mouse, KEY_MOUSE_MOTION_THRESHOLD));
- set_disable_w_typing (manager, mateconf_client_get_bool (client, KEY_TOUCHPAD_DISABLE_W_TYPING, NULL));
+ set_disable_w_typing (manager, g_settings_get_boolean (manager->priv->settings_touchpad, KEY_TOUCHPAD_DISABLE_W_TYPING));
#ifdef HAVE_X11_EXTENSIONS_XINPUT_H
- set_tap_to_click (mateconf_client_get_bool (client, KEY_TAP_TO_CLICK, NULL), left_handed);
- set_edge_scroll (mateconf_client_get_int (client, KEY_SCROLL_METHOD, NULL));
- set_horiz_scroll (mateconf_client_get_bool (client, KEY_PAD_HORIZ_SCROLL, NULL));
- set_touchpad_enabled (mateconf_client_get_bool (client, KEY_TOUCHPAD_ENABLED, NULL));
+ set_tap_to_click (g_settings_get_boolean (manager->priv->settings_touchpad, KEY_TOUCHPAD_TAP_TO_CLICK), left_handed);
+ set_edge_scroll (g_settings_get_int (manager->priv->settings_touchpad, KEY_TOUCHPAD_SCROLL_METHOD));
+ set_horiz_scroll (g_settings_get_boolean (manager->priv->settings_touchpad, KEY_TOUCHPAD_PAD_HORIZ_SCROLL));
+ set_touchpad_enabled (g_settings_get_boolean (manager->priv->settings_touchpad, KEY_TOUCHPAD_ENABLED));
#endif
-
- g_object_unref (client);
}
static void
-mouse_callback (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
+mouse_callback (GSettings *settings,
+ const gchar *key,
MsdMouseManager *manager)
{
- if (! strcmp (entry->key, KEY_LEFT_HANDED)) {
- if (entry->value->type == MATECONF_VALUE_BOOL) {
- set_left_handed (manager, mateconf_value_get_bool (entry->value));
- }
- } else if (! strcmp (entry->key, KEY_MOTION_ACCELERATION)) {
- if (entry->value->type == MATECONF_VALUE_FLOAT) {
- set_motion_acceleration (manager, mateconf_value_get_float (entry->value));
- }
- } else if (! strcmp (entry->key, KEY_MOTION_THRESHOLD)) {
- if (entry->value->type == MATECONF_VALUE_INT) {
- set_motion_threshold (manager, mateconf_value_get_int (entry->value));
- }
- } else if (! strcmp (entry->key, KEY_TOUCHPAD_DISABLE_W_TYPING)) {
- if (entry->value->type == MATECONF_VALUE_BOOL)
- set_disable_w_typing (manager, mateconf_value_get_bool (entry->value));
+ if (g_strcmp0 (key, KEY_MOUSE_LEFT_HANDED) == 0) {
+ set_left_handed (manager, g_settings_get_boolean (settings, key));
+ } else if (g_strcmp0 (key, KEY_MOUSE_MOTION_ACCELERATION) == 0) {
+ set_motion_acceleration (manager, g_settings_get_double (settings, key));
+ } else if (g_strcmp0 (key, KEY_MOUSE_MOTION_THRESHOLD) == 0) {
+ set_motion_threshold (manager, g_settings_get_int (settings, key));
+ } else if (g_strcmp0 (key, KEY_TOUCHPAD_DISABLE_W_TYPING) == 0) {
+ set_disable_w_typing (manager, g_settings_get_boolean (settings, key));
#ifdef HAVE_X11_EXTENSIONS_XINPUT_H
- } else if (! strcmp (entry->key, KEY_TAP_TO_CLICK)) {
- if (entry->value->type == MATECONF_VALUE_BOOL) {
- set_tap_to_click (mateconf_value_get_bool (entry->value),
- mateconf_client_get_bool (client, KEY_LEFT_HANDED, NULL));
- }
- } else if (! strcmp (entry->key, KEY_SCROLL_METHOD)) {
- if (entry->value->type == MATECONF_VALUE_INT) {
- set_edge_scroll (mateconf_value_get_int (entry->value));
- set_horiz_scroll (mateconf_client_get_bool (client, KEY_PAD_HORIZ_SCROLL, NULL));
- }
- } else if (! strcmp (entry->key, KEY_PAD_HORIZ_SCROLL)) {
- if (entry->value->type == MATECONF_VALUE_BOOL)
- set_horiz_scroll (mateconf_value_get_bool (entry->value));
+ } else if (g_strcmp0 (key, KEY_TOUCHPAD_TAP_TO_CLICK) == 0) {
+ set_tap_to_click (g_settings_get_boolean (settings, key),
+ g_settings_get_boolean (manager->priv->settings_mouse, KEY_MOUSE_LEFT_HANDED));
+ } else if (g_strcmp0 (key, KEY_TOUCHPAD_SCROLL_METHOD) == 0) {
+ set_edge_scroll (g_settings_get_int (settings, key));
+ set_horiz_scroll (g_settings_get_boolean (settings, KEY_TOUCHPAD_PAD_HORIZ_SCROLL));
+ } else if (g_strcmp0 (key, KEY_TOUCHPAD_PAD_HORIZ_SCROLL) == 0) {
+ set_horiz_scroll (g_settings_get_boolean (settings, key));
#endif
- } else if (! strcmp (entry->key, KEY_LOCATE_POINTER)) {
- if (entry->value->type == MATECONF_VALUE_BOOL) {
- set_locate_pointer (manager, mateconf_value_get_bool (entry->value));
- }
+ } else if (g_strcmp0 (key, KEY_MOUSE_LOCATE_POINTER) == 0) {
+ set_locate_pointer (manager, g_settings_get_boolean (settings, key));
#ifdef HAVE_X11_EXTENSIONS_XINPUT_H
- } else if (! strcmp (entry->key, KEY_TOUCHPAD_ENABLED)) {
- if (entry->value->type == MATECONF_VALUE_BOOL) {
- set_touchpad_enabled (mateconf_value_get_bool (entry->value));
- }
+ } else if (g_strcmp0 (key, KEY_TOUCHPAD_ENABLED) == 0) {
+ set_touchpad_enabled (g_settings_get_boolean (settings, key));
#endif
- } else if (! strcmp (entry->key, KEY_DWELL_ENABLE)) {
- if (entry->value->type == MATECONF_VALUE_BOOL) {
- set_mousetweaks_daemon (manager,
- mateconf_value_get_bool (entry->value),
- mateconf_client_get_bool (client, KEY_DELAY_ENABLE, NULL));
+ } /*else if (g_strcmp0 (key, KEY_MOUSE_A11Y_DWELL_ENABLE) == 0) {
+ set_mousetweaks_daemon (manager,
+ g_settings_get_boolean (settings, key),
+ g_settings_get_boolean (settings, KEY_MOUSE_A11Y_DELAY_ENABLE, NULL));
}
- } else if (! strcmp (entry->key, KEY_DELAY_ENABLE)) {
- if (entry->value->type == MATECONF_VALUE_BOOL) {
- set_mousetweaks_daemon (manager,
- mateconf_client_get_bool (client, KEY_DWELL_ENABLE, NULL),
- mateconf_value_get_bool (entry->value));
- }
- }
-}
-
-static guint
-register_config_callback (MsdMouseManager *manager,
- MateConfClient *client,
- const char *path,
- MateConfClientNotifyFunc func)
-{
- mateconf_client_add_dir (client, path, MATECONF_CLIENT_PRELOAD_ONELEVEL, NULL);
- return mateconf_client_notify_add (client, path, func, manager, NULL, NULL);
+ } else if (g_strcmp0 (key, KEY_MOUSE_A11Y_DELAY_ENABLE) == 0) {
+ set_mousetweaks_daemon (manager,
+ g_settings_get_boolean (settings, KEY_MOUSE_A11Y_DWELL_ENABLE, NULL),
+ g_settings_get_boolean (settings, key));
+ }*/
}
static void
@@ -996,49 +967,40 @@ msd_mouse_manager_init (MsdMouseManager *manager)
static gboolean
msd_mouse_manager_idle_cb (MsdMouseManager *manager)
{
- MateConfClient *client;
-
mate_settings_profile_start (NULL);
- client = mateconf_client_get_default ();
-
- manager->priv->notify =
- register_config_callback (manager,
- client,
- MATECONF_MOUSE_DIR,
- (MateConfClientNotifyFunc) mouse_callback);
- manager->priv->notify_a11y =
- register_config_callback (manager,
- client,
- MATECONF_MOUSE_A11Y_DIR,
- (MateConfClientNotifyFunc) mouse_callback);
- manager->priv->notify_touchpad =
- register_config_callback (manager,
- client,
- MATECONF_TOUCHPAD_DIR,
- (MateConfClientNotifyFunc) mouse_callback);
+ manager->priv->settings_mouse = g_settings_new (MATE_MOUSE_SCHEMA);
+ manager->priv->settings_touchpad = g_settings_new (MATE_TOUCHPAD_SCHEMA);
+
+ g_signal_connect (manager->priv->settings_mouse, "changed",
+ G_CALLBACK (mouse_callback), manager);
+ g_signal_connect (manager->priv->settings_touchpad, "changed",
+ G_CALLBACK (mouse_callback), manager);
+
manager->priv->syndaemon_spawned = FALSE;
#ifdef HAVE_X11_EXTENSIONS_XINPUT_H
set_devicepresence_handler (manager);
#endif
set_mouse_settings (manager);
- set_locate_pointer (manager, mateconf_client_get_bool (client, KEY_LOCATE_POINTER, NULL));
+ set_locate_pointer (manager, g_settings_get_boolean (manager->priv->settings_mouse, KEY_MOUSE_LOCATE_POINTER));
+ /*
set_mousetweaks_daemon (manager,
- mateconf_client_get_bool (client, KEY_DWELL_ENABLE, NULL),
- mateconf_client_get_bool (client, KEY_DELAY_ENABLE, NULL));
+ g_settings_get_boolean (manager->priv->settings_mouse_a11y,
+ KEY_MOUSE_A11Y_DWELL_ENABLE),
+ g_settings_get_boolean (manager->priv->settings_mouse_a11y,
+ KEY_MOUSE_A11Y_DELAY_ENABLE));
+ */
- set_disable_w_typing (manager, mateconf_client_get_bool (client, KEY_TOUCHPAD_DISABLE_W_TYPING, NULL));
+ set_disable_w_typing (manager, g_settings_get_boolean (manager->priv->settings_touchpad, KEY_TOUCHPAD_DISABLE_W_TYPING));
#ifdef HAVE_X11_EXTENSIONS_XINPUT_H
- set_tap_to_click (mateconf_client_get_bool (client, KEY_TAP_TO_CLICK, NULL),
- mateconf_client_get_bool (client, KEY_LEFT_HANDED, NULL));
- set_edge_scroll (mateconf_client_get_int (client, KEY_SCROLL_METHOD, NULL));
- set_horiz_scroll (mateconf_client_get_bool (client, KEY_PAD_HORIZ_SCROLL, NULL));
- set_touchpad_enabled (mateconf_client_get_bool (client, KEY_TOUCHPAD_ENABLED, NULL));
+ set_tap_to_click (g_settings_get_boolean (manager->priv->settings_touchpad, KEY_TOUCHPAD_TAP_TO_CLICK),
+ g_settings_get_boolean (manager->priv->settings_mouse, KEY_MOUSE_LEFT_HANDED));
+ set_edge_scroll (g_settings_get_int (manager->priv->settings_touchpad, KEY_TOUCHPAD_SCROLL_METHOD));
+ set_horiz_scroll (g_settings_get_boolean (manager->priv->settings_touchpad, KEY_TOUCHPAD_PAD_HORIZ_SCROLL));
+ set_touchpad_enabled (g_settings_get_boolean (manager->priv->settings_touchpad, KEY_TOUCHPAD_ENABLED));
#endif
- g_object_unref (client);
-
mate_settings_profile_end (NULL);
return FALSE;
@@ -1061,32 +1023,19 @@ void
msd_mouse_manager_stop (MsdMouseManager *manager)
{
MsdMouseManagerPrivate *p = manager->priv;
- MateConfClient *client;
g_debug ("Stopping mouse manager");
- client = mateconf_client_get_default ();
-
- if (p->notify != 0) {
- mateconf_client_remove_dir (client, MATECONF_MOUSE_DIR, NULL);
- mateconf_client_notify_remove (client, p->notify);
- p->notify = 0;
+ if (p->settings_mouse != NULL) {
+ g_object_unref(p->settings_mouse);
+ p->settings_mouse = NULL;
}
- if (p->notify_a11y != 0) {
- mateconf_client_remove_dir (client, MATECONF_MOUSE_A11Y_DIR, NULL);
- mateconf_client_notify_remove (client, p->notify_a11y);
- p->notify_a11y = 0;
+ if (p->settings_touchpad != NULL) {
+ g_object_unref(p->settings_touchpad);
+ p->settings_touchpad = NULL;
}
- if (p->notify_touchpad != 0) {
- mateconf_client_remove_dir (client, MATECONF_TOUCHPAD_DIR, NULL);
- mateconf_client_notify_remove (client, p->notify_touchpad);
- p->notify_touchpad = 0;
- }
-
- g_object_unref (client);
-
set_locate_pointer (manager, FALSE);
#ifdef HAVE_X11_EXTENSIONS_XINPUT_H
diff --git a/plugins/smartcard/msd-smartcard-plugin.c b/plugins/smartcard/msd-smartcard-plugin.c
index dc4cb8f..8755637 100644
--- a/plugins/smartcard/msd-smartcard-plugin.c
+++ b/plugins/smartcard/msd-smartcard-plugin.c
@@ -28,7 +28,7 @@
#include <dbus/dbus-glib.h>
-#include <mateconf/mateconf-client.h>
+#include <gio/gio.h>
#include "mate-settings-plugin.h"
#include "msd-smartcard-plugin.h"
@@ -57,8 +57,8 @@ typedef enum
#define SM_DBUS_INTERFACE "org.mate.SessionManager"
#define SM_LOGOUT_MODE_FORCE 2
-#define MSD_SMARTCARD_KEY "/desktop/mate/peripherals/smartcard"
-#define KEY_REMOVE_ACTION MSD_SMARTCARD_KEY "/removal_action"
+#define MSD_SMARTCARD_SCHEMA "org.mate.peripherals-smartcard"
+#define KEY_REMOVE_ACTION "removal-action"
#define MSD_SMARTCARD_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), MSD_TYPE_SMARTCARD_PLUGIN, MsdSmartcardPluginPrivate))
@@ -182,13 +182,13 @@ user_logged_in_with_smartcard (void)
static MsdSmartcardRemoveAction
get_configured_remove_action (MsdSmartcardPlugin *plugin)
{
- MateConfClient *client;
+ GSettings *settings;
char *remove_action_string;
MsdSmartcardRemoveAction remove_action;
- client = mateconf_client_get_default ();
- remove_action_string = mateconf_client_get_string (client,
- KEY_REMOVE_ACTION, NULL);
+ settings = g_settings_new (MSD_SMARTCARD_SCHEMA);
+ remove_action_string = g_settings_get_string (settings,
+ KEY_REMOVE_ACTION);
if (remove_action_string == NULL) {
g_warning ("MsdSmartcardPlugin unable to get smartcard remove action");
@@ -204,7 +204,7 @@ get_configured_remove_action (MsdSmartcardPlugin *plugin)
remove_action = MSD_SMARTCARD_REMOVE_ACTION_NONE;
}
- g_object_unref (client);
+ g_object_unref (settings);
return remove_action;
}
diff --git a/plugins/sound/msd-sound-manager.c b/plugins/sound/msd-sound-manager.c
index 23fb240..c92becd 100644
--- a/plugins/sound/msd-sound-manager.c
+++ b/plugins/sound/msd-sound-manager.c
@@ -33,7 +33,7 @@
#include <glib.h>
#include <glib/gi18n.h>
-#include <mateconf/mateconf-client.h>
+#include <gio/gio.h>
#include <gtk/gtk.h>
#ifdef HAVE_PULSE
@@ -47,12 +47,12 @@
struct MsdSoundManagerPrivate
{
- guint mateconf_notify;
+ GSettings *settings;
GList* monitors;
guint timeout;
};
-#define MATECONF_SOUND_DIR "/desktop/mate/sound"
+#define MATE_SOUND_SCHEMA "org.mate.sound"
static void msd_sound_manager_class_init (MsdSoundManagerClass *klass);
static void msd_sound_manager_init (MsdSoundManager *sound_manager);
@@ -205,35 +205,13 @@ trigger_flush (MsdSoundManager *manager)
}
static void
-mateconf_client_notify_cb (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
- MsdSoundManager *manager)
+gsettings_notify_cb (GSettings *client,
+ gchar *key,
+ MsdSoundManager *manager)
{
trigger_flush (manager);
}
-static gboolean
-register_config_callback (MsdSoundManager *manager, GError **error)
-{
- MateConfClient *client;
- gboolean succ;
-
- client = mateconf_client_get_default ();
-
- mateconf_client_add_dir (client, MATECONF_SOUND_DIR, MATECONF_CLIENT_PRELOAD_NONE, error);
- succ = !error || !*error;
-
- if (!error) {
- manager->priv->mateconf_notify = mateconf_client_notify_add (client, MATECONF_SOUND_DIR, (MateConfClientNotifyFunc) mateconf_client_notify_cb, manager, NULL, error);
- succ = !error || !*error;
- }
-
- g_object_unref (client);
-
- return succ;
-}
-
static void
file_monitor_changed_cb (GFileMonitor *monitor,
GFile *file,
@@ -291,7 +269,9 @@ msd_sound_manager_start (MsdSoundManager *manager,
#ifdef HAVE_PULSE
/* We listen for change of the selected theme ... */
- register_config_callback (manager, NULL);
+ manager->priv->settings = g_settings_new (MATE_SOUND_SCHEMA);
+
+ g_signal_connect (manager->priv->settings, "changed", G_CALLBACK (gsettings_notify_cb), manager);
/* ... and we listen to changes of the theme base directories
* in $HOME ...*/
@@ -331,15 +311,9 @@ msd_sound_manager_stop (MsdSoundManager *manager)
g_debug ("Stopping sound manager");
#ifdef HAVE_PULSE
- if (manager->priv->mateconf_notify != 0) {
- MateConfClient *client = mateconf_client_get_default ();
-
- mateconf_client_remove_dir (client, MATECONF_SOUND_DIR, NULL);
-
- mateconf_client_notify_remove (client, manager->priv->mateconf_notify);
- manager->priv->mateconf_notify = 0;
-
- g_object_unref (client);
+ if (manager->priv->settings != NULL) {
+ g_object_unref (manager->priv->settings);
+ manager->priv->settings = NULL;
}
if (manager->priv->timeout) {
diff --git a/plugins/typing-break/msd-typing-break-manager.c b/plugins/typing-break/msd-typing-break-manager.c
index 113f6be..c3b21bf 100644
--- a/plugins/typing-break/msd-typing-break-manager.c
+++ b/plugins/typing-break/msd-typing-break-manager.c
@@ -36,14 +36,14 @@
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
-#include <mateconf/mateconf-client.h>
+#include <gio/gio.h>
#include "mate-settings-profile.h"
#include "msd-typing-break-manager.h"
#define MSD_TYPING_BREAK_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), MSD_TYPE_TYPING_BREAK_MANAGER, MsdTypingBreakManagerPrivate))
-#define MATECONF_BREAK_DIR "/desktop/mate/typing_break"
+#define MATE_BREAK_SCHEMA "org.mate.typing-break"
struct MsdTypingBreakManagerPrivate
{
@@ -51,7 +51,7 @@ struct MsdTypingBreakManagerPrivate
guint typing_monitor_idle_id;
guint child_watch_id;
guint setup_id;
- guint notify;
+ GSettings *settings;
};
static void msd_typing_break_manager_class_init (MsdTypingBreakManagerClass *klass);
@@ -137,16 +137,11 @@ setup_typing_break (MsdTypingBreakManager *manager,
}
static void
-typing_break_callback (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
- MsdTypingBreakManager *manager)
+typing_break_enabled_callback (GSettings *settings,
+ gchar *key,
+ MsdTypingBreakManager *manager)
{
- if (! strcmp (entry->key, "/desktop/mate/typing_break/enabled")) {
- if (entry->value->type == MATECONF_VALUE_BOOL) {
- setup_typing_break (manager, mateconf_value_get_bool (entry->value));
- }
- }
+ setup_typing_break (manager, g_settings_get_boolean (settings, key));
}
static gboolean
@@ -161,23 +156,20 @@ gboolean
msd_typing_break_manager_start (MsdTypingBreakManager *manager,
GError **error)
{
- MateConfClient *client;
gboolean enabled;
g_debug ("Starting typing_break manager");
mate_settings_profile_start (NULL);
- client = mateconf_client_get_default ();
+ manager->priv->settings = g_settings_new (MATE_BREAK_SCHEMA);
+
+ g_signal_connect (manager->priv->settings,
+ "changed::enabled",
+ G_CALLBACK (typing_break_enabled_callback),
+ manager);
- mateconf_client_add_dir (client, MATECONF_BREAK_DIR, MATECONF_CLIENT_PRELOAD_ONELEVEL, NULL);
- manager->priv->notify =
- mateconf_client_notify_add (client,
- MATECONF_BREAK_DIR,
- (MateConfClientNotifyFunc) typing_break_callback, manager,
- NULL, NULL);
+ enabled = g_settings_get_boolean (manager->priv->settings, "enabled");
- enabled = mateconf_client_get_bool (client, MATECONF_BREAK_DIR "/enabled", NULL);
- g_object_unref (client);
if (enabled) {
manager->priv->setup_id =
g_timeout_add_seconds (3,
@@ -218,12 +210,8 @@ msd_typing_break_manager_stop (MsdTypingBreakManager *manager)
p->typing_monitor_pid = 0;
}
- if (p->notify != 0) {
- MateConfClient *client = mateconf_client_get_default ();
- mateconf_client_remove_dir (client, MATECONF_BREAK_DIR, NULL);
- mateconf_client_notify_remove (client, p->notify);
- g_object_unref (client);
- p->notify = 0;
+ if (p->settings != NULL) {
+ g_object_unref (p->settings);
}
}
diff --git a/plugins/xrandr/msd-xrandr-manager.c b/plugins/xrandr/msd-xrandr-manager.c
index 7d8d7f5..71d1af5 100644
--- a/plugins/xrandr/msd-xrandr-manager.c
+++ b/plugins/xrandr/msd-xrandr-manager.c
@@ -37,7 +37,7 @@
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
-#include <mateconf/mateconf-client.h>
+#include <gio/gio.h>
#include <dbus/dbus-glib.h>
#define MATE_DESKTOP_USE_UNSTABLE_API
@@ -59,12 +59,12 @@
#define MSD_XRANDR_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), MSD_TYPE_XRANDR_MANAGER, MsdXrandrManagerPrivate))
-#define CONF_DIR "/apps/mate_settings_daemon/xrandr"
-#define CONF_KEY_SHOW_NOTIFICATION_ICON (CONF_DIR "/show_notification_icon")
-#define CONF_KEY_USE_XORG_MONITOR_SETTINGS (CONF_DIR "/use_xorg_monitor_settings")
-#define CONF_KEY_TURN_ON_EXTERNAL_MONITORS_AT_STARTUP (CONF_DIR "/turn_on_external_monitors_at_startup")
-#define CONF_KEY_TURN_ON_LAPTOP_MONITOR_AT_STARTUP (CONF_DIR "/turn_on_laptop_monitor_at_startup")
-#define CONF_KEY_DEFAULT_CONFIGURATION_FILE (CONF_DIR "/default_configuration_file")
+#define CONF_SCHEMA "org.mate.SettingsDaemon.plugins.xrandr"
+#define CONF_KEY_SHOW_NOTIFICATION_ICON "show-notification-icon"
+#define CONF_KEY_USE_XORG_MONITOR_SETTINGS "use-xorg-monitor-settings"
+#define CONF_KEY_TURN_ON_EXTERNAL_MONITORS_AT_STARTUP "turn-on-external-monitors-at-startup"
+#define CONF_KEY_TURN_ON_LAPTOP_MONITOR_AT_STARTUP "turn-on-laptop-monitor-at-startup"
+#define CONF_KEY_DEFAULT_CONFIGURATION_FILE "default-configuration-file"
#define VIDEO_KEYSYM "XF86Display"
#define ROTATE_KEYSYM "XF86RotateWindows"
@@ -102,8 +102,7 @@ struct MsdXrandrManagerPrivate
GtkWidget *popup_menu;
MateRRConfig *configuration;
MateRRLabeler *labeler;
- MateConfClient *client;
- int notify_id;
+ GSettings *settings;
/* fn-F7 status */
int current_fn_f7_config; /* -1 if no configs */
@@ -2144,7 +2143,7 @@ status_icon_stop (MsdXrandrManager *manager)
static void
start_or_stop_icon (MsdXrandrManager *manager)
{
- if (mateconf_client_get_bool (manager->priv->client, CONF_KEY_SHOW_NOTIFICATION_ICON, NULL)) {
+ if (g_settings_get_boolean (manager->priv->settings, CONF_KEY_SHOW_NOTIFICATION_ICON)) {
status_icon_start (manager);
}
else {
@@ -2153,13 +2152,11 @@ start_or_stop_icon (MsdXrandrManager *manager)
}
static void
-on_config_changed (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
+on_config_changed (GSettings *settings,
+ gchar *key,
MsdXrandrManager *manager)
{
- if (strcmp (entry->key, CONF_KEY_SHOW_NOTIFICATION_ICON) == 0)
- start_or_stop_icon (manager);
+ start_or_stop_icon (manager);
}
static gboolean
@@ -2192,9 +2189,9 @@ apply_default_boot_configuration (MsdXrandrManager *mgr, guint32 timestamp)
gboolean turn_on_external, turn_on_laptop;
turn_on_external =
- mateconf_client_get_bool (mgr->priv->client, CONF_KEY_TURN_ON_EXTERNAL_MONITORS_AT_STARTUP, NULL);
+ g_settings_get_boolean (mgr->priv->settings, CONF_KEY_TURN_ON_EXTERNAL_MONITORS_AT_STARTUP);
turn_on_laptop =
- mateconf_client_get_bool (mgr->priv->client, CONF_KEY_TURN_ON_LAPTOP_MONITOR_AT_STARTUP, NULL);
+ g_settings_get_boolean (mgr->priv->settings, CONF_KEY_TURN_ON_LAPTOP_MONITOR_AT_STARTUP);
if (turn_on_external && turn_on_laptop)
config = make_clone_setup (screen);
@@ -2275,7 +2272,7 @@ apply_default_configuration_from_file (MsdXrandrManager *manager, guint32 timest
char *default_config_filename;
gboolean result;
- default_config_filename = mateconf_client_get_string (priv->client, CONF_KEY_DEFAULT_CONFIGURATION_FILE, NULL);
+ default_config_filename = g_settings_get_string (priv->settings, CONF_KEY_DEFAULT_CONFIGURATION_FILE);
if (!default_config_filename)
return FALSE;
@@ -2310,19 +2307,12 @@ msd_xrandr_manager_start (MsdXrandrManager *manager,
log_screen (manager->priv->rw_screen);
manager->priv->running = TRUE;
- manager->priv->client = mateconf_client_get_default ();
-
- g_assert (manager->priv->notify_id == 0);
-
- mateconf_client_add_dir (manager->priv->client, CONF_DIR,
- MATECONF_CLIENT_PRELOAD_ONELEVEL,
- NULL);
+ manager->priv->settings = g_settings_new (CONF_SCHEMA);
- manager->priv->notify_id =
- mateconf_client_notify_add (
- manager->priv->client, CONF_DIR,
- (MateConfClientNotifyFunc)on_config_changed,
- manager, NULL, NULL);
+ g_signal_connect (manager->priv->settings,
+ "changed::" CONF_KEY_SHOW_NOTIFICATION_ICON,
+ G_CALLBACK (on_config_changed),
+ manager);
if (manager->priv->switch_video_mode_keycode) {
gdk_error_trap_push ();
@@ -2351,7 +2341,7 @@ msd_xrandr_manager_start (MsdXrandrManager *manager,
show_timestamps_dialog (manager, "Startup");
if (!apply_stored_configuration_at_startup (manager, GDK_CURRENT_TIME)) /* we don't have a real timestamp at startup anyway */
if (!apply_default_configuration_from_file (manager, GDK_CURRENT_TIME))
- if (!mateconf_client_get_bool (manager->priv->client, CONF_KEY_USE_XORG_MONITOR_SETTINGS, NULL))
+ if (!g_settings_get_boolean (manager->priv->settings, CONF_KEY_USE_XORG_MONITOR_SETTINGS))
apply_default_boot_configuration (manager, GDK_CURRENT_TIME);
log_msg ("State of screen after initial configuration:\n");
@@ -2401,17 +2391,9 @@ msd_xrandr_manager_stop (MsdXrandrManager *manager)
(GdkFilterFunc) event_filter,
manager);
- if (manager->priv->notify_id != 0) {
- mateconf_client_remove_dir (manager->priv->client,
- CONF_DIR, NULL);
- mateconf_client_notify_remove (manager->priv->client,
- manager->priv->notify_id);
- manager->priv->notify_id = 0;
- }
-
- if (manager->priv->client != NULL) {
- g_object_unref (manager->priv->client);
- manager->priv->client = NULL;
+ if (manager->priv->settings != NULL) {
+ g_object_unref (manager->priv->settings);
+ manager->priv->settings = NULL;
}
if (manager->priv->rw_screen != NULL) {
diff --git a/plugins/xsettings/msd-xsettings-manager.c b/plugins/xsettings/msd-xsettings-manager.c
index 9df8f61..cadc0c6 100644
--- a/plugins/xsettings/msd-xsettings-manager.c
+++ b/plugins/xsettings/msd-xsettings-manager.c
@@ -37,8 +37,7 @@
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
-#include <mateconf/mateconf.h>
-#include <mateconf/mateconf-client.h>
+#include <gio/gio.h>
#include "mate-settings-profile.h"
#include "msd-xsettings-manager.h"
@@ -49,18 +48,16 @@
#define MATE_XSETTINGS_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), MATE_TYPE_XSETTINGS_MANAGER, MateXSettingsManagerPrivate))
-#define MOUSE_SETTINGS_DIR "/desktop/mate/peripherals/mouse"
-#define GTK_SETTINGS_DIR "/desktop/gtk"
-#define INTERFACE_SETTINGS_DIR "/desktop/mate/interface"
-#define SOUND_SETTINGS_DIR "/desktop/mate/sound"
-#define GTK_MODULES_DIR "/apps/mate_settings_daemon/gtk-modules"
+#define MOUSE_SCHEMA "org.mate.peripherals-mouse"
+#define INTERFACE_SCHEMA "org.mate.interface"
+#define SOUND_SCHEMA "org.mate.sound"
#ifdef HAVE_FONTCONFIG
-#define FONT_RENDER_DIR "/desktop/mate/font_rendering"
-#define FONT_ANTIALIASING_KEY FONT_RENDER_DIR "/antialiasing"
-#define FONT_HINTING_KEY FONT_RENDER_DIR "/hinting"
-#define FONT_RGBA_ORDER_KEY FONT_RENDER_DIR "/rgba_order"
-#define FONT_DPI_KEY FONT_RENDER_DIR "/dpi"
+#define FONT_RENDER_SCHEMA "org.mate.font-rendering"
+#define FONT_ANTIALIASING_KEY "antialiasing"
+#define FONT_HINTING_KEY "hinting"
+#define FONT_RGBA_ORDER_KEY "rgba-order"
+#define FONT_DPI_KEY "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
@@ -69,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_FALLBACK 96
@@ -79,22 +76,23 @@
#endif /* HAVE_FONTCONFIG */
typedef struct _TranslationEntry TranslationEntry;
-typedef void (* TranslationFunc) (MateXSettingsManager *manager,
+typedef void (* TranslationFunc) (MateXSettingsManager *manager,
TranslationEntry *trans,
- MateConfValue *value);
+ GVariant *value);
struct _TranslationEntry {
- const char *mateconf_key;
+ const char *gsettings_schema;
+ const char *gsettings_key;
const char *xsetting_name;
- MateConfValueType mateconf_type;
TranslationFunc translate;
};
struct MateXSettingsManagerPrivate
{
XSettingsManager **managers;
- guint notify[6];
+ GHashTable *gsettings;
+ GSettings *gsettings_font;
#ifdef HAVE_FONTCONFIG
fontconfig_monitor_handle_t *fontconfig_handle;
#endif /* HAVE_FONTCONFIG */
@@ -121,65 +119,57 @@ msd_xsettings_error_quark (void)
}
static void
-translate_bool_int (MateXSettingsManager *manager,
+translate_bool_int (MateXSettingsManager *manager,
TranslationEntry *trans,
- MateConfValue *value)
+ GVariant *value)
{
int i;
- g_assert (value->type == trans->mateconf_type);
-
for (i = 0; manager->priv->managers [i]; i++) {
xsettings_manager_set_int (manager->priv->managers [i], trans->xsetting_name,
- mateconf_value_get_bool (value));
+ g_variant_get_boolean (value));
}
}
static void
-translate_int_int (MateXSettingsManager *manager,
+translate_int_int (MateXSettingsManager *manager,
TranslationEntry *trans,
- MateConfValue *value)
+ GVariant *value)
{
int i;
- g_assert (value->type == trans->mateconf_type);
-
for (i = 0; manager->priv->managers [i]; i++) {
xsettings_manager_set_int (manager->priv->managers [i], trans->xsetting_name,
- mateconf_value_get_int (value));
+ g_variant_get_int32 (value));
}
}
static void
-translate_string_string (MateXSettingsManager *manager,
+translate_string_string (MateXSettingsManager *manager,
TranslationEntry *trans,
- MateConfValue *value)
+ GVariant *value)
{
int i;
- g_assert (value->type == trans->mateconf_type);
-
for (i = 0; manager->priv->managers [i]; i++) {
xsettings_manager_set_string (manager->priv->managers [i],
trans->xsetting_name,
- mateconf_value_get_string (value));
+ g_variant_get_string (value, NULL));
}
}
static void
-translate_string_string_toolbar (MateXSettingsManager *manager,
+translate_string_string_toolbar (MateXSettingsManager *manager,
TranslationEntry *trans,
- MateConfValue *value)
+ GVariant *value)
{
int i;
const char *tmp;
- g_assert (value->type == trans->mateconf_type);
-
- /* This is kind of a workaround since MATE expects the key value to be
+ /* This is kind of a workaround since GNOME expects the key value to be
* "both_horiz" and gtk+ wants the XSetting to be "both-horiz".
*/
- tmp = mateconf_value_get_string (value);
+ tmp = g_variant_get_string (value, NULL);
if (tmp && strcmp (tmp, "both_horiz") == 0) {
tmp = "both-horiz";
}
@@ -192,33 +182,34 @@ translate_string_string_toolbar (MateXSettingsManager *manager,
}
static TranslationEntry translations [] = {
- { "/desktop/mate/peripherals/mouse/double_click", "Net/DoubleClickTime", MATECONF_VALUE_INT, translate_int_int },
- { "/desktop/mate/peripherals/mouse/drag_threshold", "Net/DndDragThreshold", MATECONF_VALUE_INT, translate_int_int },
- { "/desktop/mate/gtk-color-palette", "Gtk/ColorPalette", MATECONF_VALUE_STRING, translate_string_string },
- { "/desktop/mate/interface/font_name", "Gtk/FontName", MATECONF_VALUE_STRING, translate_string_string },
- { "/desktop/mate/interface/gtk_key_theme", "Gtk/KeyThemeName", MATECONF_VALUE_STRING, translate_string_string },
- { "/desktop/mate/interface/toolbar_style", "Gtk/ToolbarStyle", MATECONF_VALUE_STRING, translate_string_string_toolbar },
- { "/desktop/mate/interface/toolbar_icons_size", "Gtk/ToolbarIconSize", MATECONF_VALUE_STRING, translate_string_string },
- { "/desktop/mate/interface/can_change_accels", "Gtk/CanChangeAccels", MATECONF_VALUE_BOOL, translate_bool_int },
- { "/desktop/mate/interface/cursor_blink", "Net/CursorBlink", MATECONF_VALUE_BOOL, translate_bool_int },
- { "/desktop/mate/interface/cursor_blink_time", "Net/CursorBlinkTime", MATECONF_VALUE_INT, translate_int_int },
- { "/desktop/mate/interface/gtk_theme", "Net/ThemeName", MATECONF_VALUE_STRING, translate_string_string },
- { "/desktop/mate/interface/gtk_color_scheme", "Gtk/ColorScheme", MATECONF_VALUE_STRING, translate_string_string },
- { "/desktop/mate/interface/gtk-im-preedit-style", "Gtk/IMPreeditStyle", MATECONF_VALUE_STRING, translate_string_string },
- { "/desktop/mate/interface/gtk-im-status-style", "Gtk/IMStatusStyle", MATECONF_VALUE_STRING, translate_string_string },
- { "/desktop/mate/interface/gtk-im-module", "Gtk/IMModule", MATECONF_VALUE_STRING, translate_string_string },
- { "/desktop/mate/interface/icon_theme", "Net/IconThemeName", MATECONF_VALUE_STRING, translate_string_string },
- { "/desktop/mate/interface/file_chooser_backend", "Gtk/FileChooserBackend", MATECONF_VALUE_STRING, translate_string_string },
- { "/desktop/mate/interface/menus_have_icons", "Gtk/MenuImages", MATECONF_VALUE_BOOL, translate_bool_int },
- { "/desktop/mate/interface/buttons_have_icons", "Gtk/ButtonImages", MATECONF_VALUE_BOOL, translate_bool_int },
- { "/desktop/mate/interface/menubar_accel", "Gtk/MenuBarAccel", MATECONF_VALUE_STRING, translate_string_string },
- { "/desktop/mate/peripherals/mouse/cursor_theme", "Gtk/CursorThemeName", MATECONF_VALUE_STRING, translate_string_string },
- { "/desktop/mate/peripherals/mouse/cursor_size", "Gtk/CursorThemeSize", MATECONF_VALUE_INT, translate_int_int },
- { "/desktop/mate/interface/show_input_method_menu", "Gtk/ShowInputMethodMenu", MATECONF_VALUE_BOOL, translate_bool_int },
- { "/desktop/mate/interface/show_unicode_menu", "Gtk/ShowUnicodeMenu", MATECONF_VALUE_BOOL, translate_bool_int },
- { "/desktop/mate/sound/theme_name", "Net/SoundThemeName", MATECONF_VALUE_STRING, translate_string_string },
- { "/desktop/mate/sound/event_sounds", "Net/EnableEventSounds" , MATECONF_VALUE_BOOL, translate_bool_int },
- { "/desktop/mate/sound/input_feedback_sounds", "Net/EnableInputFeedbackSounds", MATECONF_VALUE_BOOL, translate_bool_int }
+ { MOUSE_SCHEMA, "double-click", "Net/DoubleClickTime", translate_int_int },
+ { MOUSE_SCHEMA, "drag-threshold", "Net/DndDragThreshold", translate_int_int },
+ { MOUSE_SCHEMA, "cursor-theme", "Gtk/CursorThemeName", translate_string_string },
+ { MOUSE_SCHEMA, "cursor-size", "Gtk/CursorThemeSize", translate_int_int },
+
+ { INTERFACE_SCHEMA, "font-name", "Gtk/FontName", translate_string_string },
+ { INTERFACE_SCHEMA, "gtk-key-theme", "Gtk/KeyThemeName", translate_string_string },
+ { INTERFACE_SCHEMA, "toolbar-style", "Gtk/ToolbarStyle", translate_string_string_toolbar },
+ { INTERFACE_SCHEMA, "toolbar-icons-size", "Gtk/ToolbarIconSize", translate_string_string },
+ { INTERFACE_SCHEMA, "can-change-accels", "Gtk/CanChangeAccels", translate_bool_int },
+ { INTERFACE_SCHEMA, "cursor-blink", "Net/CursorBlink", translate_bool_int },
+ { INTERFACE_SCHEMA, "cursor-blink-time", "Net/CursorBlinkTime", translate_int_int },
+ { INTERFACE_SCHEMA, "gtk-theme", "Net/ThemeName", translate_string_string },
+ { INTERFACE_SCHEMA, "gtk-color-scheme", "Gtk/ColorScheme", translate_string_string },
+ { INTERFACE_SCHEMA, "gtk-im-preedit-style", "Gtk/IMPreeditStyle", translate_string_string },
+ { INTERFACE_SCHEMA, "gtk-im-status-style", "Gtk/IMStatusStyle", translate_string_string },
+ { INTERFACE_SCHEMA, "gtk-im-module", "Gtk/IMModule", translate_string_string },
+ { INTERFACE_SCHEMA, "icon-theme", "Net/IconThemeName", translate_string_string },
+ { INTERFACE_SCHEMA, "file-chooser-backend", "Gtk/FileChooserBackend", translate_string_string },
+ { INTERFACE_SCHEMA, "menus-have-icons", "Gtk/MenuImages", translate_bool_int },
+ { INTERFACE_SCHEMA, "buttons-have-icons", "Gtk/ButtonImages", translate_bool_int },
+ { INTERFACE_SCHEMA, "menubar-accel", "Gtk/MenuBarAccel", translate_string_string },
+ { INTERFACE_SCHEMA, "show-input-method-menu", "Gtk/ShowInputMethodMenu", translate_bool_int },
+ { INTERFACE_SCHEMA, "show-unicode-menu", "Gtk/ShowUnicodeMenu", translate_bool_int },
+
+ { SOUND_SCHEMA, "theme-name", "Net/SoundThemeName", translate_string_string },
+ { SOUND_SCHEMA, "event-sounds", "Net/EnableEventSounds" , translate_bool_int },
+ { SOUND_SCHEMA, "input-feedback-sounds", "Net/EnableInputFeedbackSounds", translate_bool_int }
};
#ifdef HAVE_FONTCONFIG
@@ -265,22 +256,21 @@ get_dpi_from_x_server (void)
}
static double
-get_dpi_from_mateconf_or_x_server (MateConfClient *client)
+get_dpi_from_gsettings_or_x_server (GSettings *gsettings)
{
- MateConfValue *value;
- double dpi;
+ double value;
+ double dpi;
- value = mateconf_client_get_without_default (client, FONT_DPI_KEY, NULL);
+ value = g_settings_get_double (gsettings, FONT_DPI_KEY);
- /* If the user has ever set the DPI preference in MateConf, we use that.
+ /* If the user has ever set the DPI preference in GSettings, we use that.
* Otherwise, we see if the X server reports a reasonable DPI value: some X
* servers report completely bogus values, and the user gets huge or tiny
* fonts which are unusable.
*/
- if (value != NULL) {
- dpi = mateconf_value_get_float (value);
- mateconf_value_free (value);
+ if (value != 0) {
+ dpi = value;
} else {
dpi = get_dpi_from_x_server ();
}
@@ -299,11 +289,11 @@ typedef struct
static const char *rgba_types[] = { "rgb", "bgr", "vbgr", "vrgb" };
-/* Read MateConf settings and determine the appropriate Xft settings based on them
- * This probably could be done a bit more cleanly with mateconf_string_to_enum
+/* Read GSettings values and determine the appropriate Xft settings based on them
+ * This probably could be done a bit more cleanly with g_settings_get_enum
*/
static void
-xft_settings_get (MateConfClient *client,
+xft_settings_get (GSettings *gsettings,
MateXftSettings *settings)
{
char *antialiasing;
@@ -311,10 +301,10 @@ xft_settings_get (MateConfClient *client,
char *rgba_order;
double dpi;
- antialiasing = mateconf_client_get_string (client, FONT_ANTIALIASING_KEY, NULL);
- hinting = mateconf_client_get_string (client, FONT_HINTING_KEY, NULL);
- rgba_order = mateconf_client_get_string (client, FONT_RGBA_ORDER_KEY, NULL);
- dpi = get_dpi_from_mateconf_or_x_server (client);
+ antialiasing = g_settings_get_string (gsettings, FONT_ANTIALIASING_KEY);
+ hinting = g_settings_get_string (gsettings, FONT_HINTING_KEY);
+ rgba_order = g_settings_get_string (gsettings, FONT_RGBA_ORDER_KEY);
+ dpi = get_dpi_from_gsettings_or_x_server (gsettings);
settings->antialias = TRUE;
settings->hinting = TRUE;
@@ -474,13 +464,13 @@ xft_settings_set_xresources (MateXftSettings *settings)
*/
static void
update_xft_settings (MateXSettingsManager *manager,
- MateConfClient *client)
+ GSettings *gsettings)
{
MateXftSettings settings;
mate_settings_profile_start (NULL);
- xft_settings_get (client, &settings);
+ xft_settings_get (gsettings, &settings);
xft_settings_set_xsettings (manager, &settings);
xft_settings_set_xresources (&settings);
@@ -488,14 +478,13 @@ update_xft_settings (MateXSettingsManager *manager,
}
static void
-xft_callback (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
+xft_callback (GSettings *gsettings,
+ gchar *key,
MateXSettingsManager *manager)
{
int i;
- update_xft_settings (manager, client);
+ update_xft_settings (manager, gsettings);
for (i = 0; manager->priv->managers [i]; i++) {
xsettings_manager_notify (manager->priv->managers [i]);
@@ -552,84 +541,54 @@ stop_fontconfig_monitor (MateXSettingsManager *manager)
}
#endif /* HAVE_FONTCONFIG */
-static const char *
-type_to_string (MateConfValueType type)
-{
- switch (type) {
- case MATECONF_VALUE_INT:
- return "int";
- case MATECONF_VALUE_STRING:
- return "string";
- case MATECONF_VALUE_FLOAT:
- return "float";
- case MATECONF_VALUE_BOOL:
- return "bool";
- case MATECONF_VALUE_SCHEMA:
- return "schema";
- case MATECONF_VALUE_LIST:
- return "list";
- case MATECONF_VALUE_PAIR:
- return "pair";
- case MATECONF_VALUE_INVALID:
- return "*invalid*";
- default:
- g_assert_not_reached();
- return NULL; /* for warnings */
- }
-}
-
static void
process_value (MateXSettingsManager *manager,
- TranslationEntry *trans,
- MateConfValue *val)
+ TranslationEntry *trans,
+ GVariant *value)
{
- if (val == NULL) {
- int i;
-
- for (i = 0; manager->priv->managers [i]; i++) {
- xsettings_manager_delete_setting (manager->priv->managers [i], trans->xsetting_name);
- }
- } else {
- if (val->type == trans->mateconf_type) {
- (* trans->translate) (manager, trans, val);
- } else {
- g_warning (_("MateConf key %s set to type %s but its expected type was %s\n"),
- trans->mateconf_key,
- type_to_string (val->type),
- type_to_string (trans->mateconf_type));
- }
- }
+ (* trans->translate) (manager, trans, value);
}
static TranslationEntry *
-find_translation_entry (const char *mateconf_key)
+find_translation_entry (GSettings *gsettings, const char *key)
{
- int i;
+ guint i;
+ char *schema;
+
+ g_object_get (gsettings, "schema", &schema, NULL);
- for (i = 0; i < G_N_ELEMENTS (translations); ++i) {
- if (strcmp (translations[i].mateconf_key, mateconf_key) == 0) {
+ for (i = 0; i < G_N_ELEMENTS (translations); i++) {
+ if (g_str_equal (schema, translations[i].gsettings_schema) &&
+ g_str_equal (key, translations[i].gsettings_key)) {
+ g_free (schema);
return &translations[i];
}
}
+ g_free (schema);
+
return NULL;
}
static void
-xsettings_callback (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
- MateXSettingsManager *manager)
+xsettings_callback (GSettings *gsettings,
+ const char *key,
+ MateXSettingsManager *manager)
{
TranslationEntry *trans;
int i;
+ GVariant *value;
- trans = find_translation_entry (entry->key);
+ trans = find_translation_entry (gsettings, key);
if (trans == NULL) {
return;
}
- process_value (manager, trans, entry->value);
+ value = g_settings_get_value (gsettings, key);
+
+ process_value (manager, trans, value);
+
+ g_variant_unref (value);
for (i = 0; manager->priv->managers [i]; i++) {
xsettings_manager_set_string (manager->priv->managers [i],
@@ -642,101 +601,6 @@ xsettings_callback (MateConfClient *client,
}
}
-static gchar *
-get_gtk_modules (MateConfClient *client)
-{
- GSList *entries, *l;
- GString *mods = g_string_new (NULL);
-
- entries = mateconf_client_all_entries (client, GTK_MODULES_DIR, NULL);
-
- for (l = entries; l != NULL; l = g_slist_next (l)) {
- MateConfEntry *e = l->data;
- MateConfValue *v = mateconf_entry_get_value (e);
-
- if (v != NULL) {
- gboolean enabled = FALSE;
- const gchar *key;
-
- switch (v->type) {
- case MATECONF_VALUE_BOOL:
- /* simple enabled/disabled */
- enabled = mateconf_value_get_bool (v);
- break;
-
- /* due to limitations in MateConf (or the client libraries,
- * anyway), it is currently impossible to monitor
- * arbitrary keys for changes, so these won't update at
- * runtime */
- case MATECONF_VALUE_STRING:
- /* linked to another MateConf key of type bool */
- key = mateconf_value_get_string (v);
- if (key != NULL && mateconf_valid_key (key, NULL)) {
- enabled = mateconf_client_get_bool (client, key, NULL);
- }
- break;
-
- default:
- g_warning ("MateConf entry %s has invalid type %s",
- mateconf_entry_get_key (e), type_to_string (v->type));
- }
-
- if (enabled) {
- const gchar *name;
- name = strrchr (mateconf_entry_get_key (e), '/') + 1;
-
- if (mods->len > 0) {
- g_string_append_c (mods, ':');
- }
- g_string_append (mods, name);
- }
- }
-
- mateconf_entry_free (e);
- }
-
- g_slist_free (entries);
-
- return g_string_free (mods, mods->len == 0);
-}
-
-static void
-gtk_modules_callback (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
- MateXSettingsManager *manager)
-{
- gchar *modules = get_gtk_modules (client);
- int i;
-
- if (modules == NULL) {
- for (i = 0; manager->priv->managers [i]; ++i) {
- xsettings_manager_delete_setting (manager->priv->managers [i], "Gtk/Modules");
- }
- } else {
- g_debug ("Setting GTK modules '%s'", modules);
- for (i = 0; manager->priv->managers [i]; ++i) {
- xsettings_manager_set_string (manager->priv->managers [i],
- "Gtk/Modules",
- modules);
- }
- g_free (modules);
- }
-
- for (i = 0; manager->priv->managers [i]; ++i) {
- xsettings_manager_notify (manager->priv->managers [i]);
- }
-}
-
-static guint
-register_config_callback (MateXSettingsManager *manager,
- MateConfClient *client,
- const char *path,
- MateConfClientNotifyFunc func)
-{
- return mateconf_client_notify_add (client, path, func, manager, NULL, NULL);
-}
-
static void
terminate_cb (void *data)
{
@@ -795,8 +659,8 @@ gboolean
mate_xsettings_manager_start (MateXSettingsManager *manager,
GError **error)
{
- MateConfClient *client;
int i;
+ GList *list, *l;
g_debug ("Starting xsettings manager");
mate_settings_profile_start (NULL);
@@ -808,72 +672,43 @@ mate_xsettings_manager_start (MateXSettingsManager *manager,
return FALSE;
}
- client = mateconf_client_get_default ();
+ manager->priv->gsettings = g_hash_table_new_full (g_str_hash, g_str_equal,
+ NULL, (GDestroyNotify) g_object_unref);
- mateconf_client_add_dir (client, MOUSE_SETTINGS_DIR, MATECONF_CLIENT_PRELOAD_ONELEVEL, NULL);
- mateconf_client_add_dir (client, GTK_SETTINGS_DIR, MATECONF_CLIENT_PRELOAD_ONELEVEL, NULL);
- mateconf_client_add_dir (client, INTERFACE_SETTINGS_DIR, MATECONF_CLIENT_PRELOAD_ONELEVEL, NULL);
- mateconf_client_add_dir (client, SOUND_SETTINGS_DIR, MATECONF_CLIENT_PRELOAD_ONELEVEL, NULL);
- mateconf_client_add_dir (client, GTK_MODULES_DIR, MATECONF_CLIENT_PRELOAD_ONELEVEL, NULL);
- mateconf_client_add_dir (client, FONT_RENDER_DIR, MATECONF_CLIENT_PRELOAD_ONELEVEL, NULL);
+ g_hash_table_insert (manager->priv->gsettings,
+ MOUSE_SCHEMA, g_settings_new (MOUSE_SCHEMA));
+ g_hash_table_insert (manager->priv->gsettings,
+ INTERFACE_SCHEMA, g_settings_new (INTERFACE_SCHEMA));
+ g_hash_table_insert (manager->priv->gsettings,
+ SOUND_SCHEMA, g_settings_new (SOUND_SCHEMA));
for (i = 0; i < G_N_ELEMENTS (translations); i++) {
- MateConfValue *val;
- GError *err;
-
- err = NULL;
- val = mateconf_client_get (client,
- translations[i].mateconf_key,
- &err);
-
- if (err != NULL) {
- g_warning ("Error getting value for %s: %s",
- translations[i].mateconf_key,
- err->message);
- g_error_free (err);
- } else {
- process_value (manager, &translations[i], val);
- if (val != NULL) {
- mateconf_value_free (val);
- }
- }
+ GVariant *val;
+ GSettings *gsettings;
+
+ gsettings = g_hash_table_lookup (manager->priv->gsettings,
+ translations[i].gsettings_schema);
+
+ val = g_settings_get_value (gsettings, translations[i].gsettings_key);
+
+ process_value (manager, &translations[i], val);
+ g_variant_unref (val);
}
- manager->priv->notify[0] =
- register_config_callback (manager, client,
- MOUSE_SETTINGS_DIR,
- (MateConfClientNotifyFunc) xsettings_callback);
- manager->priv->notify[1] =
- register_config_callback (manager, client,
- GTK_SETTINGS_DIR,
- (MateConfClientNotifyFunc) xsettings_callback);
- manager->priv->notify[2] =
- register_config_callback (manager, client,
- INTERFACE_SETTINGS_DIR,
- (MateConfClientNotifyFunc) xsettings_callback);
- manager->priv->notify[3] =
- register_config_callback (manager, client,
- SOUND_SETTINGS_DIR,
- (MateConfClientNotifyFunc) xsettings_callback);
-
- manager->priv->notify[4] =
- register_config_callback (manager, client,
- GTK_MODULES_DIR,
- (MateConfClientNotifyFunc) gtk_modules_callback);
- gtk_modules_callback (client, 0, NULL, manager);
+ list = g_hash_table_get_values (manager->priv->gsettings);
+ for (l = list; l != NULL; l = l->next) {
+ g_signal_connect_object (G_OBJECT (l->data), "changed", G_CALLBACK (xsettings_callback), manager, 0);
+ }
+ g_list_free (list);
#ifdef HAVE_FONTCONFIG
- manager->priv->notify[5] =
- register_config_callback (manager, client,
- FONT_RENDER_DIR,
- (MateConfClientNotifyFunc) xft_callback);
- update_xft_settings (manager, client);
+ manager->priv->gsettings_font = g_settings_new (FONT_RENDER_SCHEMA);
+ g_signal_connect (manager->priv->gsettings_font, "changed", G_CALLBACK (xft_callback), manager);
+ update_xft_settings (manager, manager->priv->gsettings_font);
start_fontconfig_monitor (manager);
#endif /* HAVE_FONTCONFIG */
- g_object_unref (client);
-
for (i = 0; manager->priv->managers [i]; i++)
xsettings_manager_set_string (manager->priv->managers [i],
"Net/FallbackIconTheme",
@@ -883,7 +718,6 @@ mate_xsettings_manager_start (MateXSettingsManager *manager,
xsettings_manager_notify (manager->priv->managers [i]);
}
-
mate_settings_profile_end (NULL);
return TRUE;
@@ -893,7 +727,6 @@ void
mate_xsettings_manager_stop (MateXSettingsManager *manager)
{
MateXSettingsManagerPrivate *p = manager->priv;
- MateConfClient *client;
int i;
g_debug ("Stopping xsettings manager");
@@ -906,27 +739,20 @@ mate_xsettings_manager_stop (MateXSettingsManager *manager)
p->managers = NULL;
}
- client = mateconf_client_get_default ();
+ if (p->gsettings != NULL) {
+ g_hash_table_destroy (p->gsettings);
+ p->gsettings = NULL;
+ }
- mateconf_client_remove_dir (client, MOUSE_SETTINGS_DIR, NULL);
- mateconf_client_remove_dir (client, GTK_SETTINGS_DIR, NULL);
- mateconf_client_remove_dir (client, INTERFACE_SETTINGS_DIR, NULL);
- mateconf_client_remove_dir (client, SOUND_SETTINGS_DIR, NULL);
- mateconf_client_remove_dir (client, GTK_MODULES_DIR, NULL);
#ifdef HAVE_FONTCONFIG
- mateconf_client_remove_dir (client, FONT_RENDER_DIR, NULL);
+ if (p->gsettings_font != NULL) {
+ g_object_unref (p->gsettings_font);
+ p->gsettings_font = NULL;
+ }
stop_fontconfig_monitor (manager);
#endif /* HAVE_FONTCONFIG */
- for (i = 0; i < G_N_ELEMENTS (p->notify); ++i) {
- if (p->notify[i] != 0) {
- mateconf_client_notify_remove (client, p->notify[i]);
- p->notify[i] = 0;
- }
- }
-
- g_object_unref (client);
}
static void