From 0b53a560db3aae0eeb1ca30e4f5ab6b9e87503f5 Mon Sep 17 00:00:00 2001 From: Felipe Borges Date: Fri, 30 Oct 2015 10:19:23 +0100 Subject: [PATCH] universal-access: add Repeat Keys to the Typing section According to the new Keyboard panel design, this setting belongs to the Universal Access panel. https://bugzilla.gnome.org/show_bug.cgi?id=757464 --- panels/universal-access/cc-ua-panel.c | 44 ++++ panels/universal-access/uap.ui | 289 ++++++++++++++++++++++++++ 2 files changed, 333 insertions(+) diff --git a/panels/universal-access/cc-ua-panel.c b/panels/universal-access/cc-ua-panel.c index bf0041e5e..278a3345a 100644 --- a/panels/universal-access/cc-ua-panel.c +++ b/panels/universal-access/cc-ua-panel.c @@ -78,6 +78,10 @@ #define KEY_MOUSEKEYS_ENABLED "mousekeys-enable" #define KEY_TOGGLEKEYS_ENABLED "togglekeys-enable" +/* keyboard desktop settings */ +#define KEYBOARD_DESKTOP_SETTINGS "org.gnome.desktop.peripherals.keyboard" +#define KEY_REPEAT_KEYS "repeat" + /* mouse settings */ #define MOUSE_SETTINGS "org.gnome.desktop.a11y.mouse" #define KEY_SECONDARY_CLICK_ENABLED "secondary-click-enabled" @@ -103,6 +107,7 @@ struct _CcUaPanelPrivate GSettings *interface_settings; GSettings *kb_settings; GSettings *mouse_settings; + GSettings *kb_desktop_settings; GSettings *application_settings; GSettings *gsd_mouse_settings; @@ -565,6 +570,19 @@ cc_ua_panel_init_hearing (CcUaPanel *self) } /* typing/keyboard section */ +static void +on_repeat_keys_toggled (GSettings *settings, const gchar *key, CcUaPanel *self) +{ + gboolean on; + + on = g_settings_get_boolean (settings, KEY_REPEAT_KEYS); + + gtk_label_set_text (GTK_LABEL (WID ("value_repeat_keys")), on ? _("On") : _("Off")); + + gtk_widget_set_sensitive (WID ("repeat-keys-delay-grid"), on); + gtk_widget_set_sensitive (WID ("repeat-keys-speed-grid"), on); +} + static void update_accessx_label (GSettings *settings, const gchar *key, CcUaPanel *self) { @@ -600,6 +618,31 @@ cc_ua_panel_init_keyboard (CcUaPanel *self) sw, "active", G_SETTINGS_BIND_DEFAULT); + /* Repeat keys */ + g_signal_connect (priv->kb_desktop_settings, "changed", + G_CALLBACK (on_repeat_keys_toggled), self); + + dialog = WID ("repeat_keys_dialog"); + priv->toplevels = g_slist_prepend (priv->toplevels, dialog); + + g_object_set_data (G_OBJECT (WID ("row_repeat_keys")), "dialog", dialog); + + g_signal_connect (dialog, "delete-event", + G_CALLBACK (gtk_widget_hide_on_delete), NULL); + + sw = WID ("repeat_keys_switch"); + g_settings_bind (priv->kb_desktop_settings, KEY_REPEAT_KEYS, + sw, "active", + G_SETTINGS_BIND_DEFAULT); + on_repeat_keys_toggled (priv->kb_desktop_settings, NULL, self); + + g_settings_bind (priv->kb_desktop_settings, "delay", + gtk_range_get_adjustment (GTK_RANGE (WID ("repeat_keys_delay_scale"))), "value", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind (priv->kb_desktop_settings, "repeat-interval", + gtk_range_get_adjustment (GTK_RANGE (WID ("repeat_keys_speed_scale"))), "value", + G_SETTINGS_BIND_DEFAULT); + /* accessx */ g_signal_connect (priv->kb_settings, "changed", G_CALLBACK (update_accessx_label), self); @@ -807,6 +850,7 @@ cc_ua_panel_init (CcUaPanel *self) priv->a11y_settings = g_settings_new (A11Y_SETTINGS); priv->wm_settings = g_settings_new (WM_SETTINGS); priv->kb_settings = g_settings_new (KEYBOARD_SETTINGS); + priv->kb_desktop_settings = g_settings_new (KEYBOARD_DESKTOP_SETTINGS); priv->mouse_settings = g_settings_new (MOUSE_SETTINGS); priv->gsd_mouse_settings = g_settings_new (GSD_MOUSE_SETTINGS); priv->application_settings = g_settings_new (APPLICATION_SETTINGS); diff --git a/panels/universal-access/uap.ui b/panels/universal-access/uap.ui index dc1da63d6..c49eab967 100644 --- a/panels/universal-access/uap.ui +++ b/panels/universal-access/uap.ui @@ -7,6 +7,20 @@ 100 100 + + 100 + 2000 + 500 + 10 + 10 + + + 0.5 + 110 + 33.3 + 1 + 1 + True @@ -552,6 +566,52 @@ + + + True + True + + + True + + + True + False + 20 + 20 + 6 + 6 + 0 + _Repeat Keys + True + + + True + True + 0 + + + + + True + False + 20 + 20 + 6 + 6 + 1 + Off + + + False + True + 1 + + + + + + True @@ -1162,6 +1222,235 @@ 10 10 + + False + 5 + Repeat Keys + False + True + dialog + 1 + + + True + + + True + True + + + end + + + + + + + False + vertical + + + True + True + False + 0 + Key presses repeat when key is held down. + 12 + 6 + 6 + 12 + + + True + True + 0 + + + + + True + False + start + 12 + 6 + 6 + 12 + vertical + 18 + 24 + + + True + False + start + vertical + 6 + + + True + False + vertical + + + True + True + False + 0 + Delay + repeat_keys_delay_scale + + + + + + False + True + 0 + + + + + False + True + 0 + + + + + 0 + 1 + 1 + 1 + + + + + True + True + True + repeat_delay_adjustment + False + 400 + + + Repeat keys delay + + + + + 1 + 1 + 1 + 1 + + + + + True + True + 1 + + + + + True + False + start + 12 + 6 + 6 + 12 + vertical + 18 + 24 + + + True + False + start + vertical + 6 + + + True + False + vertical + + + True + True + False + 0 + Speed + repeat_keys_speed_scale + + + + + + False + True + 0 + + + + + False + True + 0 + + + + + 0 + 1 + 1 + 1 + + + + + True + True + True + repeat_speed_adjustment + False + 200 + + + Repeat keys speed + + + + + 1 + 1 + 1 + 1 + + + + + True + True + 2 + + + + + + + + + + + + + + + + + False 5