[gnome-control-center] universal-access: Add hearing section implementation
- From: Thomas Wood <thos src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] universal-access: Add hearing section implementation
- Date: Fri, 4 Jun 2010 16:46:23 +0000 (UTC)
commit d8ae738efe63b733083ff40478333eab20105bfe
Author: Thomas Wood <thomas wood intel com>
Date: Tue Jun 1 11:53:25 2010 +0100
universal-access: Add hearing section implementation
Connect the hearing section widgets to the corresponding gconf keys.
panels/universal-access/cc-ua-panel.c | 163 +++++++++++++++++++++++++++++----
panels/universal-access/uap.ui | 87 +++++++++---------
2 files changed, 189 insertions(+), 61 deletions(-)
---
diff --git a/panels/universal-access/cc-ua-panel.c b/panels/universal-access/cc-ua-panel.c
index 7313217..b5e6a19 100644
--- a/panels/universal-access/cc-ua-panel.c
+++ b/panels/universal-access/cc-ua-panel.c
@@ -145,9 +145,16 @@ static gchar *dwell_click_section[] = {
NULL
};
+static gchar *visual_alerts_section[] = {
+ "hearing_test_flash_button",
+ "hearing_flash_window_title_button",
+ "hearing_flash_screen_button",
+ NULL
+};
+
static void
cc_ua_panel_section_toggled (GtkToggleButton *button,
- CcUaPanel *panel)
+ GtkBuilder *builder)
{
GtkWidget *w;
gboolean enabled;
@@ -159,17 +166,122 @@ cc_ua_panel_section_toggled (GtkToggleButton *button,
for (s = widgets; *s; s++)
{
- w = WID (panel->priv->builder, *s);
+ w = WID (builder, *s);
gtk_widget_set_sensitive (w, enabled);
}
}
+static GConfValue*
+cc_ua_panel_toggle_radios (GConfPropertyEditor *peditor,
+ const GConfValue *value)
+{
+ GtkWidget *radio;
+ gboolean enabled;
+
+ enabled = gconf_value_get_bool (value);
+ radio = (GtkWidget*) gconf_property_editor_get_ui_control (peditor);
+
+
+ if (!enabled)
+ {
+ GSList *list, *l;
+
+ list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio));
+
+ if (list)
+ {
+ /* activate the "off" button */
+ for (l = list; l; l = l->next)
+ {
+ if (l->data == radio)
+ continue;
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (l->data),
+ TRUE);
+ }
+ }
+ }
+
+ return gconf_value_copy (value);
+}
+
+static void
+visual_bell_type_notify_cb (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ CcUaPanel *panel)
+{
+ GtkWidget *widget;
+ const gchar *value = gconf_value_get_string (entry->value);
+
+ if (!strcmp ("frame_flash", value))
+ widget = WID (panel->priv->builder, "hearing_flash_window_title_button");
+ else
+ widget = WID (panel->priv->builder, "hearing_flash_screen_button");
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
+}
+
+static void
+visual_bell_type_toggle_cb (GtkWidget *button,
+ CcUaPanel *panel)
+{
+ const gchar *key = "/apps/metacity/general/visual_bell_type";
+ gboolean window_title;
+
+ window_title = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
+
+ if (window_title)
+ gconf_client_set_string (panel->priv->client, key, "frame_flash", NULL);
+ else
+ gconf_client_set_string (panel->priv->client, key, "fullscreen", NULL);
+}
+
+static void
+cc_ua_panel_init_hearing (CcUaPanel *self)
+{
+ GConfChangeSet *changeset = NULL;
+ CcUaPanelPrivate *priv = self->priv;
+ GtkWidget *w;
+ GConfEntry *entry;
+
+ gconf_client_add_dir (priv->client, "/apps/metacity/general",
+ GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
+
+ w = WID (priv->builder, "hearing_visual_alerts_on_radiobutton");
+ g_object_set_data (G_OBJECT (w), "section-widgets", visual_alerts_section);
+ g_signal_connect (w, "toggled", G_CALLBACK (cc_ua_panel_section_toggled),
+ priv->builder);
+ gconf_peditor_new_boolean (changeset, "/apps/metacity/general/visual_bell", w,
+ NULL);
+
+ /* visual bell type */
+ gconf_client_notify_add (priv->client,
+ "/apps/metacity/general/visual_bell_type",
+ (GConfClientNotifyFunc) visual_bell_type_notify_cb,
+ self, NULL, NULL);
+ /* set the initial value */
+ entry = gconf_client_get_entry (priv->client,
+ "/apps/metacity/general/visual_bell_type",
+ NULL, TRUE, NULL);
+ visual_bell_type_notify_cb (priv->client, 0, entry, self);
+
+ g_signal_connect (WID (priv->builder, "hearing_flash_window_title_button"),
+ "toggled", G_CALLBACK (visual_bell_type_toggle_cb), self);
+
+ /* test flash */
+ g_signal_connect (WID (priv->builder, "hearing_test_flash_button"),
+ "clicked", G_CALLBACK (gdk_beep), NULL);
+
+}
+
static void
cc_ua_panel_init_keyboard (CcUaPanel *self)
{
CcUaPanelPrivate *priv = self->priv;
GConfChangeSet *changeset = NULL;
GtkWidget *w;
+ GObject *peditor;
/* enable shortcuts */
@@ -178,11 +290,14 @@ cc_ua_panel_init_keyboard (CcUaPanel *self)
/* sticky keys */
w = WID (priv->builder, "typing_sticky_keys_on_radiobutton");
- gconf_peditor_new_boolean (changeset, KEY_CONFIG_ROOT "/stickeykeys_enable",
- w, NULL);
g_object_set_data (G_OBJECT (w), "section-widgets", sticky_keys_section);
g_signal_connect (w, "toggled", G_CALLBACK (cc_ua_panel_section_toggled),
- self);
+ priv->builder);
+
+ peditor = gconf_peditor_new_boolean (changeset,
+ KEY_CONFIG_ROOT "/stickykeys_enable", w,
+ NULL);
+ g_object_set (peditor, "conv-to-widget-cb", cc_ua_panel_toggle_radios, NULL);
w = WID (priv->builder, "typing_sticky_keys_disable_two_keys_checkbutton");
gconf_peditor_new_boolean (changeset,
@@ -196,11 +311,14 @@ cc_ua_panel_init_keyboard (CcUaPanel *self)
/* slow keys */
w = WID (priv->builder, "typing_slow_keys_on_radiobutton");
- gconf_peditor_new_boolean (changeset, KEY_CONFIG_ROOT "/slowkeys_enable", w,
- NULL);
g_object_set_data (G_OBJECT (w), "section-widgets", slow_keys_section);
g_signal_connect (w, "toggled", G_CALLBACK (cc_ua_panel_section_toggled),
- self);
+ priv->builder);
+
+ peditor = gconf_peditor_new_boolean (changeset,
+ KEY_CONFIG_ROOT "/slowkeys_enable", w,
+ NULL);
+ g_object_set (peditor, "conv-to-widget-cb", cc_ua_panel_toggle_radios, NULL);
w = WID (priv->builder, "typing_slowkeys_delay_scale");
gconf_peditor_new_numeric_range (changeset, KEY_CONFIG_ROOT "/slowkeys_delay",
@@ -220,11 +338,14 @@ cc_ua_panel_init_keyboard (CcUaPanel *self)
/* bounce keys */
w = WID (priv->builder, "typing_bounce_keys_on_radiobutton");
- gconf_peditor_new_boolean (changeset, KEY_CONFIG_ROOT "/bouncekeys_enable",
- w, NULL);
g_object_set_data (G_OBJECT (w), "section-widgets", bounce_keys_section);
g_signal_connect (w, "toggled", G_CALLBACK (cc_ua_panel_section_toggled),
- self);
+ priv->builder);
+
+ peditor = gconf_peditor_new_boolean (changeset,
+ KEY_CONFIG_ROOT "/bouncekeys_enable", w,
+ NULL);
+ g_object_set (peditor, "conv-to-widget-cb", cc_ua_panel_toggle_radios, NULL);
w = WID (priv->builder, "typing_bouncekeys_delay_scale");
gconf_peditor_new_numeric_range (changeset,
@@ -235,8 +356,6 @@ cc_ua_panel_init_keyboard (CcUaPanel *self)
gconf_peditor_new_boolean (changeset,
KEY_CONFIG_ROOT "/bouncekeys_beep_reject", w,
NULL);
-
-
}
static void
@@ -244,6 +363,7 @@ cc_ua_panel_init_mouse (CcUaPanel *self)
{
CcUaPanelPrivate *priv = self->priv;
GConfChangeSet *changeset = NULL;
+ GObject *peditor;
GtkWidget *w;
/* mouse keys */
@@ -254,11 +374,13 @@ cc_ua_panel_init_mouse (CcUaPanel *self)
/* simulated secondary click */
w = WID (priv->builder, "pointing_second_click_on_radiobutton");
- gconf_peditor_new_boolean (changeset,
- MOUSE_CONFIG_ROOT "/delay_enable", w, NULL);
g_object_set_data (G_OBJECT (w), "section-widgets", secondary_click_section);
g_signal_connect (w, "toggled", G_CALLBACK (cc_ua_panel_section_toggled),
- self);
+ priv->builder);
+ peditor = gconf_peditor_new_boolean (changeset,
+ MOUSE_CONFIG_ROOT "/delay_enable", w,
+ NULL);
+ g_object_set (peditor, "conv-to-widget-cb", cc_ua_panel_toggle_radios, NULL);
w = WID (priv->builder, "pointing_secondary_click_delay_scale");
gconf_peditor_new_numeric_range (changeset,
@@ -268,11 +390,13 @@ cc_ua_panel_init_mouse (CcUaPanel *self)
/* dwell click */
w = WID (priv->builder, "pointing_hover_click_on_radiobutton");
- gconf_peditor_new_boolean (changeset,
- MOUSE_CONFIG_ROOT "/dwell_enable", w, NULL);
g_object_set_data (G_OBJECT (w), "section-widgets", dwell_click_section);
g_signal_connect (w, "toggled", G_CALLBACK (cc_ua_panel_section_toggled),
- self);
+ priv->builder);
+ peditor = gconf_peditor_new_boolean (changeset,
+ MOUSE_CONFIG_ROOT "/dwell_enable", w,
+ NULL);
+ g_object_set (peditor, "conv-to-widget-cb", cc_ua_panel_toggle_radios, NULL);
w = WID (priv->builder, "pointing_dwell_delay_scale");
gconf_peditor_new_numeric_range (changeset,
@@ -324,6 +448,7 @@ cc_ua_panel_init (CcUaPanel *self)
cc_ua_panel_init_keyboard (self);
cc_ua_panel_init_mouse (self);
+ cc_ua_panel_init_hearing (self);
widget = (GtkWidget*) gtk_builder_get_object (priv->builder,
"universal_access_box");
diff --git a/panels/universal-access/uap.ui b/panels/universal-access/uap.ui
index bd6d7a1..a3aa651 100644
--- a/panels/universal-access/uap.ui
+++ b/panels/universal-access/uap.ui
@@ -449,6 +449,7 @@
<property name="receives_default">False</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
+ <property name="group">seeing_zoom_off_radiobutton</property>
<child>
<object class="GtkLabel" id="label16">
<property name="visible">True</property>
@@ -470,7 +471,6 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
- <property name="group">seeing_zoom_on_radiobutton</property>
<child>
<object class="GtkLabel" id="label19">
<property name="visible">True</property>
@@ -729,6 +729,7 @@
<property name="receives_default">False</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
+ <property name="group">seeing_reader_off_radiobutton</property>
<child>
<object class="GtkLabel" id="label23">
<property name="visible">True</property>
@@ -750,7 +751,6 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
- <property name="group">seeing_reader_on_radiobutton</property>
<child>
<object class="GtkLabel" id="label20">
<property name="visible">True</property>
@@ -929,6 +929,7 @@
<property name="receives_default">False</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
+ <property name="group">hearing_visual_alerts_off_radiobutton</property>
</object>
<packing>
<property name="expand">False</property>
@@ -942,7 +943,6 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
- <property name="group">hearing_visual_alerts_on_radiobutton</property>
</object>
<packing>
<property name="expand">False</property>
@@ -969,6 +969,7 @@
<object class="GtkButton" id="hearing_test_flash_button">
<property name="label" translatable="yes">Test flash</property>
<property name="visible">True</property>
+ <property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
@@ -982,6 +983,7 @@
<object class="GtkRadioButton" id="hearing_flash_window_title_button">
<property name="label" translatable="yes">Flash the window title</property>
<property name="visible">True</property>
+ <property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="relief">none</property>
@@ -999,6 +1001,7 @@
<object class="GtkRadioButton" id="hearing_flash_screen_button">
<property name="label" translatable="yes">Flash the entire screen</property>
<property name="visible">True</property>
+ <property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
@@ -1094,6 +1097,7 @@
<property name="receives_default">False</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
+ <property name="group">hearing_captions_off_radiobutton</property>
</object>
<packing>
<property name="expand">False</property>
@@ -1101,13 +1105,12 @@
</packing>
</child>
<child>
- <object class="GtkRadioButton" id="hearing_haptions_off_radiobutton">
+ <object class="GtkRadioButton" id="hearing_captions_off_radiobutton">
<property name="label" translatable="yes">Off</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
- <property name="group">hearing_captions_on_radiobutton</property>
</object>
<packing>
<property name="expand">False</property>
@@ -1239,6 +1242,7 @@
<property name="receives_default">False</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
+ <property name="group">typing_assistant_off_radiobutton1</property>
</object>
<packing>
<property name="expand">False</property>
@@ -1252,7 +1256,6 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
- <property name="group">typing_assistant_on_radiobutton1</property>
</object>
<packing>
<property name="expand">False</property>
@@ -1346,6 +1349,7 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
+ <property name="group">typing_sticky_keys_off_radiobutton</property>
</object>
<packing>
<property name="expand">False</property>
@@ -1360,7 +1364,6 @@
<property name="receives_default">False</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
- <property name="group">typing_sticky_keys_on_radiobutton</property>
</object>
<packing>
<property name="expand">False</property>
@@ -1466,6 +1469,7 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
+ <property name="group">typing_slow_keys_off_radiobutton</property>
</object>
<packing>
<property name="expand">False</property>
@@ -1480,7 +1484,6 @@
<property name="receives_default">False</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
- <property name="group">typing_slow_keys_on_radiobutton</property>
</object>
<packing>
<property name="expand">False</property>
@@ -1704,6 +1707,7 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
+ <property name="group">typing_bounce_keys_off_radiobutton</property>
</object>
<packing>
<property name="expand">False</property>
@@ -1718,7 +1722,6 @@
<property name="receives_default">False</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
- <property name="group">typing_bounce_keys_on_radiobutton</property>
</object>
<packing>
<property name="expand">False</property>
@@ -1969,6 +1972,7 @@
<property name="receives_default">False</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
+ <property name="group">pointing_mouse_keys_off_radiobutton</property>
</object>
<packing>
<property name="expand">False</property>
@@ -1982,7 +1986,6 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
- <property name="group">pointing_mouse_keys_on_radiobutton</property>
</object>
<packing>
<property name="expand">False</property>
@@ -2078,6 +2081,7 @@
<property name="receives_default">False</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
+ <property name="group">pointing_video_mouse_off_radiobutton</property>
</object>
<packing>
<property name="expand">False</property>
@@ -2091,7 +2095,6 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
- <property name="group">pointing_video_mouse_on_radiobutton</property>
</object>
<packing>
<property name="expand">False</property>
@@ -2187,6 +2190,7 @@
<property name="receives_default">False</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
+ <property name="group">pointing_second_click_off_radiobutton</property>
</object>
<packing>
<property name="expand">False</property>
@@ -2200,7 +2204,6 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
- <property name="group">pointing_second_click_on_radiobutton</property>
</object>
<packing>
<property name="expand">False</property>
@@ -2381,6 +2384,7 @@
<property name="receives_default">False</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
+ <property name="group">pointing_hover_click_off_radiobutton</property>
</object>
<packing>
<property name="expand">False</property>
@@ -2394,7 +2398,6 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
- <property name="group">pointing_hover_click_on_radiobutton</property>
</object>
<packing>
<property name="expand">False</property>
@@ -2717,10 +2720,10 @@
</object>
<object class="GtkSizeGroup" id="seeing_sizegroup">
<widgets>
- <widget name="seeing_contrast_box"/>
- <widget name="seeing_text_size_box"/>
- <widget name="seeing_zoom_enabled_box"/>
<widget name="seeing_reader_enabled_box"/>
+ <widget name="seeing_zoom_enabled_box"/>
+ <widget name="seeing_text_size_box"/>
+ <widget name="seeing_contrast_box"/>
</widgets>
</object>
<object class="GtkListStore" id="contrast_model">
@@ -2757,58 +2760,58 @@
</object>
<object class="GtkSizeGroup" id="typing_sizegroup">
<widgets>
- <widget name="typing_assistant_enabled_box"/>
- <widget name="typing_sticky_keys_enabled_box"/>
- <widget name="typing_slow_keys_enabled_box"/>
- <widget name="typing_slowkeys_delay_label"/>
- <widget name="typing_bounce_keys_enabled_box"/>
<widget name="typing_bouncekeys_delay_label"/>
+ <widget name="typing_bounce_keys_enabled_box"/>
+ <widget name="typing_slowkeys_delay_label"/>
+ <widget name="typing_slow_keys_enabled_box"/>
+ <widget name="typing_sticky_keys_enabled_box"/>
+ <widget name="typing_assistant_enabled_box"/>
</widgets>
</object>
<object class="GtkSizeGroup" id="pointing_sizegroup">
<widgets>
- <widget name="pointing_mouse_keys_enabled_box"/>
- <widget name="pointing_video_mouse_enabled_box"/>
- <widget name="pointing_second_click_enabled_box"/>
- <widget name="pointing_secondary_click_delay_label"/>
- <widget name="pointing_hover_click_enabled_box"/>
- <widget name="pointing_dwell_delay_label"/>
<widget name="pointing_dwell_threshold_label"/>
+ <widget name="pointing_dwell_delay_label"/>
+ <widget name="pointing_hover_click_enabled_box"/>
+ <widget name="pointing_secondary_click_delay_label"/>
+ <widget name="pointing_second_click_enabled_box"/>
+ <widget name="pointing_video_mouse_enabled_box"/>
+ <widget name="pointing_mouse_keys_enabled_box"/>
</widgets>
</object>
<object class="GtkSizeGroup" id="pointing_sizegroup2">
<widgets>
- <widget name="pointing_mouse_keys_desc_label"/>
- <widget name="pointing_video_mouse_desc_label"/>
- <widget name="pointing_secondary_click_desc_label"/>
- <widget name="pointing_secondary_click_scale_box"/>
- <widget name="pointing_hover_click_desc_label"/>
- <widget name="pointing_hover_click_delay_scale_box"/>
<widget name="pointing_hover_click_threshold_scale_box"/>
+ <widget name="pointing_hover_click_delay_scale_box"/>
+ <widget name="pointing_hover_click_desc_label"/>
+ <widget name="pointing_secondary_click_scale_box"/>
+ <widget name="pointing_secondary_click_desc_label"/>
+ <widget name="pointing_video_mouse_desc_label"/>
+ <widget name="pointing_mouse_keys_desc_label"/>
</widgets>
</object>
<object class="GtkSizeGroup" id="pointing_scale_sizegroup">
<widgets>
- <widget name="pointing_secondary_click_delay_short_label"/>
- <widget name="pointing_secondary_click_delay_long_label"/>
- <widget name="pointing_dwell_delay_short_label"/>
- <widget name="pointing_dwell_delay_long_label"/>
- <widget name="pointing_dwell_threshold_small_label"/>
<widget name="pointing_dwell_threshold_large_label"/>
+ <widget name="pointing_dwell_threshold_small_label"/>
+ <widget name="pointing_dwell_delay_long_label"/>
+ <widget name="pointing_dwell_delay_short_label"/>
+ <widget name="pointing_secondary_click_delay_long_label"/>
+ <widget name="pointing_secondary_click_delay_short_label"/>
</widgets>
</object>
<object class="GtkSizeGroup" id="sizegroup1">
<widgets>
- <widget name="pointing_mouse_keys_settings_button"/>
- <widget name="pointing_video_mouse_settings_button"/>
- <widget name="pointing_secondary_click_spacer_label"/>
<widget name="pointing_hover_click_settings_button"/>
+ <widget name="pointing_secondary_click_spacer_label"/>
+ <widget name="pointing_video_mouse_settings_button"/>
+ <widget name="pointing_mouse_keys_settings_button"/>
</widgets>
</object>
<object class="GtkSizeGroup" id="hearing_sizegroup">
<widgets>
- <widget name="hearing_visual_alerts_enabled_box"/>
<widget name="hearing_captions_enabled_box"/>
+ <widget name="hearing_visual_alerts_enabled_box"/>
</widgets>
</object>
</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]