diff options
Diffstat (limited to 'capplets')
-rw-r--r-- | capplets/keyboard/mate-keyboard-properties-a11y.c | 287 | ||||
-rw-r--r-- | capplets/keyboard/mate-keyboard-properties-a11y.h | 4 | ||||
-rw-r--r-- | capplets/keyboard/mate-keyboard-properties-dialog.ui | 16 | ||||
-rw-r--r-- | capplets/keyboard/mate-keyboard-properties-xkb.c | 130 | ||||
-rw-r--r-- | capplets/keyboard/mate-keyboard-properties-xkb.h | 25 | ||||
-rw-r--r-- | capplets/keyboard/mate-keyboard-properties-xkblt.c | 55 | ||||
-rw-r--r-- | capplets/keyboard/mate-keyboard-properties-xkbltadd.c | 38 | ||||
-rw-r--r-- | capplets/keyboard/mate-keyboard-properties-xkbmc.c | 10 | ||||
-rw-r--r-- | capplets/keyboard/mate-keyboard-properties-xkbot.c | 51 | ||||
-rw-r--r-- | capplets/keyboard/mate-keyboard-properties.c | 170 |
10 files changed, 413 insertions, 373 deletions
diff --git a/capplets/keyboard/mate-keyboard-properties-a11y.c b/capplets/keyboard/mate-keyboard-properties-a11y.c index 3405ffa7..62701a60 100644 --- a/capplets/keyboard/mate-keyboard-properties-a11y.c +++ b/capplets/keyboard/mate-keyboard-properties-a11y.c @@ -25,14 +25,23 @@ #endif #include "mate-keyboard-properties-a11y.h" -#include <mateconf/mateconf-client.h> -#include "mateconf-property-editor.h" +#include <gio/gio.h> #include "capplet-util.h" -#define CONFIG_ROOT "/desktop/mate/accessibility/keyboard" #define NWID(s) GTK_WIDGET (gtk_builder_get_object (notifications_dialog, s)) +#define A11Y_SCHEMA "org.mate.accessibility-keyboard" +#define MARCO_SCHEMA "org.mate.Marco.general" + static GtkBuilder *notifications_dialog = NULL; +static GSettings *a11y_settings = NULL; + +enum +{ + VISUAL_BELL_TYPE_INVALID, + VISUAL_BELL_TYPE_FULLSCREEN, + VISUAL_BELL_TYPE_FRAME_FLASH +}; static void stickykeys_enable_toggled_cb (GtkWidget *w, GtkBuilder *dialog) @@ -75,42 +84,37 @@ visual_bell_enable_toggled_cb (GtkWidget *w, GtkBuilder *dialog) } } -static MateConfEnumStringPair bell_flash_enums[] = { - { 0, "frame_flash" }, - { 1, "fullscreen" }, - { -1, NULL } -}; - -static MateConfValue * -bell_flash_from_widget (MateConfPropertyEditor *peditor, const MateConfValue *value) +static void +bell_flash_gsettings_changed (GSettings *settings, gchar *key, GtkBuilder *dialog) { - MateConfValue *new_value; - - new_value = mateconf_value_new (MATECONF_VALUE_STRING); - mateconf_value_set_string (new_value, - mateconf_enum_to_string (bell_flash_enums, mateconf_value_get_int (value))); - - return new_value; + int bell_flash_type = g_settings_get_enum (settings, key); + if (bell_flash_type == VISUAL_BELL_TYPE_FULLSCREEN) + { + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (NWID ("visual_bell_fullscreen")), TRUE); + } + else if (bell_flash_type == VISUAL_BELL_TYPE_FRAME_FLASH) + { + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (NWID ("visual_bell_titlebar")), TRUE); + } } -static MateConfValue * -bell_flash_to_widget (MateConfPropertyEditor *peditor, const MateConfValue *value) +static void +bell_flash_radio_changed (GtkWidget *widget, GtkBuilder *builder) { - MateConfValue *new_value; - const gchar *str; - gint val = 2; + GSettings *marco_settings; + marco_settings = g_settings_new (MARCO_SCHEMA); + int old_bell_flash_type = g_settings_get_enum (marco_settings, "visual-bell-type"); + int new_bell_flash_type = VISUAL_BELL_TYPE_INVALID; - str = (value && (value->type == MATECONF_VALUE_STRING)) ? mateconf_value_get_string (value) : NULL; + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (NWID ("visual_bell_fullscreen")))) + new_bell_flash_type = VISUAL_BELL_TYPE_FULLSCREEN; + else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (NWID ("visual_bell_titlebar")))) + new_bell_flash_type = VISUAL_BELL_TYPE_FRAME_FLASH; - new_value = mateconf_value_new (MATECONF_VALUE_INT); - if (value->type == MATECONF_VALUE_STRING) { - mateconf_string_to_enum (bell_flash_enums, - str, - &val); - } - mateconf_value_set_int (new_value, val); + if (old_bell_flash_type != new_bell_flash_type) + g_settings_set_enum (marco_settings, "visual-bell-type", new_bell_flash_type); - return new_value; + g_object_unref (marco_settings); } static void @@ -138,54 +142,44 @@ notifications_button_clicked_cb (GtkWidget *button, GtkBuilder *dialog) bouncekeys_enable_toggled_cb (WID ("bouncekeys_enable"), dialog); w = NWID ("feature_state_change_beep"); - mateconf_peditor_new_boolean (NULL, - CONFIG_ROOT "/feature_state_change_beep", - w, NULL); + g_settings_bind (a11y_settings, "feature-state-change-beep", w, "active", G_SETTINGS_BIND_DEFAULT); w = NWID ("togglekeys_enable"); - mateconf_peditor_new_boolean (NULL, - CONFIG_ROOT "/togglekeys_enable", - w, NULL); + g_settings_bind (a11y_settings, "togglekeys_-enable", w, "active", G_SETTINGS_BIND_DEFAULT); w = NWID ("stickykeys_modifier_beep"); - mateconf_peditor_new_boolean (NULL, - CONFIG_ROOT "/stickykeys_modifier_beep", - w, NULL); + g_settings_bind (a11y_settings, "stickykeys-modifier-beep", w, "active", G_SETTINGS_BIND_DEFAULT); w = NWID ("slowkeys_beep_press"); - mateconf_peditor_new_boolean (NULL, - CONFIG_ROOT "/slowkeys_beep_press", - w, NULL); + g_settings_bind (a11y_settings, "slowkeys-beep-press", w, "active", G_SETTINGS_BIND_DEFAULT); w = NWID ("slowkeys_beep_accept"); - mateconf_peditor_new_boolean (NULL, - CONFIG_ROOT "/slowkeys_beep_accept", - w, NULL); + g_settings_bind (a11y_settings, "slowkeys-beep-accept", w, "active", G_SETTINGS_BIND_DEFAULT); w = NWID ("slowkeys_beep_reject"); - mateconf_peditor_new_boolean (NULL, - CONFIG_ROOT "/slowkeys_beep_reject", - w, NULL); + g_settings_bind (a11y_settings, "slowkeys-beep-reject", w, "active", G_SETTINGS_BIND_DEFAULT); w = NWID ("bouncekeys_beep_reject"); - mateconf_peditor_new_boolean (NULL, - CONFIG_ROOT "/bouncekeys_beep_reject", - w, NULL); + g_settings_bind (a11y_settings, "bouncekeys-beep-reject", w, "active", G_SETTINGS_BIND_DEFAULT); + GSettings *marco_settings = g_settings_new (MARCO_SCHEMA); w = NWID ("visual_bell_enable"); - mateconf_peditor_new_boolean (NULL, - "/apps/marco/general/visual_bell", - w, NULL); - g_signal_connect (w, "toggled", - G_CALLBACK (visual_bell_enable_toggled_cb), dialog); - visual_bell_enable_toggled_cb (w, dialog); - - mateconf_peditor_new_select_radio (NULL, - "/apps/marco/general/visual_bell_type", - gtk_radio_button_get_group (GTK_RADIO_BUTTON (NWID ("visual_bell_titlebar"))), - "conv-to-widget-cb", bell_flash_to_widget, - "conv-from-widget-cb", bell_flash_from_widget, - NULL); + g_settings_bind (marco_settings, "visual-bell", w, "active", G_SETTINGS_BIND_DEFAULT); + g_signal_connect (w, "toggled", + G_CALLBACK (visual_bell_enable_toggled_cb), dialog); + visual_bell_enable_toggled_cb (w, dialog); + + bell_flash_gsettings_changed (marco_settings, "visual-bell-type", NULL); + g_signal_connect (NWID ("visual_bell_titlebar"), "clicked", + G_CALLBACK(bell_flash_radio_changed), + notifications_dialog); + g_signal_connect (NWID ("visual_bell_fullscreen"), "clicked", + G_CALLBACK(bell_flash_radio_changed), + notifications_dialog); + g_signal_connect (marco_settings, + "changed::visual-bell-type", + G_CALLBACK (bell_flash_gsettings_changed), + notifications_dialog); w = NWID ("a11y_notifications_dialog"); gtk_window_set_transient_for (GTK_WINDOW (w), @@ -195,6 +189,7 @@ notifications_button_clicked_cb (GtkWidget *button, GtkBuilder *dialog) gtk_dialog_run (GTK_DIALOG (w)); + g_object_unref (marco_settings); g_object_unref (notifications_dialog); notifications_dialog = NULL; } @@ -206,95 +201,71 @@ mousekeys_enable_toggled_cb (GtkWidget *w, GtkBuilder *dialog) gtk_widget_set_sensitive (WID ("mousekeys_table"), active); } -static MateConfValue * -mousekeys_accel_time_to_widget (MateConfPropertyEditor *peditor, const MateConfValue *value) -{ - GtkAdjustment *adjustment; - gdouble range_upper; - MateConfValue *new_value; - - adjustment = GTK_ADJUSTMENT (mateconf_property_editor_get_ui_control (peditor)); - g_object_get (adjustment, - "upper", &range_upper, - NULL); - - new_value = mateconf_value_new (MATECONF_VALUE_INT); - mateconf_value_set_int (new_value, MAX (0, ((int) range_upper) - mateconf_value_get_int (value))); - - return new_value; -} - -static MateConfValue * -mousekeys_accel_time_from_widget (MateConfPropertyEditor *peditor, const MateConfValue *value) +void +finalize_a11y_tabs (void) { - GtkAdjustment *adjustment; - gdouble range_value, range_upper; - MateConfValue *new_value; - - adjustment = GTK_ADJUSTMENT (mateconf_property_editor_get_ui_control (peditor)); - g_object_get (adjustment, - "value", &range_value, - "upper", &range_upper, - NULL); - - new_value = mateconf_value_new (MATECONF_VALUE_INT); - mateconf_value_set_int (new_value, (int) range_upper - range_value); - - return new_value; + g_object_unref (a11y_settings); } void -setup_a11y_tabs (GtkBuilder *dialog, MateConfChangeSet *changeset) +setup_a11y_tabs (GtkBuilder *dialog) { - MateConfClient *client; GtkWidget *w; - client = mateconf_client_get_default (); - mateconf_client_add_dir (client, CONFIG_ROOT, MATECONF_CLIENT_PRELOAD_ONELEVEL, NULL); - g_object_unref (client); + a11y_settings = g_settings_new (A11Y_SCHEMA); /* Accessibility tab */ - - w = WID ("master_enable"); - mateconf_peditor_new_boolean (changeset, - CONFIG_ROOT "/enable", - w, NULL); - + g_settings_bind (a11y_settings, + "enable", + WID ("master_enable"), + "active", + G_SETTINGS_BIND_DEFAULT); w = WID ("stickykeys_enable"); - mateconf_peditor_new_boolean (changeset, - CONFIG_ROOT "/stickykeys_enable", - w, NULL); + g_settings_bind (a11y_settings, + "stickykeys-enable", + w, + "active", + G_SETTINGS_BIND_DEFAULT); g_signal_connect (w, "toggled", G_CALLBACK (stickykeys_enable_toggled_cb), dialog); stickykeys_enable_toggled_cb (w, dialog); - w = WID ("stickykeys_two_key_off"); - mateconf_peditor_new_boolean (changeset, - CONFIG_ROOT "/stickykeys_two_key_off", - w, NULL); + g_settings_bind (a11y_settings, + "stickykeys-two-key-off", + WID ("stickykeys_two_key_off"), + "active", + G_SETTINGS_BIND_DEFAULT); w = WID ("slowkeys_enable"); - mateconf_peditor_new_boolean (changeset, - CONFIG_ROOT "/slowkeys_enable", - w, NULL); + g_settings_bind (a11y_settings, + "slowkeys-enable", + w, + "active", + G_SETTINGS_BIND_DEFAULT); g_signal_connect (w, "toggled", G_CALLBACK (slowkeys_enable_toggled_cb), dialog); slowkeys_enable_toggled_cb (w, dialog); w = WID ("bouncekeys_enable"); - mateconf_peditor_new_boolean (changeset, - CONFIG_ROOT "/bouncekeys_enable", - w, NULL); + g_settings_bind (a11y_settings, + "bouncekeys-enable", + w, + "active", + G_SETTINGS_BIND_DEFAULT); g_signal_connect (w, "toggled", G_CALLBACK (bouncekeys_enable_toggled_cb), dialog); bouncekeys_enable_toggled_cb (w, dialog); - mateconf_peditor_new_numeric_range (changeset, - CONFIG_ROOT "/slowkeys_delay", - WID ("slowkeys_delay_slide"), NULL); - mateconf_peditor_new_numeric_range (changeset, - CONFIG_ROOT "/bouncekeys_delay", - WID ("bouncekeys_delay_slide"), NULL); + g_settings_bind (a11y_settings, + "slowkeys-delay", + gtk_range_get_adjustment (GTK_RANGE (WID ("slowkeys_delay_slide"))), + "value", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind (a11y_settings, + "bouncekeys-delay", + gtk_range_get_adjustment (GTK_RANGE (WID ("bouncekeys_delay_slide"))), + "value", + G_SETTINGS_BIND_DEFAULT); w = WID ("notifications_button"); g_signal_connect (w, "clicked", @@ -303,23 +274,49 @@ setup_a11y_tabs (GtkBuilder *dialog, MateConfChangeSet *changeset) /* Mouse Keys tab */ w = WID ("mousekeys_enable"); - mateconf_peditor_new_boolean (changeset, - CONFIG_ROOT "/mousekeys_enable", - w, NULL); + g_settings_bind (a11y_settings, + "mousekeys-enable", + w, + "active", + G_SETTINGS_BIND_DEFAULT); g_signal_connect (w, "toggled", G_CALLBACK (mousekeys_enable_toggled_cb), dialog); mousekeys_enable_toggled_cb (w, dialog); - mateconf_peditor_new_numeric_range (changeset, - CONFIG_ROOT "/mousekeys_accel_time", - WID ("mousekeys_accel_time_slide"), - "conv-to-widget-cb", mousekeys_accel_time_to_widget, - "conv-from-widget-cb", mousekeys_accel_time_from_widget, - NULL); - mateconf_peditor_new_numeric_range (changeset, - CONFIG_ROOT "/mousekeys_max_speed", - WID ("mousekeys_max_speed_slide"), NULL); - mateconf_peditor_new_numeric_range (changeset, - CONFIG_ROOT "/mousekeys_init_delay", - WID ("mousekeys_init_delay_slide"), NULL); + g_settings_bind (a11y_settings, + "slowkeys-delay", + gtk_range_get_adjustment (GTK_RANGE (WID ("slowkeys_delay_slide"))), + "value", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind (a11y_settings, + "bouncekeys-delay", + gtk_range_get_adjustment (GTK_RANGE (WID ("bouncekeys_delay_slide"))), + "value", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind (a11y_settings, + "slowkeys-delay", + gtk_range_get_adjustment (GTK_RANGE (WID ("slowkeys_delay_slide"))), + "value", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind (a11y_settings, + "bouncekeys-delay", + gtk_range_get_adjustment (GTK_RANGE (WID ("bouncekeys_delay_slide"))), + "value", + G_SETTINGS_BIND_DEFAULT); + + g_settings_bind (a11y_settings, + "mousekeys-accel-time", + gtk_range_get_adjustment (GTK_RANGE (WID ("mousekeys_accel_time_slide"))), + "value", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind (a11y_settings, + "mousekeys-max-speed", + gtk_range_get_adjustment (GTK_RANGE (WID ("mousekeys_max_speed_slide"))), + "value", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind (a11y_settings, + "mousekeys-init-delay", + gtk_range_get_adjustment (GTK_RANGE (WID ("mousekeys_init_delay_slide"))), + "value", + G_SETTINGS_BIND_DEFAULT); } diff --git a/capplets/keyboard/mate-keyboard-properties-a11y.h b/capplets/keyboard/mate-keyboard-properties-a11y.h index 3169b353..a535928c 100644 --- a/capplets/keyboard/mate-keyboard-properties-a11y.h +++ b/capplets/keyboard/mate-keyboard-properties-a11y.h @@ -24,9 +24,9 @@ #ifndef __MATE_KEYBOARD_PROPERTY_A11Y_H #define __MATE_KEYBOARD_PROPERTY_A11Y_H -#include <mateconf/mateconf-changeset.h> #include <gtk/gtk.h> -extern void setup_a11y_tabs (GtkBuilder * dialog, MateConfChangeSet * changeset); +extern void setup_a11y_tabs (GtkBuilder * dialog); +extern void finalize_a11y_tabs (void); #endif /* __MATE_KEYBOARD_PROPERTY_A11Y_H */ diff --git a/capplets/keyboard/mate-keyboard-properties-dialog.ui b/capplets/keyboard/mate-keyboard-properties-dialog.ui index 63c5e0af..4b5f7aa7 100644 --- a/capplets/keyboard/mate-keyboard-properties-dialog.ui +++ b/capplets/keyboard/mate-keyboard-properties-dialog.ui @@ -402,11 +402,11 @@ <property name="visible">True</property> <property name="spacing">6</property> <child> - <object class="GtkLabel" id="blink_slow_label"> + <object class="GtkLabel" id="blink_fast_label"> <property name="visible">True</property> <property name="xalign">1</property> <property name="xpad">10</property> - <property name="label" translatable="yes">Slow</property> + <property name="label" translatable="yes">Fast</property> <attributes> <attribute name="style" value="italic"/> <attribute name="scale" value="0.830000"/> @@ -436,10 +436,10 @@ </packing> </child> <child> - <object class="GtkLabel" id="blink_fast_label"> + <object class="GtkLabel" id="blink_slow_label"> <property name="visible">True</property> <property name="xalign">0</property> - <property name="label" translatable="yes">Fast</property> + <property name="label" translatable="yes">Slow</property> <attributes> <attribute name="style" value="italic"/> <attribute name="scale" value="0.830000"/> @@ -1317,10 +1317,10 @@ default settings</property> </packing> </child> <child> - <object class="GtkLabel" id="mousekeys_slow_label"> + <object class="GtkLabel" id="mousekeys_fast_label"> <property name="visible">True</property> <property name="xalign">1</property> - <property name="label" translatable="yes">Slow</property> + <property name="label" translatable="yes">Fast</property> <property name="justify">center</property> <attributes> <attribute name="style" value="italic"/> @@ -1387,10 +1387,10 @@ default settings</property> </packing> </child> <child> - <object class="GtkLabel" id="mousekeys_fast_label"> + <object class="GtkLabel" id="mousekeys_slow_label"> <property name="visible">True</property> <property name="xalign">0</property> - <property name="label" translatable="yes">Fast</property> + <property name="label" translatable="yes">Slow</property> <property name="justify">center</property> <attributes> <attribute name="style" value="italic"/> diff --git a/capplets/keyboard/mate-keyboard-properties-xkb.c b/capplets/keyboard/mate-keyboard-properties-xkb.c index 557bc279..c77459e8 100644 --- a/capplets/keyboard/mate-keyboard-properties-xkb.c +++ b/capplets/keyboard/mate-keyboard-properties-xkb.c @@ -27,23 +27,26 @@ #include <string.h> #include <gdk/gdkx.h> -#include <mateconf/mateconf-client.h> +#include <gio/gio.h> #include <glib/gi18n.h> #include "capplet-util.h" -#include "mateconf-property-editor.h" #include "mate-keyboard-properties-xkb.h" #include <libmatekbd/matekbd-desktop-config.h> +#define XKB_GENERAL_SCHEMA "org.mate.peripherals-keyboard-xkb.general" +#define XKB_KBD_SCHEMA "org.mate.peripherals-keyboard-xkb.kbd" + XklEngine *engine; XklConfigRegistry *config_registry; MatekbdKeyboardConfig initial_config; MatekbdDesktopConfig desktop_config; -MateConfClient *xkb_mateconf_client; +GSettings *xkb_general_settings; +GSettings *xkb_kbd_settings; char * xci_desc_to_utf8 (XklConfigItem * ci) @@ -53,19 +56,19 @@ xci_desc_to_utf8 (XklConfigItem * ci) } static void -set_model_text (GtkWidget * picker, MateConfValue * value) +set_model_text (GtkWidget * picker, gchar * value) { XklConfigItem *ci = xkl_config_item_new (); - const char *model = NULL; + char *model = NULL; - if (value != NULL && value->type == MATECONF_VALUE_STRING) { - model = mateconf_value_get_string (value); + if (value != NULL) { + model = g_strdup(value); if (model != NULL && model[0] == '\0') model = NULL; } if (model == NULL) { - model = initial_config.model; + model = g_strdup(initial_config.model); if (model == NULL) model = ""; } @@ -82,14 +85,14 @@ set_model_text (GtkWidget * picker, MateConfValue * value) gtk_button_set_label (GTK_BUTTON (picker), _("Unknown")); } g_object_unref (G_OBJECT (ci)); + g_free (model); } static void -model_key_changed (MateConfClient * client, - guint cnxn_id, MateConfEntry * entry, GtkBuilder * dialog) +model_key_changed (GSettings * settings, gchar * key, GtkBuilder * dialog) { set_model_text (WID ("xkb_model_pick"), - mateconf_entry_get_value (entry)); + g_settings_get_string (settings, key)); enable_disable_restoring (dialog); } @@ -97,18 +100,17 @@ model_key_changed (MateConfClient * client, static void setup_model_entry (GtkBuilder * dialog) { - MateConfValue *value; + gchar *value; - value = mateconf_client_get (xkb_mateconf_client, - MATEKBD_KEYBOARD_CONFIG_KEY_MODEL, NULL); + value = g_settings_get_string (xkb_kbd_settings, "model"); set_model_text (WID ("xkb_model_pick"), value); if (value != NULL) - mateconf_value_free (value); + g_free (value); - mateconf_client_notify_add (xkb_mateconf_client, - MATEKBD_KEYBOARD_CONFIG_KEY_MODEL, - (MateConfClientNotifyFunc) model_key_changed, - dialog, NULL, NULL); + g_signal_connect (xkb_kbd_settings, + "changed::model", + G_CALLBACK (model_key_changed), + dialog); } static void @@ -120,8 +122,10 @@ cleanup_xkb_tabs (GtkBuilder * dialog) config_registry = NULL; g_object_unref (G_OBJECT (engine)); engine = NULL; - g_object_unref (G_OBJECT (xkb_mateconf_client)); - xkb_mateconf_client = NULL; + g_object_unref (G_OBJECT (xkb_kbd_settings)); + xkb_kbd_settings = NULL; + g_object_unref (G_OBJECT (xkb_general_settings)); + xkb_general_settings = NULL; } static void @@ -129,25 +133,22 @@ reset_to_defaults (GtkWidget * button, GtkBuilder * dialog) { MatekbdKeyboardConfig empty_kbd_config; - matekbd_keyboard_config_init (&empty_kbd_config, xkb_mateconf_client, - engine); - matekbd_keyboard_config_save_to_mateconf (&empty_kbd_config); + matekbd_keyboard_config_init (&empty_kbd_config, engine); + matekbd_keyboard_config_save_to_gsettings (&empty_kbd_config); matekbd_keyboard_config_term (&empty_kbd_config); - mateconf_client_unset (xkb_mateconf_client, - MATEKBD_DESKTOP_CONFIG_KEY_DEFAULT_GROUP, NULL); + g_settings_reset (xkb_general_settings, "default-group"); /* all the rest is g-s-d's business */ } static void -chk_separate_group_per_window_toggled (MateConfPropertyEditor * peditor, - const gchar * key, - const MateConfValue * value, +chk_separate_group_per_window_toggled (GSettings * settings, + gchar * key, GtkBuilder * dialog) { gtk_widget_set_sensitive (WID ("chk_new_windows_inherit_layout"), - mateconf_value_get_bool (value)); + g_settings_get_boolean (settings, key)); } static void @@ -162,43 +163,44 @@ chk_new_windows_inherit_layout_toggled (GtkWidget * } void -setup_xkb_tabs (GtkBuilder * dialog, MateConfChangeSet * changeset) +setup_xkb_tabs (GtkBuilder * dialog) { - GObject *peditor; GtkWidget *chk_new_windows_inherit_layout = WID ("chk_new_windows_inherit_layout"); - xkb_mateconf_client = mateconf_client_get_default (); + xkb_general_settings = g_settings_new (XKB_GENERAL_SCHEMA); + xkb_kbd_settings = g_settings_new (XKB_KBD_SCHEMA); engine = xkl_engine_get_instance (GDK_DISPLAY_XDISPLAY(gdk_display_get_default())); config_registry = xkl_config_registry_get_instance (engine); - matekbd_desktop_config_init (&desktop_config, xkb_mateconf_client, - engine); - matekbd_desktop_config_load_from_mateconf (&desktop_config); + matekbd_desktop_config_init (&desktop_config, engine); + matekbd_desktop_config_load_from_gsettings (&desktop_config); - xkl_config_registry_load (config_registry, - desktop_config.load_extra_items); + xkl_config_registry_load (config_registry, desktop_config.load_extra_items); - matekbd_keyboard_config_init (&initial_config, xkb_mateconf_client, - engine); + matekbd_keyboard_config_init (&initial_config, engine); matekbd_keyboard_config_load_from_x_initial (&initial_config, NULL); setup_model_entry (dialog); - peditor = mateconf_peditor_new_boolean - (changeset, (gchar *) MATEKBD_DESKTOP_CONFIG_KEY_GROUP_PER_WINDOW, - WID ("chk_separate_group_per_window"), NULL); + g_settings_bind (xkb_general_settings, + "group-per-window", + WID ("chk_separate_group_per_window"), + "active", + G_SETTINGS_BIND_DEFAULT); - g_signal_connect (peditor, "value-changed", (GCallback) - chk_separate_group_per_window_toggled, dialog); + g_signal_connect (xkb_general_settings, + "changed::group-per-window", + G_CALLBACK (chk_separate_group_per_window_toggled), + dialog); #ifdef HAVE_X11_EXTENSIONS_XKB_H if (strcmp (xkl_engine_get_backend_name (engine), "XKB")) #endif gtk_widget_hide (WID ("xkb_layouts_print")); - xkb_layouts_prepare_selected_tree (dialog, changeset); + xkb_layouts_prepare_selected_tree (dialog); xkb_layouts_fill_selected_tree (dialog); gtk_widget_set_sensitive (chk_new_windows_inherit_layout, @@ -228,8 +230,8 @@ setup_xkb_tabs (GtkBuilder * dialog, MateConfChangeSet * changeset) "clicked", G_CALLBACK (choose_model), dialog); - xkb_layouts_register_mateconf_listener (dialog); - xkb_options_register_mateconf_listener (dialog); + xkb_layouts_register_gsettings_listener (dialog); + xkb_options_register_gsettings_listener (dialog); g_signal_connect (G_OBJECT (WID ("keyboard_dialog")), "destroy", G_CALLBACK (cleanup_xkb_tabs), @@ -244,11 +246,39 @@ enable_disable_restoring (GtkBuilder * dialog) MatekbdKeyboardConfig gswic; gboolean enable; - matekbd_keyboard_config_init (&gswic, xkb_mateconf_client, engine); - matekbd_keyboard_config_load_from_mateconf (&gswic, NULL); + matekbd_keyboard_config_init (&gswic, engine); + matekbd_keyboard_config_load_from_gsettings (&gswic, NULL); enable = !matekbd_keyboard_config_equals (&gswic, &initial_config); matekbd_keyboard_config_term (&gswic); gtk_widget_set_sensitive (WID ("xkb_reset_to_defaults"), enable); } + +void +xkb_save_gslist_as_strv (gchar *schema, gchar *key, GSList *list) +{ + GSettings *settings; + GArray *array; + GSList *l; + array = g_array_new (TRUE, TRUE, sizeof (gchar *)); + for (l = list; l; l = l->next) { + array = g_array_append_val (array, l->data); + } + settings = g_settings_new (schema); + g_settings_set_strv (settings, key, (const gchar **) array->data); + g_array_free (array, TRUE); + g_object_unref (settings); +} + +void +xkb_layouts_set_selected_list(GSList *list) +{ + xkb_save_gslist_as_strv (XKB_KBD_SCHEMA, "layouts", list); +} + +void +xkb_options_set_selected_list(GSList *list) +{ + xkb_save_gslist_as_strv (XKB_KBD_SCHEMA, "options", list); +} diff --git a/capplets/keyboard/mate-keyboard-properties-xkb.h b/capplets/keyboard/mate-keyboard-properties-xkb.h index 9ed7453c..55827e12 100644 --- a/capplets/keyboard/mate-keyboard-properties-xkb.h +++ b/capplets/keyboard/mate-keyboard-properties-xkb.h @@ -24,7 +24,7 @@ #ifndef __MATE_KEYBOARD_PROPERTY_XKB_H #define __MATE_KEYBOARD_PROPERTY_XKB_H -#include <mateconf/mateconf-client.h> +#include <gio/gio.h> #include "libmatekbd/matekbd-keyboard-config.h" @@ -34,22 +34,21 @@ extern "C" { #define CWID(s) GTK_WIDGET (gtk_builder_get_object (chooser_dialog, s)) extern XklEngine *engine; extern XklConfigRegistry *config_registry; -extern MateConfClient *xkb_mateconf_client; +extern GSettings *xkb_kbd_settings; +extern GSettings *xkb_general_settings; extern MatekbdKeyboardConfig initial_config; -extern void setup_xkb_tabs (GtkBuilder * dialog, - MateConfChangeSet * changeset); +extern void setup_xkb_tabs (GtkBuilder * dialog); extern void xkb_layouts_fill_selected_tree (GtkBuilder * dialog); extern void xkb_layouts_register_buttons_handlers (GtkBuilder * dialog); -extern void xkb_layouts_register_mateconf_listener (GtkBuilder * dialog); +extern void xkb_layouts_register_gsettings_listener (GtkBuilder * dialog); -extern void xkb_options_register_mateconf_listener (GtkBuilder * dialog); +extern void xkb_options_register_gsettings_listener (GtkBuilder * dialog); -extern void xkb_layouts_prepare_selected_tree (GtkBuilder * dialog, - MateConfChangeSet * changeset); +extern void xkb_layouts_prepare_selected_tree (GtkBuilder * dialog); extern void xkb_options_load_options (GtkBuilder * dialog); @@ -73,15 +72,9 @@ extern GSList *xkb_layouts_get_selected_list (void); extern GSList *xkb_options_get_selected_list (void); -#define xkb_layouts_set_selected_list(list) \ - mateconf_client_set_list (mateconf_client_get_default (), \ - MATEKBD_KEYBOARD_CONFIG_KEY_LAYOUTS, \ - MATECONF_VALUE_STRING, (list), NULL) +extern void xkb_layouts_set_selected_list(GSList *list); -#define xkb_options_set_selected_list(list) \ - mateconf_client_set_list (mateconf_client_get_default (), \ - MATEKBD_KEYBOARD_CONFIG_KEY_OPTIONS, \ - MATECONF_VALUE_STRING, (list), NULL) +extern void xkb_options_set_selected_list(GSList *list); extern GtkWidget *xkb_layout_preview_create_widget (GtkBuilder * chooser_dialog); diff --git a/capplets/keyboard/mate-keyboard-properties-xkblt.c b/capplets/keyboard/mate-keyboard-properties-xkblt.c index cbe9e65b..b23fd750 100644 --- a/capplets/keyboard/mate-keyboard-properties-xkblt.c +++ b/capplets/keyboard/mate-keyboard-properties-xkblt.c @@ -26,7 +26,7 @@ #endif #include <gdk/gdkx.h> -#include <mateconf/mateconf-client.h> +#include <gio/gio.h> #include <glib/gi18n.h> #include <libmatekbd/matekbd-desktop-config.h> @@ -88,20 +88,23 @@ find_selected_layout_idx (GtkBuilder * dialog) GSList * xkb_layouts_get_selected_list (void) { - GSList *retval; + gchar **array; + GSList *retval = NULL; + gint i; + array = g_settings_get_strv (xkb_kbd_settings, "layouts"); + if (array != NULL) { + for (i = 0; array[i]; i++) { + retval = g_slist_append (retval, g_strdup (array[i])); + } + } + g_strfreev (array); - retval = mateconf_client_get_list (xkb_mateconf_client, - MATEKBD_KEYBOARD_CONFIG_KEY_LAYOUTS, - MATECONF_VALUE_STRING, NULL); if (retval == NULL) { - GSList *cur_layout; - - for (cur_layout = initial_config.layouts_variants; - cur_layout != NULL; cur_layout = cur_layout->next) - retval = - g_slist_prepend (retval, - g_strdup (cur_layout->data)); - + if (initial_config.layouts_variants != NULL) { + for (i = 0; initial_config.layouts_variants[i] != NULL; i++) + retval = + g_slist_prepend (retval, g_strdup (initial_config.layouts_variants[i])); + } retval = g_slist_reverse (retval); } @@ -111,18 +114,14 @@ xkb_layouts_get_selected_list (void) gint xkb_get_default_group () { - return mateconf_client_get_int (xkb_mateconf_client, - MATEKBD_DESKTOP_CONFIG_KEY_DEFAULT_GROUP, - NULL); + return g_settings_get_int (xkb_general_settings, "default-group"); } void xkb_save_default_group (gint default_group) { if (default_group != xkb_get_default_group ()) - mateconf_client_set_int (xkb_mateconf_client, - MATEKBD_DESKTOP_CONFIG_KEY_DEFAULT_GROUP, - default_group, NULL); + g_settings_set_int (xkb_general_settings, "default-group", default_group); } static void @@ -224,8 +223,7 @@ xkb_layouts_dnd_data_received (GtkWidget * widget, GdkDragContext * dc, } void -xkb_layouts_prepare_selected_tree (GtkBuilder * dialog, - MateConfChangeSet * changeset) +xkb_layouts_prepare_selected_tree (GtkBuilder * dialog) { GtkListStore *list_store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_STRING, @@ -456,20 +454,17 @@ xkb_layouts_register_buttons_handlers (GtkBuilder * dialog) } static void -xkb_layouts_update_list (MateConfClient * client, - guint cnxn_id, MateConfEntry * entry, - GtkBuilder * dialog) +xkb_layouts_update_list (GSettings * settings, gchar * key, GtkBuilder * dialog) { xkb_layouts_fill_selected_tree (dialog); enable_disable_restoring (dialog); } void -xkb_layouts_register_mateconf_listener (GtkBuilder * dialog) +xkb_layouts_register_gsettings_listener (GtkBuilder * dialog) { - mateconf_client_notify_add (xkb_mateconf_client, - MATEKBD_KEYBOARD_CONFIG_KEY_LAYOUTS, - (MateConfClientNotifyFunc) - xkb_layouts_update_list, dialog, NULL, - NULL); + g_signal_connect (xkb_kbd_settings, + "changed::layouts", + G_CALLBACK (xkb_layouts_update_list), + dialog); } diff --git a/capplets/keyboard/mate-keyboard-properties-xkbltadd.c b/capplets/keyboard/mate-keyboard-properties-xkbltadd.c index fe7f79df..1af72bb5 100644 --- a/capplets/keyboard/mate-keyboard-properties-xkbltadd.c +++ b/capplets/keyboard/mate-keyboard-properties-xkbltadd.c @@ -366,6 +366,33 @@ xkb_layout_chooser_available_layouts_fill (GtkBuilder * chooser_dialog); } +GSList* +xkb_layout_gslist_from_strv (gchar **array) +{ + GSList *list = NULL; + gint i; + if (array != NULL) { + for (i = 0; array[i]; i++) { + list = g_slist_append (list, g_strdup (array[i])); + } + } + return list; +} + +gchar ** +xkb_layout_strv_from_gslist (GSList *list) +{ + GArray *array; + GSList *l; + array = g_array_new (TRUE, TRUE, sizeof (gchar *)); + for (l = list; l; l = l->next) { + array = g_array_append_val (array, l->data); + } + return (gchar **) array->data; +} + + + void xkl_layout_chooser_add_default_switcher_if_necessary (GSList * layouts_list) @@ -373,11 +400,16 @@ xkl_layout_chooser_add_default_switcher_if_necessary (GSList * GSList *options_list = xkb_options_get_selected_list (); gboolean was_appended; - options_list = + gchar **layouts_list_strv = xkb_layout_strv_from_gslist (layouts_list); + gchar **options_list_strv = xkb_layout_strv_from_gslist (options_list); + + options_list_strv = matekbd_keyboard_config_add_default_switch_option_if_necessary - (layouts_list, options_list, &was_appended); - if (was_appended) + (layouts_list_strv, options_list_strv, &was_appended); + if (was_appended) { xkb_options_set_selected_list (options_list); + + } clear_xkb_elements_list (options_list); } diff --git a/capplets/keyboard/mate-keyboard-properties-xkbmc.c b/capplets/keyboard/mate-keyboard-properties-xkbmc.c index baa2b848..20cd63be 100644 --- a/capplets/keyboard/mate-keyboard-properties-xkbmc.c +++ b/capplets/keyboard/mate-keyboard-properties-xkbmc.c @@ -26,7 +26,7 @@ #endif #include <gdk/gdkx.h> -#include <mateconf/mateconf-client.h> +#include <gio/gio.h> #include <glib/gi18n.h> #include "capplet-util.h" @@ -300,9 +300,7 @@ xkb_model_chooser_response (GtkDialog * dialog, gtk_tree_model_get (list_store, &iter, 1, &model_name, -1); - mateconf_client_set_string (xkb_mateconf_client, - MATEKBD_KEYBOARD_CONFIG_KEY_MODEL, - model_name, NULL); + g_settings_set_string (xkb_kbd_settings, "model", model_name); g_free (model_name); } } @@ -323,9 +321,7 @@ choose_model (GtkBuilder * dialog) GTK_WINDOW (WID ("keyboard_dialog"))); current_model_name = - mateconf_client_get_string (xkb_mateconf_client, - MATEKBD_KEYBOARD_CONFIG_KEY_MODEL, NULL); - + g_settings_get_string (xkb_kbd_settings, "model"); prepare_vendors_list (chooser_dialog); prepare_models_list (chooser_dialog); diff --git a/capplets/keyboard/mate-keyboard-properties-xkbot.c b/capplets/keyboard/mate-keyboard-properties-xkbot.c index f01f83bd..ddf23115 100644 --- a/capplets/keyboard/mate-keyboard-properties-xkbot.c +++ b/capplets/keyboard/mate-keyboard-properties-xkbot.c @@ -28,7 +28,7 @@ #include <glib/gi18n.h> #include <string.h> -#include <mateconf/mateconf-client.h> +#include <gio/gio.h> #include "capplet-util.h" @@ -44,26 +44,28 @@ static GSList *current_radio_group = NULL; #define OPTION_ID_PROP "optionID" #define SELCOUNTER_PROP "selectionCounter" -#define MATECONFSTATE_PROP "mateconfState" #define EXPANDERS_PROP "expandersList" GSList * xkb_options_get_selected_list (void) { - GSList *retval; + gchar **array; + GSList *retval = NULL; + gint i; + array = g_settings_get_strv (xkb_kbd_settings, "options"); + if (array != NULL) { + for (i = 0; array[i]; i++) { + retval = g_slist_append (retval, g_strdup (array[i])); + } + } + g_strfreev (array); - retval = mateconf_client_get_list (xkb_mateconf_client, - MATEKBD_KEYBOARD_CONFIG_KEY_OPTIONS, - MATECONF_VALUE_STRING, NULL); if (retval == NULL) { - GSList *cur_option; - - for (cur_option = initial_config.options; - cur_option != NULL; cur_option = cur_option->next) - retval = - g_slist_prepend (retval, - g_strdup (cur_option->data)); - + if (initial_config.options != NULL) { + for (i = 0; initial_config.options[i] != NULL; i++) + retval = + g_slist_prepend (retval, g_strdup (initial_config.options[i])); + } retval = g_slist_reverse (retval); } @@ -284,8 +286,6 @@ xkb_options_add_option (XklConfigRegistry * config_registry, WID ("options_scroll")); xkb_options_expander_selcounter_add (initial_state); - g_object_set_data (G_OBJECT (option_check), MATECONFSTATE_PROP, - GINT_TO_POINTER (initial_state)); } static gint @@ -473,13 +473,12 @@ xkb_options_update_option_counters (XklConfigRegistry * config_registry, xkb_options_expander_selcounter_add (current_state); } -/* Respond to a change in the xkb mateconf settings */ +/* Respond to a change in the xkb gsettings settings */ static void -xkb_options_update (MateConfClient * client, - guint cnxn_id, MateConfEntry * entry, GtkBuilder * dialog) +xkb_options_update (GSettings * settings, gchar * key, GtkBuilder * dialog) { - /* Updating options is handled by mateconf notifies for each widget - This is here to avoid calling it N_OPTIONS times for each mateconf + /* Updating options is handled by gsettings notifies for each widget + This is here to avoid calling it N_OPTIONS times for each gsettings change. */ enable_disable_restoring (dialog); @@ -507,10 +506,10 @@ xkb_options_update (MateConfClient * client, } void -xkb_options_register_mateconf_listener (GtkBuilder * dialog) +xkb_options_register_gsettings_listener (GtkBuilder * dialog) { - mateconf_client_notify_add (xkb_mateconf_client, - MATEKBD_KEYBOARD_CONFIG_KEY_OPTIONS, - (MateConfClientNotifyFunc) - xkb_options_update, dialog, NULL, NULL); + g_signal_connect (xkb_kbd_settings, + "changed::options", + G_CALLBACK (xkb_options_update), + dialog); } diff --git a/capplets/keyboard/mate-keyboard-properties.c b/capplets/keyboard/mate-keyboard-properties.c index 64e6bce5..894bd0ec 100644 --- a/capplets/keyboard/mate-keyboard-properties.c +++ b/capplets/keyboard/mate-keyboard-properties.c @@ -28,21 +28,28 @@ # include <config.h> #endif -#include <mateconf/mateconf-client.h> +#include <gio/gio.h> #include "capplet-util.h" -#include "mateconf-property-editor.h" #include "activate-settings-daemon.h" #include "capplet-stock-icons.h" #include "mate-keyboard-properties-a11y.h" #include "mate-keyboard-properties-xkb.h" +#define KEYBOARD_SCHEMA "org.mate.peripherals-keyboard" +#define INTERFACE_SCHEMA "org.mate.interface" +#define TYPING_BREAK_SCHEMA "org.mate.typing-break" + enum { RESPONSE_APPLY = 1, RESPONSE_CLOSE }; +static GSettings * keyboard_settings = NULL; +static GSettings * interface_settings = NULL; +static GSettings * typing_break_settings = NULL; + static GtkBuilder * create_dialog (void) { @@ -82,35 +89,9 @@ create_dialog (void) return dialog; } -static MateConfValue * -blink_from_widget (MateConfPropertyEditor * peditor, const MateConfValue * value) -{ - MateConfValue *new_value; - - new_value = mateconf_value_new (MATECONF_VALUE_INT); - mateconf_value_set_int (new_value, - 2600 - mateconf_value_get_int (value)); - - return new_value; -} - -static MateConfValue * -blink_to_widget (MateConfPropertyEditor * peditor, const MateConfValue * value) -{ - MateConfValue *new_value; - gint current_rate; - - current_rate = mateconf_value_get_int (value); - new_value = mateconf_value_new (MATECONF_VALUE_INT); - mateconf_value_set_int (new_value, - CLAMP (2600 - current_rate, 100, 2500)); - - return new_value; -} - static void dialog_response (GtkWidget * widget, - gint response_id, MateConfChangeSet * changeset) + gint response_id, guint data) { if (response_id == GTK_RESPONSE_HELP) capplet_help (GTK_WINDOW (widget), "goscustperiph-2"); @@ -119,59 +100,78 @@ dialog_response (GtkWidget * widget, } static void -setup_dialog (GtkBuilder * dialog, MateConfChangeSet * changeset) +setup_dialog (GtkBuilder * dialog) { - GObject *peditor; gchar *monitor; - peditor = mateconf_peditor_new_boolean - (changeset, "/desktop/mate/peripherals/keyboard/repeat", - WID ("repeat_toggle"), NULL); - mateconf_peditor_widget_set_guard (MATECONF_PROPERTY_EDITOR (peditor), - WID ("repeat_table")); - - mateconf_peditor_new_numeric_range - (changeset, "/desktop/mate/peripherals/keyboard/delay", - WID ("repeat_delay_scale"), NULL); - - mateconf_peditor_new_numeric_range - (changeset, "/desktop/mate/peripherals/keyboard/rate", - WID ("repeat_speed_scale"), NULL); - - peditor = mateconf_peditor_new_boolean - (changeset, "/desktop/mate/interface/cursor_blink", - WID ("cursor_toggle"), NULL); - mateconf_peditor_widget_set_guard (MATECONF_PROPERTY_EDITOR (peditor), - WID ("cursor_hbox")); - mateconf_peditor_new_numeric_range (changeset, - "/desktop/mate/interface/cursor_blink_time", - WID ("cursor_blink_time_scale"), - "conv-to-widget-cb", - blink_to_widget, - "conv-from-widget-cb", - blink_from_widget, NULL); + g_settings_bind (keyboard_settings, + "repeat", + WID ("repeat_toggle"), + "active", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind (keyboard_settings, + "repeat", + WID ("repeat_table"), + "sensitive", + G_SETTINGS_BIND_DEFAULT); + + g_settings_bind (keyboard_settings, + "delay", + gtk_range_get_adjustment (GTK_RANGE (WID ("repeat_delay_scale"))), + "value", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind (keyboard_settings, + "rate", + gtk_range_get_adjustment (GTK_RANGE (WID ("repeat_speed_scale"))), + "value", + G_SETTINGS_BIND_DEFAULT); + + g_settings_bind (interface_settings, + "cursor-blink", + WID ("cursor_toggle"), + "active", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind (interface_settings, + "cursor-blink", + WID ("cursor_hbox"), + "sensitive", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind (interface_settings, + "cursor-blink-time", + gtk_range_get_adjustment (GTK_RANGE (WID ("cursor_blink_time_scale"))), + "value", + G_SETTINGS_BIND_DEFAULT); /* Ergonomics */ monitor = g_find_program_in_path ("mate-typing-monitor"); if (monitor != NULL) { g_free (monitor); - peditor = mateconf_peditor_new_boolean - (changeset, "/desktop/mate/typing_break/enabled", - WID ("break_enabled_toggle"), NULL); - mateconf_peditor_widget_set_guard (MATECONF_PROPERTY_EDITOR (peditor), - WID ("break_details_table")); - mateconf_peditor_new_numeric_range (changeset, - "/desktop/mate/typing_break/type_time", - WID ("break_enabled_spin"), NULL); - mateconf_peditor_new_numeric_range (changeset, - "/desktop/mate/typing_break/break_time", + g_settings_bind (typing_break_settings, + "enabled", + WID ("break_enabled_toggle"), + "active", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind (typing_break_settings, + "enabled", + WID ("break_details_table"), + "sensitive", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind (typing_break_settings, + "type-time", + WID ("break_enabled_spin"), + "value", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind (typing_break_settings, + "break-time", WID ("break_interval_spin"), - NULL); - mateconf_peditor_new_boolean (changeset, - "/desktop/mate/typing_break/allow_postpone", - WID ("break_postponement_toggle"), - NULL); + "value", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind (typing_break_settings, + "allow-postpone", + WID ("break_postponement_toggle"), + "active", + G_SETTINGS_BIND_DEFAULT); } else { /* don't show the typing break tab if the daemon is not available */ @@ -181,17 +181,15 @@ setup_dialog (GtkBuilder * dialog, MateConfChangeSet * changeset) } g_signal_connect (WID ("keyboard_dialog"), "response", - (GCallback) dialog_response, changeset); + (GCallback) dialog_response, NULL); - setup_xkb_tabs (dialog, changeset); - setup_a11y_tabs (dialog, changeset); + setup_xkb_tabs (dialog); + setup_a11y_tabs (dialog); } int main (int argc, char **argv) { - MateConfClient *client; - MateConfChangeSet *changeset; GtkBuilder *dialog; GOptionContext *context; @@ -231,17 +229,12 @@ main (int argc, char **argv) activate_settings_daemon (); - client = mateconf_client_get_default (); - mateconf_client_add_dir (client, - "/desktop/mate/peripherals/keyboard", - MATECONF_CLIENT_PRELOAD_ONELEVEL, NULL); - mateconf_client_add_dir (client, "/desktop/mate/interface", - MATECONF_CLIENT_PRELOAD_ONELEVEL, NULL); - g_object_unref (client); + keyboard_settings = g_settings_new (KEYBOARD_SCHEMA); + interface_settings = g_settings_new (INTERFACE_SCHEMA); + typing_break_settings = g_settings_new (TYPING_BREAK_SCHEMA); - changeset = NULL; dialog = create_dialog (); - setup_dialog (dialog, changeset); + setup_dialog (dialog); if (switch_to_typing_break_page) { gtk_notebook_set_current_page (GTK_NOTEBOOK (WID @@ -261,5 +254,10 @@ main (int argc, char **argv) gtk_widget_show (WID ("keyboard_dialog")); gtk_main (); + finalize_a11y_tabs (); + g_object_unref (keyboard_settings); + g_object_unref (interface_settings); + g_object_unref (typing_break_settings); + return 0; } |