static void
notifications_button_clicked_cb (GtkWidget *button, GladeXML *dialog)
{
	GtkWidget *w;

	notifications_dialog = glade_xml_new (GNOMECC_GLADE_DIR
					      "/gnome-keyboard-properties.glade",
					      "a11y_notifications_dialog", NULL);

	stickykeys_enable_toggled_cb (WID ("stickykeys_enable"), dialog);
	slowkeys_enable_toggled_cb (WID ("slowkeys_enable"), dialog);
	bouncekeys_enable_toggled_cb (WID ("bouncekeys_enable"), dialog);

	w = NWID ("feature_state_change_beep");
	gconf_peditor_new_boolean (NULL,
	                          CONFIG_ROOT "/feature_state_change_beep",
	                          w, NULL);

	w = NWID ("togglekeys_enable");
	gconf_peditor_new_boolean (NULL,
	                          CONFIG_ROOT "/togglekeys_enable",
	                          w, NULL);

	w = NWID ("stickykeys_modifier_beep");
	gconf_peditor_new_boolean (NULL,
	                          CONFIG_ROOT "/stickykeys_modifier_beep",
	                          w, NULL);

	w = NWID ("slowkeys_beep_press");
	gconf_peditor_new_boolean (NULL,
	                          CONFIG_ROOT "/slowkeys_beep_press",
	                          w, NULL);

	w = NWID ("slowkeys_beep_accept");
	gconf_peditor_new_boolean (NULL,
	                          CONFIG_ROOT "/slowkeys_beep_accept",
	                          w, NULL);

	w = NWID ("slowkeys_beep_reject");
	gconf_peditor_new_boolean (NULL,
	                          CONFIG_ROOT "/slowkeys_beep_reject",
	                          w, NULL);

	w = NWID ("bouncekeys_beep_reject");
	gconf_peditor_new_boolean (NULL,
	                          CONFIG_ROOT "/bouncekeys_beep_reject",
	                          w, NULL);

	w = NWID ("a11y_notifications_dialog");
	gtk_window_set_transient_for (GTK_WINDOW (w),
	                              GTK_WINDOW (WID ("keyboard_dialog")));
	g_signal_connect (w, "response",
			  G_CALLBACK (a11y_notifications_dialog_response_cb), NULL);

	gtk_dialog_run (GTK_DIALOG (w));

	g_object_unref (notifications_dialog);
	notifications_dialog = NULL;
}
void
setup_a11y_tabs (GtkBuilder *dialog)
{
	GtkWidget *w;

	a11y_settings = g_settings_new (A11Y_SCHEMA);

	/* Accessibility tab */
	g_settings_bind (a11y_settings,
					 "enable",
					 WID ("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_signal_connect (w, "toggled",
			  G_CALLBACK (stickykeys_enable_toggled_cb), dialog);
	stickykeys_enable_toggled_cb (w, dialog);

	g_settings_bind (a11y_settings,
					 "stickykeys-two-key-off",
					 WID ("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_signal_connect (w, "toggled",
			  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_signal_connect (w, "toggled",
			  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);

	/* Mouse Keys tab */

	w = WID ("mousekeys_enable");
	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);

#if !GTK_CHECK_VERSION (3, 0, 0)
	const char *range_names[] = {
		"slowkeys_delay_slide",
		"bouncekeys_delay_slide",
		"mousekeys_accel_time_slide",
		"mousekeys_max_speed_slide",
		"mousekeys_init_delay_slide"
	};

	int i;
	for (i = 0; i < 5; ++i) {
		gtk_range_set_update_policy (GTK_RANGE (WID (range_names[i])), GTK_UPDATE_DISCONTINUOUS);
	}
#endif
}
static void
notifications_button_clicked_cb (GtkWidget *button, GtkBuilder *dialog)
{
	GtkWidget *w;

    notifications_dialog = gtk_builder_new ();
    gtk_builder_add_from_file (notifications_dialog, MATECC_UI_DIR
                               "/mate-keyboard-properties-a11y-notifications.ui",
                               NULL);

	stickykeys_enable_toggled_cb (WID ("stickykeys_enable"), 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);

	w = NWID ("togglekeys_enable");
	g_settings_bind (a11y_settings, "togglekeys-enable", w, "active", G_SETTINGS_BIND_DEFAULT);

	w = NWID ("stickykeys_modifier_beep");
	g_settings_bind (a11y_settings, "stickykeys-modifier-beep", w, "active", G_SETTINGS_BIND_DEFAULT);

	w = NWID ("slowkeys_beep_press");
	g_settings_bind (a11y_settings, "slowkeys-beep-press", w, "active", G_SETTINGS_BIND_DEFAULT);

	w = NWID ("slowkeys_beep_accept");
	g_settings_bind (a11y_settings, "slowkeys-beep-accept", w, "active", G_SETTINGS_BIND_DEFAULT);

	w = NWID ("slowkeys_beep_reject");
	g_settings_bind (a11y_settings, "slowkeys-beep-reject", w, "active", G_SETTINGS_BIND_DEFAULT);

	w = NWID ("bouncekeys_beep_reject");
	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");
	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),
	                              GTK_WINDOW (WID ("keyboard_dialog")));
	g_signal_connect (w, "response",
			  G_CALLBACK (a11y_notifications_dialog_response_cb), NULL);

	gtk_dialog_run (GTK_DIALOG (w));

	g_object_unref (marco_settings);
	g_object_unref (notifications_dialog);
	notifications_dialog = NULL;
}
void
setup_a11y_tabs (GladeXML *dialog, GConfChangeSet *changeset)
{
	GConfClient *client;
	GtkWidget *w;

	client = gconf_client_get_default ();
	gconf_client_add_dir (client, CONFIG_ROOT, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
	g_object_unref (client);

	/* Accessibility tab */

	w = WID ("master_enable");
	gconf_peditor_new_boolean (changeset,
				   CONFIG_ROOT "/enable",
				   w, NULL);

	w = WID ("stickykeys_enable");
	gconf_peditor_new_boolean (changeset,
				   CONFIG_ROOT "/stickykeys_enable",
				   w, NULL);
	g_signal_connect (w, "toggled",
			  G_CALLBACK (stickykeys_enable_toggled_cb), dialog);
	stickykeys_enable_toggled_cb (w, dialog);

	w = WID ("slowkeys_enable");
	gconf_peditor_new_boolean (changeset,
				   CONFIG_ROOT "/slowkeys_enable",
				   w, NULL);
	g_signal_connect (w, "toggled",
			  G_CALLBACK (slowkeys_enable_toggled_cb), dialog);
	slowkeys_enable_toggled_cb (w, dialog);

	w = WID ("bouncekeys_enable");
	gconf_peditor_new_boolean (changeset,
				   CONFIG_ROOT "/bouncekeys_enable",
				   w, NULL);
	g_signal_connect (w, "toggled",
			  G_CALLBACK (bouncekeys_enable_toggled_cb), dialog);
	bouncekeys_enable_toggled_cb (w, dialog);

	gconf_peditor_new_numeric_range (changeset,
					 CONFIG_ROOT "/slowkeys_delay",
					 WID ("slowkeys_delay_slide"), NULL);
	gconf_peditor_new_numeric_range (changeset,
					 CONFIG_ROOT "/bouncekeys_delay",
					 WID ("bouncekeys_delay_slide"), NULL);

	w = WID ("notifications_button");
	g_signal_connect (w, "clicked",
			  G_CALLBACK (notifications_button_clicked_cb), dialog);

	/* Mouse Keys tab */

	w = WID ("mousekeys_enable");
	gconf_peditor_new_boolean (changeset,
				   CONFIG_ROOT "/mousekeys_enable",
				   w, NULL);
	g_signal_connect (w, "toggled",
			  G_CALLBACK (mousekeys_enable_toggled_cb), dialog);
	mousekeys_enable_toggled_cb (w, dialog);

	gconf_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);
	gconf_peditor_new_numeric_range (changeset,
					 CONFIG_ROOT "/mousekeys_max_speed",
					 WID ("mousekeys_max_speed_slide"), NULL);
	gconf_peditor_new_numeric_range (changeset,
					 CONFIG_ROOT "/mousekeys_init_delay",
					 WID ("mousekeys_init_delay_slide"), NULL);
}
void
setup_a11y_tabs (GtkBuilder *dialog)
{
	GtkWidget *w;

	a11y_settings = g_settings_new (A11Y_SCHEMA);

	/* Accessibility tab */
	g_settings_bind (a11y_settings,
					 "enable",
					 WID ("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_signal_connect (w, "toggled",
			  G_CALLBACK (stickykeys_enable_toggled_cb), dialog);
	stickykeys_enable_toggled_cb (w, dialog);

	g_settings_bind (a11y_settings,
					 "stickykeys-two-key-off",
					 WID ("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_signal_connect (w, "toggled",
			  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_signal_connect (w, "toggled",
			  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);

	/* Mouse Keys tab */

	w = WID ("mousekeys_enable");
	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);
}