diff options
Diffstat (limited to 'capplets/keyboard/mate-keyboard-properties-a11y.c')
-rw-r--r-- | capplets/keyboard/mate-keyboard-properties-a11y.c | 231 |
1 files changed, 110 insertions, 121 deletions
diff --git a/capplets/keyboard/mate-keyboard-properties-a11y.c b/capplets/keyboard/mate-keyboard-properties-a11y.c index 5f9e2492..5d1e9967 100644 --- a/capplets/keyboard/mate-keyboard-properties-a11y.c +++ b/capplets/keyboard/mate-keyboard-properties-a11y.c @@ -29,6 +29,8 @@ #include "capplet-util.h" #define NWID(s) GTK_WIDGET (gtk_builder_get_object (notifications_dialog, s)) +#define GET_TOGGLE_BUTTON(s) GTK_TOGGLE_BUTTON (gtk_builder_get_object (notifications_dialog, s)) +#define GET_RANGE(s) GTK_RANGE (gtk_builder_get_object (dialog, s)) #define A11Y_SCHEMA "org.mate.accessibility-keyboard" #define MARCO_SCHEMA "org.mate.Marco.general" @@ -91,11 +93,11 @@ bell_flash_gsettings_changed (GSettings *settings, gchar *key, GtkBuilder *dialo 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); + gtk_toggle_button_set_active (GET_TOGGLE_BUTTON ("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); + gtk_toggle_button_set_active (GET_TOGGLE_BUTTON ("visual_bell_titlebar"), TRUE); } } @@ -107,9 +109,9 @@ bell_flash_radio_changed (GtkWidget *widget, GtkBuilder *builder) int old_bell_flash_type = g_settings_get_enum (marco_settings, "visual-bell-type"); int new_bell_flash_type = VISUAL_BELL_TYPE_INVALID; - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (NWID ("visual_bell_fullscreen")))) + if (gtk_toggle_button_get_active (GET_TOGGLE_BUTTON ("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")))) + else if (gtk_toggle_button_get_active (GET_TOGGLE_BUTTON ("visual_bell_titlebar"))) new_bell_flash_type = VISUAL_BELL_TYPE_FRAME_FLASH; if (old_bell_flash_type != new_bell_flash_type) @@ -143,54 +145,63 @@ notifications_button_clicked_cb (GtkWidget *button, GtkBuilder *dialog) slowkeys_enable_toggled_cb (WID ("slowkeys_enable"), dialog); bouncekeys_enable_toggled_cb (WID ("bouncekeys_enable"), dialog); - w = NWID ("feature_state_change_beep"); - g_settings_bind (a11y_settings, "feature-state-change-beep", w, "active", G_SETTINGS_BIND_DEFAULT); + g_settings_bind (a11y_settings, "feature-state-change-beep", + gtk_builder_get_object (notifications_dialog, "feature_state_change_beep"), "active", + G_SETTINGS_BIND_DEFAULT); - w = NWID ("togglekeys_enable"); - g_settings_bind (a11y_settings, "togglekeys-enable", w, "active", G_SETTINGS_BIND_DEFAULT); + g_settings_bind (a11y_settings, "togglekeys-enable", + gtk_builder_get_object (notifications_dialog, "togglekeys_enable"), "active", + G_SETTINGS_BIND_DEFAULT); - w = NWID ("capslock_beep_enable"); - g_settings_bind (a11y_settings, "capslock-beep-enable", w, "active", G_SETTINGS_BIND_DEFAULT); + g_settings_bind (a11y_settings, "capslock-beep-enable", + gtk_builder_get_object (notifications_dialog, "capslock_beep_enable"), "active", + G_SETTINGS_BIND_DEFAULT); - w = NWID ("stickykeys_modifier_beep"); - g_settings_bind (a11y_settings, "stickykeys-modifier-beep", w, "active", G_SETTINGS_BIND_DEFAULT); + g_settings_bind (a11y_settings, "stickykeys-modifier-beep", + gtk_builder_get_object (notifications_dialog, "stickykeys_modifier_beep"), "active", + G_SETTINGS_BIND_DEFAULT); - w = NWID ("slowkeys_beep_press"); - g_settings_bind (a11y_settings, "slowkeys-beep-press", w, "active", G_SETTINGS_BIND_DEFAULT); + g_settings_bind (a11y_settings, "slowkeys-beep-press", + gtk_builder_get_object (notifications_dialog, "stickykeys_modifier_beep"), "active", + G_SETTINGS_BIND_DEFAULT); - w = NWID ("slowkeys_beep_accept"); - g_settings_bind (a11y_settings, "slowkeys-beep-accept", w, "active", G_SETTINGS_BIND_DEFAULT); + g_settings_bind (a11y_settings, "slowkeys-beep-accept", + gtk_builder_get_object (notifications_dialog, "slowkeys_beep_accept"), "active", + G_SETTINGS_BIND_DEFAULT); - w = NWID ("slowkeys_beep_reject"); - g_settings_bind (a11y_settings, "slowkeys-beep-reject", w, "active", G_SETTINGS_BIND_DEFAULT); + g_settings_bind (a11y_settings, "slowkeys-beep-reject", + gtk_builder_get_object (notifications_dialog, "slowkeys_beep_reject"), "active", + G_SETTINGS_BIND_DEFAULT); - w = NWID ("bouncekeys_beep_reject"); - g_settings_bind (a11y_settings, "bouncekeys-beep-reject", w, "active", G_SETTINGS_BIND_DEFAULT); + g_settings_bind (a11y_settings, "bouncekeys-beep-reject", + gtk_builder_get_object (notifications_dialog, "bouncekeys_beep_reject"), "active", + G_SETTINGS_BIND_DEFAULT); GSettings *marco_settings = g_settings_new (MARCO_SCHEMA); w = NWID ("visual_bell_enable"); 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); + 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); + g_signal_connect (gtk_builder_get_object (notifications_dialog, "visual_bell_titlebar"), "clicked", + G_CALLBACK(bell_flash_radio_changed), + notifications_dialog); + g_signal_connect (gtk_builder_get_object (notifications_dialog, "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), - GTK_WINDOW (WID ("keyboard_dialog"))); + GTK_WINDOW (gtk_builder_get_object (notifications_dialog, "keyboard_dialog"))); g_signal_connect (w, "response", - G_CALLBACK (a11y_notifications_dialog_response_cb), NULL); + G_CALLBACK (a11y_notifications_dialog_response_cb), + NULL); gtk_dialog_run (GTK_DIALOG (w)); @@ -220,114 +231,92 @@ setup_a11y_tabs (GtkBuilder *dialog) a11y_settings = g_settings_new (A11Y_SCHEMA); /* Accessibility tab */ - g_settings_bind (a11y_settings, - "enable", - WID ("master_enable"), - "active", - G_SETTINGS_BIND_DEFAULT); + g_settings_bind (a11y_settings, "enable", + gtk_builder_get_object (dialog, "master_enable"), "active", + G_SETTINGS_BIND_DEFAULT); + w = WID ("stickykeys_enable"); - g_settings_bind (a11y_settings, - "stickykeys-enable", - w, - "active", - G_SETTINGS_BIND_DEFAULT); + 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); + G_CALLBACK (stickykeys_enable_toggled_cb), + dialog); stickykeys_enable_toggled_cb (w, dialog); - g_settings_bind (a11y_settings, - "stickykeys-latch-to-lock", - WID ("stickykeys_latch_to_lock"), - "active", - G_SETTINGS_BIND_DEFAULT); + g_settings_bind (a11y_settings, "stickykeys-latch-to-lock", + gtk_builder_get_object (dialog, "stickykeys_latch_to_lock"), "active", + G_SETTINGS_BIND_DEFAULT); - g_settings_bind (a11y_settings, - "stickykeys-two-key-off", - WID ("stickykeys_two_key_off"), - "active", - G_SETTINGS_BIND_DEFAULT); + g_settings_bind (a11y_settings, "stickykeys-two-key-off", + gtk_builder_get_object (dialog, "stickykeys_two_key_off"), "active", + G_SETTINGS_BIND_DEFAULT); w = WID ("slowkeys_enable"); - g_settings_bind (a11y_settings, - "slowkeys-enable", - w, - "active", - G_SETTINGS_BIND_DEFAULT); + 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); + G_CALLBACK (slowkeys_enable_toggled_cb), + dialog); slowkeys_enable_toggled_cb (w, dialog); w = WID ("bouncekeys_enable"); - g_settings_bind (a11y_settings, - "bouncekeys-enable", - w, - "active", - G_SETTINGS_BIND_DEFAULT); + 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); + G_CALLBACK (bouncekeys_enable_toggled_cb), + dialog); bouncekeys_enable_toggled_cb (w, dialog); - 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", - G_CALLBACK (notifications_button_clicked_cb), dialog); + g_settings_bind (a11y_settings, "slowkeys-delay", + gtk_range_get_adjustment (GET_RANGE ("slowkeys_delay_slide")), "value", + G_SETTINGS_BIND_DEFAULT); + + g_settings_bind (a11y_settings, "bouncekeys-delay", + gtk_range_get_adjustment (GET_RANGE ("bouncekeys_delay_slide")), "value", + G_SETTINGS_BIND_DEFAULT); + + g_signal_connect (gtk_builder_get_object (dialog, "notifications_button"), "clicked", + G_CALLBACK (notifications_button_clicked_cb), + dialog); /* Mouse Keys tab */ w = WID ("mousekeys_enable"); - g_settings_bind (a11y_settings, - "mousekeys-enable", - w, - "active", - G_SETTINGS_BIND_DEFAULT); + 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); - 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); + g_settings_bind (a11y_settings, "slowkeys-delay", + gtk_range_get_adjustment (GET_RANGE ("slowkeys_delay_slide")), "value", + G_SETTINGS_BIND_DEFAULT); + + g_settings_bind (a11y_settings, "bouncekeys-delay", + gtk_range_get_adjustment (GET_RANGE ("bouncekeys_delay_slide")), "value", + G_SETTINGS_BIND_DEFAULT); + + g_settings_bind (a11y_settings, "slowkeys-delay", + gtk_range_get_adjustment (GET_RANGE ("slowkeys_delay_slide")), "value", + G_SETTINGS_BIND_DEFAULT); + + g_settings_bind (a11y_settings, "bouncekeys-delay", + gtk_range_get_adjustment (GET_RANGE ("bouncekeys_delay_slide")), "value", + G_SETTINGS_BIND_DEFAULT); + + g_settings_bind (a11y_settings, "mousekeys-accel-time", + gtk_range_get_adjustment (GET_RANGE ("mousekeys_accel_time_slide")), "value", + G_SETTINGS_BIND_DEFAULT); + + g_settings_bind (a11y_settings, "mousekeys-max-speed", + gtk_range_get_adjustment (GET_RANGE ("mousekeys_max_speed_slide")), "value", + G_SETTINGS_BIND_DEFAULT); + + g_settings_bind (a11y_settings, "mousekeys-init-delay", + gtk_range_get_adjustment (GET_RANGE ("mousekeys_init_delay_slide")), "value", + G_SETTINGS_BIND_DEFAULT); } |