diff options
-rw-r--r-- | capplets/about-me/mate-about-me-fingerprint.c | 47 | ||||
-rw-r--r-- | capplets/about-me/mate-about-me-password.c | 10 | ||||
-rw-r--r-- | capplets/about-me/mate-about-me.c | 20 | ||||
-rw-r--r-- | capplets/keyboard/mate-keyboard-properties-a11y.c | 231 | ||||
-rw-r--r-- | capplets/keyboard/mate-keyboard-properties-xkbltadd.c | 4 | ||||
-rw-r--r-- | capplets/keyboard/mate-keyboard-properties.c | 112 | ||||
-rw-r--r-- | capplets/mouse/mate-mouse-properties.c | 101 |
7 files changed, 255 insertions, 270 deletions
diff --git a/capplets/about-me/mate-about-me-fingerprint.c b/capplets/about-me/mate-about-me-fingerprint.c index 7457b013..1b96775e 100644 --- a/capplets/about-me/mate-about-me-fingerprint.c +++ b/capplets/about-me/mate-about-me-fingerprint.c @@ -263,11 +263,11 @@ delete_fingerprints_question (GtkBuilder *dialog, GtkWidget *enable, GtkWidget * GtkWidget *question; GtkWidget *button; - question = gtk_message_dialog_new (GTK_WINDOW (WID ("about-me-dialog")), - GTK_DIALOG_MODAL, - GTK_MESSAGE_QUESTION, - GTK_BUTTONS_NONE, - _("Delete registered fingerprints?")); + question = gtk_message_dialog_new (GTK_WINDOW (gtk_builder_get_object (dialog, "about-me-dialog")), + GTK_DIALOG_MODAL, + GTK_MESSAGE_QUESTION, + GTK_BUTTONS_NONE, + _("Delete registered fingerprints?")); gtk_dialog_add_button (GTK_DIALOG (question), "gtk-cancel", GTK_RESPONSE_CANCEL); button = gtk_button_new_with_mnemonic (_("_Delete Fingerprints")); @@ -333,18 +333,24 @@ enroll_data_destroy (EnrollData *data) static const char * selected_finger (GtkBuilder *dialog) { + GtkWidget *finger_combobox; int index; - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (WID ("radiobutton1")))) { - gtk_widget_set_sensitive (WID ("finger_combobox"), FALSE); + finger_combobox = WID ("finger_combobox"); + + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object (dialog, "radiobutton1")))) { + gtk_widget_set_sensitive (finger_combobox, FALSE); return "right-index-finger"; } - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (WID ("radiobutton2")))) { - gtk_widget_set_sensitive (WID ("finger_combobox"), FALSE); + + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object (dialog, "radiobutton2")))) { + gtk_widget_set_sensitive (finger_combobox, FALSE); return "left-index-finger"; } - gtk_widget_set_sensitive (WID ("finger_combobox"), TRUE); - index = gtk_combo_box_get_active (GTK_COMBO_BOX (WID ("finger_combobox"))); + + gtk_widget_set_sensitive (finger_combobox, TRUE); + + index = gtk_combo_box_get_active (GTK_COMBO_BOX (finger_combobox)); switch (index) { case 0: return "left-thumb"; @@ -372,13 +378,12 @@ selected_finger (GtkBuilder *dialog) static void finger_radio_button_toggled (GtkToggleButton *button, EnrollData *data) { - GtkBuilder *dialog = data->dialog; char *msg; data->finger = selected_finger (data->dialog); msg = g_strdup_printf (TR(finger_str_to_msg (data->finger, data->is_swipe)), data->name); - gtk_label_set_text (GTK_LABEL (WID("enroll-label")), msg); + gtk_label_set_text (GTK_LABEL (gtk_builder_get_object (data->dialog, "enroll-label")), msg); g_free (msg); } @@ -432,12 +437,12 @@ on_signal (GDBusProxy *proxy G_GNUC_UNUSED, data->num_stages_done++; name = g_strdup_printf ("image%d", data->num_stages_done); path = g_build_filename (MATECC_PIXMAP_DIR, "print_ok.png", NULL); - gtk_image_set_from_file (GTK_IMAGE (WID (name)), path); + gtk_image_set_from_file (GTK_IMAGE (gtk_builder_get_object (dialog, name)), path); g_free (name); g_free (path); } if (g_str_equal (result, "enroll-completed")) { - gtk_label_set_text (GTK_LABEL (WID ("status-label")), _("Done!")); + gtk_label_set_text (GTK_LABEL (gtk_builder_get_object (dialog, "status-label")), _("Done!")); gtk_assistant_set_page_complete (GTK_ASSISTANT (data->ass), WID ("page2"), TRUE); } @@ -476,7 +481,7 @@ on_signal (GDBusProxy *proxy G_GNUC_UNUSED, } msg = g_strdup_printf (TR(enroll_result_str_to_msg (result, data->is_swipe)), data->name); - gtk_label_set_text (GTK_LABEL (WID ("status-label")), msg); + gtk_label_set_text (GTK_LABEL (gtk_builder_get_object (dialog, "status-label")), msg); g_free (msg); g_free (result); } @@ -598,7 +603,7 @@ out: for (i = 1; i <= data->num_enroll_stages; i++) { char *image_name; image_name = g_strdup_printf ("image%d", i); - gtk_image_set_from_file (GTK_IMAGE (WID (image_name)), path); + gtk_image_set_from_file (GTK_IMAGE (gtk_builder_get_object (dialog, image_name)), path); g_free (image_name); } g_free (path); @@ -767,7 +772,7 @@ enroll_fingerprints (GtkWindow *parent, GtkWidget *enable, GtkWidget *disable) data); /* Page 1 */ - gtk_combo_box_set_active (GTK_COMBO_BOX (WID ("finger_combobox")), 0); + gtk_combo_box_set_active (GTK_COMBO_BOX (gtk_builder_get_object (dialog, "finger_combobox")), 0); g_signal_connect (gtk_builder_get_object (dialog, "radiobutton1"), "toggled", G_CALLBACK (finger_radio_button_toggled), @@ -784,7 +789,7 @@ enroll_fingerprints (GtkWindow *parent, GtkWidget *enable, GtkWidget *disable) data->finger = selected_finger (dialog); - g_object_set_data (G_OBJECT (WID("page1")), "name", "intro"); + g_object_set_data (gtk_builder_get_object (dialog, "page1"), "name", "intro"); /* translators: * The variable is the name of the device, for example: @@ -792,7 +797,7 @@ enroll_fingerprints (GtkWindow *parent, GtkWidget *enable, GtkWidget *disable) * 'Digital Persona U.are.U 4000/4000B' device." */ msg = g_strdup_printf (_("To enable fingerprint login, you need to save one of your fingerprints, using the '%s' device."), data->name); - gtk_label_set_text (GTK_LABEL (WID("intro-label")), msg); + gtk_label_set_text (GTK_LABEL (gtk_builder_get_object (dialog, "intro-label")), msg); g_free (msg); gtk_assistant_set_page_complete (GTK_ASSISTANT (ass), WID("page1"), TRUE); @@ -827,6 +832,6 @@ fingerprint_button_clicked (GtkBuilder *dialog, if (is_disable != FALSE) { delete_fingerprints_question (dialog, enable, disable); } else { - enroll_fingerprints (GTK_WINDOW (WID ("about-me-dialog")), enable, disable); + enroll_fingerprints (GTK_WINDOW (gtk_builder_get_object (dialog, "about-me-dialog")), enable, disable); } } diff --git a/capplets/about-me/mate-about-me-password.c b/capplets/about-me/mate-about-me-password.c index 5800c3ca..2b4f0441 100644 --- a/capplets/about-me/mate-about-me-password.c +++ b/capplets/about-me/mate-about-me-password.c @@ -1094,11 +1094,11 @@ passdlg_init (PasswordDialog *pdialog, GtkWindow *parent) */ /* Initialize pdialog widgets */ - pdialog->current_password = GTK_ENTRY (WID ("current-password")); - pdialog->new_password = GTK_ENTRY (WID ("new-password")); - pdialog->retyped_password = GTK_ENTRY (WID ("retyped-password")); - pdialog->dialog_image = GTK_IMAGE (WID ("dialog-image")); - pdialog->status_label = GTK_LABEL (WID ("status-label")); + pdialog->current_password = GTK_ENTRY (gtk_builder_get_object (dialog, "current-password")); + pdialog->new_password = GTK_ENTRY (gtk_builder_get_object (dialog, "new-password")); + pdialog->retyped_password = GTK_ENTRY (gtk_builder_get_object (dialog, "retyped-password")); + pdialog->dialog_image = GTK_IMAGE (gtk_builder_get_object (dialog, "dialog-image")); + pdialog->status_label = GTK_LABEL (gtk_builder_get_object (dialog, "status-label")); /* Initialize accelerators */ gtk_widget_add_accelerator (GTK_WIDGET (pdialog->current_password), diff --git a/capplets/about-me/mate-about-me.c b/capplets/about-me/mate-about-me.c index b95012e4..bee99fdd 100644 --- a/capplets/about-me/mate-about-me.c +++ b/capplets/about-me/mate-about-me.c @@ -288,13 +288,15 @@ about_me_image_clicked_cb (GtkWidget *button, MateAboutMe *me) dialog = me->dialog; - chooser_dialog = GTK_FILE_CHOOSER ( - gtk_file_chooser_dialog_new (_("Select Image"), GTK_WINDOW (WID ("about-me-dialog")), - GTK_FILE_CHOOSER_ACTION_OPEN, - _("No Image"), GTK_RESPONSE_NO, - "gtk-cancel", GTK_RESPONSE_CANCEL, - "gtk-open", GTK_RESPONSE_ACCEPT, - NULL)); + chooser_dialog = + GTK_FILE_CHOOSER ( + gtk_file_chooser_dialog_new (_("Select Image"), + GTK_WINDOW (gtk_builder_get_object (dialog, "about-me-dialog")), + GTK_FILE_CHOOSER_ACTION_OPEN, + _("No Image"), GTK_RESPONSE_NO, + "gtk-cancel", GTK_RESPONSE_CANCEL, + "gtk-open", GTK_RESPONSE_ACCEPT, + NULL)); gtk_window_set_modal (GTK_WINDOW (chooser_dialog), TRUE); gtk_dialog_set_default_response (GTK_DIALOG (chooser_dialog), GTK_RESPONSE_ACCEPT); @@ -397,7 +399,7 @@ about_me_passwd_clicked_cb (GtkWidget *button, MateAboutMe *me) GtkBuilder *dialog; dialog = me->dialog; - mate_about_me_password (GTK_WINDOW (WID ("about-me-dialog"))); + mate_about_me_password (GTK_WINDOW (gtk_builder_get_object (dialog, "about-me-dialog"))); } static void @@ -444,7 +446,7 @@ about_me_setup_dialog (void) } me->image_chooser = e_image_chooser_new_with_size (MAX_WIDTH, MAX_HEIGHT); - gtk_container_add (GTK_CONTAINER (WID ("button-image")), me->image_chooser); + gtk_container_add (GTK_CONTAINER (gtk_builder_get_object (dialog, "button-image")), me->image_chooser); if (dialog == NULL) { about_me_destroy (); 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); } diff --git a/capplets/keyboard/mate-keyboard-properties-xkbltadd.c b/capplets/keyboard/mate-keyboard-properties-xkbltadd.c index 1edaa666..f8db00d5 100644 --- a/capplets/keyboard/mate-keyboard-properties-xkbltadd.c +++ b/capplets/keyboard/mate-keyboard-properties-xkbltadd.c @@ -155,7 +155,7 @@ xkb_layout_chooser_enable_disable_buttons (GtkBuilder * chooser_dialog) { GtkWidget *cbv = CWID (gtk_notebook_get_current_page - (GTK_NOTEBOOK (CWID ("choosers_nb"))) ? + (GTK_NOTEBOOK (gtk_builder_get_object (chooser_dialog, "choosers_nb"))) ? "xkb_language_variants_available" : "xkb_country_variants_available"); GtkTreeIter viter; @@ -532,7 +532,7 @@ xkb_layout_chooser_get_selected_id (GtkBuilder * chooser_dialog) { GtkWidget *cbv = CWID (gtk_notebook_get_current_page - (GTK_NOTEBOOK (CWID ("choosers_nb"))) ? + (GTK_NOTEBOOK (gtk_builder_get_object (chooser_dialog, "choosers_nb"))) ? "xkb_language_variants_available" : "xkb_country_variants_available"); GtkTreeModel *vm = gtk_combo_box_get_model (GTK_COMBO_BOX (cbv)); diff --git a/capplets/keyboard/mate-keyboard-properties.c b/capplets/keyboard/mate-keyboard-properties.c index b7f1aad2..bb744afb 100644 --- a/capplets/keyboard/mate-keyboard-properties.c +++ b/capplets/keyboard/mate-keyboard-properties.c @@ -41,6 +41,8 @@ #define INTERFACE_SCHEMA "org.mate.interface" #define TYPING_BREAK_SCHEMA "org.mate.typing-break" +#define GET_RANGE(s) GTK_RANGE (gtk_builder_get_object (dialog, s)) + enum { RESPONSE_APPLY = 1, RESPONSE_CLOSE @@ -65,84 +67,59 @@ setup_dialog (GtkBuilder * dialog) { gchar *monitor; - 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); + g_settings_bind (keyboard_settings, "repeat", + gtk_builder_get_object (dialog, "repeat_toggle"), "active", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind (keyboard_settings, "repeat", + gtk_builder_get_object (dialog, "repeat_table"), "sensitive", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind (keyboard_settings, "delay", + gtk_range_get_adjustment (GET_RANGE ("repeat_delay_scale")), "value", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind (keyboard_settings, "rate", + gtk_range_get_adjustment (GET_RANGE ("repeat_speed_scale")), "value", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind (interface_settings, "cursor-blink", + gtk_builder_get_object (dialog, "cursor_toggle"), "active", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind (interface_settings, "cursor-blink", + gtk_builder_get_object (dialog, "cursor_hbox"), "sensitive", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind (interface_settings, "cursor-blink-time", + gtk_range_get_adjustment (GET_RANGE ("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); - 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"), - "value", - G_SETTINGS_BIND_DEFAULT); - g_settings_bind (typing_break_settings, - "allow-postpone", - WID ("break_postponement_toggle"), - "active", - G_SETTINGS_BIND_DEFAULT); + g_settings_bind (typing_break_settings, "enabled", + gtk_builder_get_object (dialog, "break_enabled_toggle"), "active", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind (typing_break_settings, "enabled", + gtk_builder_get_object (dialog, "break_details_table"), "sensitive", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind (typing_break_settings, "type-time", + gtk_builder_get_object (dialog, "break_enabled_spin"), "value", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind (typing_break_settings, "break-time", + gtk_builder_get_object (dialog, "break_interval_spin"), "value", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind (typing_break_settings, "allow-postpone", + gtk_builder_get_object (dialog, "break_postponement_toggle"), "active", + G_SETTINGS_BIND_DEFAULT); } else { /* don't show the typing break tab if the daemon is not available */ - GtkNotebook *nb = GTK_NOTEBOOK (WID ("keyboard_notebook")); + GtkNotebook *nb = GTK_NOTEBOOK (gtk_builder_get_object (dialog, "keyboard_notebook")); gint tb_page = gtk_notebook_page_num (nb, WID ("break_enabled_toggle")); gtk_notebook_remove_page (nb, tb_page); } - g_signal_connect (WID ("keyboard_dialog"), "response", - (GCallback) dialog_response, NULL); + g_signal_connect (gtk_builder_get_object (dialog, "keyboard_dialog"), "response", + (GCallback) dialog_response, + NULL); setup_xkb_tabs (dialog); setup_a11y_tabs (dialog); @@ -198,10 +175,9 @@ main (int argc, char **argv) setup_dialog (dialog); - GtkNotebook* nb = GTK_NOTEBOOK (WID ("keyboard_notebook")); + GtkNotebook* nb = GTK_NOTEBOOK (gtk_builder_get_object (dialog, "keyboard_notebook")); gtk_widget_add_events (GTK_WIDGET (nb), GDK_SCROLL_MASK); - g_signal_connect (GTK_WIDGET (nb), - "scroll-event", + g_signal_connect (nb, "scroll-event", G_CALLBACK (capplet_notebook_scroll_event_cb), NULL); diff --git a/capplets/mouse/mate-mouse-properties.c b/capplets/mouse/mate-mouse-properties.c index 0e112815..d6cea0b4 100644 --- a/capplets/mouse/mate-mouse-properties.c +++ b/capplets/mouse/mate-mouse-properties.c @@ -167,7 +167,7 @@ orientation_radio_button_toggled (GtkToggleButton *togglebutton, GtkBuilder *dialog) { gboolean left_handed; - left_handed = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (WID ("left_handed_radio"))); + left_handed = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object (dialog, "left_handed_radio"))); g_settings_set_boolean (mouse_settings, "left-handed", left_handed); } @@ -205,7 +205,7 @@ synaptics_check_capabilities (GtkBuilder *dialog) /* Property data is booleans for has_left, has_middle, * has_right, has_double, has_triple */ if (!data[0]) { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("tap_to_click_toggle")), TRUE); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object (dialog, "tap_to_click_toggle")), TRUE); gtk_widget_set_sensitive (WID ("tap_to_click_toggle"), FALSE); } @@ -231,7 +231,7 @@ comboxbox_changed (GtkWidget *combobox, GtkBuilder *dialog, const char *key) { gint value = gtk_combo_box_get_active (GTK_COMBO_BOX (combobox)); gint value2, value3; - GtkLabel *warn = GTK_LABEL (WID ("multi_finger_warning")); + GtkLabel *warn = GTK_LABEL (gtk_builder_get_object (dialog, "multi_finger_warning")); g_settings_set_int (touchpad_settings, (const gchar *) key, value); @@ -260,7 +260,7 @@ setup_dialog (GtkBuilder *dialog) GtkRadioButton *radio; /* Orientation radio buttons */ - radio = GTK_RADIO_BUTTON (WID ("left_handed_radio")); + radio = GTK_RADIO_BUTTON (gtk_builder_get_object (dialog, "left_handed_radio")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(radio), g_settings_get_boolean(mouse_settings, "left-handed")); /* explicitly connect to button-release so that you can change orientation with either button */ @@ -285,66 +285,80 @@ setup_dialog (GtkBuilder *dialog) /* Double-click time */ g_settings_bind (mouse_settings, DOUBLE_CLICK_KEY, - gtk_range_get_adjustment (GTK_RANGE (WID ("delay_scale"))), "value", + gtk_range_get_adjustment (GTK_RANGE (gtk_builder_get_object (dialog, "delay_scale"))), "value", G_SETTINGS_BIND_DEFAULT); - gtk_image_set_from_resource (GTK_IMAGE (WID ("double_click_image")), "/org/mate/mcc/mouse/double-click-off.svg"); - g_object_set_data (G_OBJECT (WID ("double_click_eventbox")), "image", WID ("double_click_image")); - g_signal_connect (WID ("double_click_eventbox"), "button_press_event", - G_CALLBACK (event_box_button_press_event), NULL); + gtk_image_set_from_resource (GTK_IMAGE (gtk_builder_get_object (dialog, "double_click_image")), + "/org/mate/mcc/mouse/double-click-off.svg"); + g_object_set_data (gtk_builder_get_object (dialog, "double_click_eventbox"), + "image", WID ("double_click_image")); + g_signal_connect (gtk_builder_get_object (dialog, "double_click_eventbox"), "button_press_event", + G_CALLBACK (event_box_button_press_event), + NULL); /* speed */ g_settings_bind (mouse_settings, "motion-acceleration", - gtk_range_get_adjustment (GTK_RANGE (WID ("accel_scale"))), "value", - G_SETTINGS_BIND_DEFAULT); + gtk_range_get_adjustment (GTK_RANGE (gtk_builder_get_object (dialog, "accel_scale"))), "value", + G_SETTINGS_BIND_DEFAULT); g_settings_bind (mouse_settings, "motion-threshold", - gtk_range_get_adjustment (GTK_RANGE (WID ("sensitivity_scale"))), "value", - G_SETTINGS_BIND_DEFAULT); + gtk_range_get_adjustment (GTK_RANGE (gtk_builder_get_object (dialog, "sensitivity_scale"))), "value", + G_SETTINGS_BIND_DEFAULT); g_signal_connect (WID ("mouse_accel_profile"), "changed", - G_CALLBACK (accel_profile_combobox_changed_callback), NULL); - gtk_combo_box_set_active (GTK_COMBO_BOX (WID ("mouse_accel_profile")), + G_CALLBACK (accel_profile_combobox_changed_callback), + NULL); + gtk_combo_box_set_active (GTK_COMBO_BOX (gtk_builder_get_object (dialog, "mouse_accel_profile")), g_settings_get_enum (mouse_settings, "accel-profile")); /* DnD threshold */ g_settings_bind (mouse_settings, "drag-threshold", - gtk_range_get_adjustment (GTK_RANGE (WID ("drag_threshold_scale"))), "value", - G_SETTINGS_BIND_DEFAULT); + gtk_range_get_adjustment (GTK_RANGE (gtk_builder_get_object (dialog, "drag_threshold_scale"))), "value", + G_SETTINGS_BIND_DEFAULT); /* Trackpad page */ if (touchpad_is_present () == FALSE) - gtk_notebook_remove_page (GTK_NOTEBOOK (WID ("prefs_widget")), -1); + gtk_notebook_remove_page (GTK_NOTEBOOK (gtk_builder_get_object (dialog, "prefs_widget")), -1); else { g_settings_bind (touchpad_settings, "touchpad-enabled", - WID ("touchpad_enable"), "active", - G_SETTINGS_BIND_DEFAULT); + gtk_builder_get_object (dialog, "touchpad_enable"), "active", + G_SETTINGS_BIND_DEFAULT); g_settings_bind (touchpad_settings, "touchpad-enabled", - WID ("vbox_touchpad_general"), "sensitive", - G_SETTINGS_BIND_DEFAULT); + gtk_builder_get_object (dialog, "vbox_touchpad_general"), "sensitive", + G_SETTINGS_BIND_DEFAULT); g_settings_bind (touchpad_settings, "touchpad-enabled", - WID ("vbox_touchpad_scrolling"), "sensitive", - G_SETTINGS_BIND_DEFAULT); + gtk_builder_get_object (dialog, "vbox_touchpad_scrolling"), "sensitive", + G_SETTINGS_BIND_DEFAULT); g_settings_bind (touchpad_settings, "touchpad-enabled", - WID ("vbox_touchpad_pointer_speed"), "sensitive", - G_SETTINGS_BIND_DEFAULT); + gtk_builder_get_object (dialog, "vbox_touchpad_pointer_speed"), "sensitive", + G_SETTINGS_BIND_DEFAULT); g_settings_bind (touchpad_settings, "disable-while-typing", - WID ("disable_w_typing_toggle"), "active", - G_SETTINGS_BIND_DEFAULT); + gtk_builder_get_object (dialog, "disable_w_typing_toggle"), "active", + G_SETTINGS_BIND_DEFAULT); g_settings_bind (touchpad_settings, "tap-to-click", - WID ("tap_to_click_toggle"), "active", - G_SETTINGS_BIND_DEFAULT); - g_settings_bind (touchpad_settings, "vertical-edge-scrolling", WID ("vert_edge_scroll_toggle"), "active", G_SETTINGS_BIND_DEFAULT); - g_settings_bind (touchpad_settings, "horizontal-edge-scrolling", WID ("horiz_edge_scroll_toggle"), "active", G_SETTINGS_BIND_DEFAULT); - g_settings_bind (touchpad_settings, "vertical-two-finger-scrolling", WID ("vert_twofinger_scroll_toggle"), "active", G_SETTINGS_BIND_DEFAULT); - g_settings_bind (touchpad_settings, "horizontal-two-finger-scrolling", WID ("horiz_twofinger_scroll_toggle"), "active", G_SETTINGS_BIND_DEFAULT); - g_settings_bind (touchpad_settings, "natural-scroll", WID ("natural_scroll_toggle"), "active", G_SETTINGS_BIND_DEFAULT); + gtk_builder_get_object (dialog, "tap_to_click_toggle"), "active", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind (touchpad_settings, "vertical-edge-scrolling", + gtk_builder_get_object (dialog, "vert_edge_scroll_toggle"), "active", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind (touchpad_settings, "horizontal-edge-scrolling", + gtk_builder_get_object (dialog, "horiz_edge_scroll_toggle"), "active", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind (touchpad_settings, "vertical-two-finger-scrolling", + gtk_builder_get_object (dialog, "vert_twofinger_scroll_toggle"), "active", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind (touchpad_settings, "horizontal-two-finger-scrolling", + gtk_builder_get_object (dialog, "horiz_twofinger_scroll_toggle"), "active", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind (touchpad_settings, "natural-scroll", + gtk_builder_get_object (dialog, "natural_scroll_toggle"), "active", + G_SETTINGS_BIND_DEFAULT); char * emulation_values[] = { _("Disabled"), _("Left button"), _("Middle button"), _("Right button") }; GtkWidget *two_click_comboxbox = gtk_combo_box_text_new (); GtkWidget *three_click_comboxbox = gtk_combo_box_text_new (); - gtk_box_pack_start (GTK_BOX (WID ("hbox_two_finger_click")), two_click_comboxbox, FALSE, FALSE, 6); - gtk_box_pack_start (GTK_BOX (WID ("hbox_three_finger_click")), three_click_comboxbox, FALSE, FALSE, 6); + gtk_box_pack_start (GTK_BOX (gtk_builder_get_object (dialog, "hbox_two_finger_click")), two_click_comboxbox, FALSE, FALSE, 6); + gtk_box_pack_start (GTK_BOX (gtk_builder_get_object (dialog, "hbox_three_finger_click")), three_click_comboxbox, FALSE, FALSE, 6); int i; for (i=0; i<4; i++) { gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (two_click_comboxbox), emulation_values[i]); @@ -360,11 +374,11 @@ setup_dialog (GtkBuilder *dialog) /* speed */ g_settings_bind (touchpad_settings, "motion-acceleration", - gtk_range_get_adjustment (GTK_RANGE (WID ("touchpad_accel_scale"))), "value", - G_SETTINGS_BIND_DEFAULT); + gtk_range_get_adjustment (GTK_RANGE (gtk_builder_get_object (dialog, "touchpad_accel_scale"))), "value", + G_SETTINGS_BIND_DEFAULT); g_settings_bind (touchpad_settings, "motion-threshold", - gtk_range_get_adjustment (GTK_RANGE (WID ("touchpad_sensitivity_scale"))), "value", - G_SETTINGS_BIND_DEFAULT); + gtk_range_get_adjustment (GTK_RANGE (gtk_builder_get_object (dialog, "touchpad_sensitivity_scale"))), "value", + G_SETTINGS_BIND_DEFAULT); synaptics_check_capabilities (dialog); } @@ -420,10 +434,9 @@ main (int argc, char **argv) g_signal_connect (dialog_win, "response", G_CALLBACK (dialog_response_cb), NULL); - GtkNotebook* nb = GTK_NOTEBOOK (WID ("prefs_widget")); + GtkNotebook* nb = GTK_NOTEBOOK (gtk_builder_get_object (dialog, "prefs_widget")); gtk_widget_add_events (GTK_WIDGET (nb), GDK_SCROLL_MASK); - g_signal_connect (GTK_WIDGET (nb), - "scroll-event", + g_signal_connect (nb, "scroll-event", G_CALLBACK (capplet_notebook_scroll_event_cb), NULL); |