[gnome-settings-daemon] media-keys: Handle the a11y toggle shortcut keys here
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] media-keys: Handle the a11y toggle shortcut keys here
- Date: Wed, 10 Nov 2010 17:21:55 +0000 (UTC)
commit f981f125e4e8f52b2696f50e3233728c8e1c4f3e
Author: Bastien Nocera <hadess hadess net>
Date: Wed Nov 10 17:12:49 2010 +0000
media-keys: Handle the a11y toggle shortcut keys here
Rather than in the keybindings module.
data/gnome-settings-daemon.schemas.in | 158 --------------------
...ngs-daemon.plugins.media-keys.gschema.xml.in.in | 15 ++
plugins/media-keys/acme.h | 6 +
plugins/media-keys/gsd-media-keys-manager.c | 39 +++++
4 files changed, 60 insertions(+), 158 deletions(-)
---
diff --git a/data/gnome-settings-daemon.schemas.in b/data/gnome-settings-daemon.schemas.in
index 386960c..2d25fd5 100644
--- a/data/gnome-settings-daemon.schemas.in
+++ b/data/gnome-settings-daemon.schemas.in
@@ -3,124 +3,6 @@
<schemalist>
<schema>
- <key>/schemas/desktop/gnome/keybindings/magnifier/binding</key>
- <applyto>/desktop/gnome/keybindings/magnifier/binding</applyto>
- <owner>gnome-settings-daemon</owner>
- <type>string</type>
- <default></default>
- <locale name="C">
- <short>Toggle magnifier</short>
- <long>
- Binding to toggle the magnifier.
- </long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/desktop/gnome/keybindings/magnifier/name</key>
- <applyto>/desktop/gnome/keybindings/magnifier/name</applyto>
- <owner>gnome-settings-daemon</owner>
- <type>string</type>
- <locale name="C">
- <default>Toggle magnifier</default>
- <short>The name of the keyboard shortcut to toggle the magnifier</short>
- <long>
- This is the name of the keyboard shortcut to toggle the magnifier. This name will be shown in the keyboard shortcut preferences dialog.
- </long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/desktop/gnome/keybindings/magnifier/action</key>
- <applyto>/desktop/gnome/keybindings/magnifier/action</applyto>
- <owner>gnome-settings-daemon</owner>
- <type>string</type>
- <default>gconftool-2 --toggle /desktop/gnome/applications/at/screen_magnifier_enabled</default>
- <locale name="C">
- <short>Toggle magnifier</short>
- <long>
- Command used to turn the magnifier on or off.
- </long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/desktop/gnome/keybindings/screenreader/binding</key>
- <applyto>/desktop/gnome/keybindings/screenreader/binding</applyto>
- <owner>gnome-settings-daemon</owner>
- <type>string</type>
- <default></default>
- <locale name="C">
- <short>Toggle screen reader</short>
- <long>
- Binding to toggle the screen reader.
- </long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/desktop/gnome/keybindings/screenreader/name</key>
- <applyto>/desktop/gnome/keybindings/screenreader/name</applyto>
- <owner>gnome-settings-daemon</owner>
- <type>string</type>
- <locale name="C">
- <default>Toggle screen reader</default>
- <short>The name of the keyboard shortcut to toggle the screen reader</short>
- <long>
- This is the name of the keyboard shortcut to toggle the screen reader. This name will be shown in the keyboard shortcut preferences dialog.
- </long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/desktop/gnome/keybindings/screenreader/action</key>
- <applyto>/desktop/gnome/keybindings/screenreader/action</applyto>
- <owner>gnome-settings-daemon</owner>
- <type>string</type>
- <default>gconftool-2 --toggle /desktop/gnome/applications/at/screen_reader_enabled</default>
- <locale name="C">
- <short>Toggle screen reader</short>
- <long>
- Command used to turn the screen reader on or off.
- </long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/desktop/gnome/keybindings/onscreenkeyboard/name</key>
- <applyto>/desktop/gnome/keybindings/onscreenkeyboard/name</applyto>
- <owner>gnome-settings-daemon</owner>
- <type>string</type>
- <locale name="C">
- <default>Toggle on-screen keyboard</default>
- <short>The name of the keyboard shortcut to toggle the on-screen keyboard</short>
- <long>
- This is the name of the keyboard shortcut to toggle the on-screen keyboard. This name will be shown in the keyboard shortcut preferences dialog.
- </long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/desktop/gnome/keybindings/onscreenkeyboard/binding</key>
- <applyto>/desktop/gnome/keybindings/onscreenkeyboard/binding</applyto>
- <owner>gnome-settings-daemon</owner>
- <type>string</type>
- <default></default>
- <locale name="C">
- <short>Toggle on-screen keyboard</short>
- <long>
- Binding to toggle the on-screen keyboard.
- </long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/desktop/gnome/keybindings/onscreenkeyboard/action</key>
- <applyto>/desktop/gnome/keybindings/onscreenkeyboard/action</applyto>
- <owner>gnome-settings-daemon</owner>
- <type>string</type>
- <default>gconftool-2 --toggle /desktop/gnome/applications/at/screen_keyboard_enabled</default>
- <locale name="C">
- <short>Toggle on-screen keyboard</short>
- <long>
- Command used to turn the on-screen keyboard on or off.
- </long>
- </locale>
- </schema>
-
- <schema>
<key>/schemas/desktop/gnome/accessibility/keyboard/stickykeys_enable</key>
<applyto>/desktop/gnome/accessibility/keyboard/stickykeys_enable</applyto>
<owner>gnome-settings-daemon</owner>
@@ -172,45 +54,5 @@
</long>
</locale>
</schema>
- <schema>
- <key>/schemas/desktop/gnome/applications/at/screen_keyboard_enabled</key>
- <applyto>/desktop/gnome/applications/at/screen_keyboard_enabled</applyto>
- <owner>gnome-settings-daemon</owner>
- <type>bool</type>
- <default>FALSE</default>
- <locale name="C">
- <short>On-screen keyboard</short>
- <long>
- Whether the on-screen keyboard is turned on.
- </long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/desktop/gnome/applications/at/screen_magnifier_enabled</key>
- <applyto>/desktop/gnome/applications/at/screen_magnifier_enabled</applyto>
- <owner>gnome-settings-daemon</owner>
- <type>bool</type>
- <default>FALSE</default>
- <locale name="C">
- <short>Screen magnifier</short>
- <long>
- Whether the screen magnifier is turned on.
- </long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/desktop/gnome/applications/at/screen_reader_enabled</key>
- <applyto>/desktop/gnome/applications/at/screen_reader_enabled</applyto>
- <owner>gnome-settings-daemon</owner>
- <type>bool</type>
- <default>FALSE</default>
- <locale name="C">
- <short>Screen reader</short>
- <long>
- Whether the screen reader is turned on.
- </long>
- </locale>
- </schema>
-
</schemalist>
</gconfschemafile>
diff --git a/data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in.in b/data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in.in
index 2f8bef4..6665830 100644
--- a/data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in.in
+++ b/data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in.in
@@ -110,5 +110,20 @@
<_summary>Launch web browser</_summary>
<_description>Binding to launch the web browser.</_description>
</key>
+ <key name="magnifier" type="s">
+ <default>''</default>
+ <_summary>Toggle magnifier</_summary>
+ <_description>Binding to show the screen magnifier</_description>
+ </key>
+ <key name="screenreader" type="s">
+ <default>''</default>
+ <_summary>Toggle screen reader</_summary>
+ <_description>Binding to start the screen reader</_description>
+ </key>
+ <key name="on-screen-keyboard" type="s">
+ <default>''</default>
+ <_summary>Toggle on-screen keyboard</_summary>
+ <_description>Binding to show the on-screen keyboard</_description>
+ </key>
</schema>
</schemalist>
diff --git a/plugins/media-keys/acme.h b/plugins/media-keys/acme.h
index 666d926..c6ac917 100644
--- a/plugins/media-keys/acme.h
+++ b/plugins/media-keys/acme.h
@@ -52,6 +52,9 @@ enum {
VIDEO_OUT_KEY,
VIDEO_OUT2_KEY,
ROTATE_VIDEO_KEY,
+ MAGNIFIER_KEY,
+ SCREENREADER_KEY,
+ ON_SCREEN_KEYBOARD_KEY,
HANDLED_KEYS
};
@@ -90,6 +93,9 @@ static struct {
{ VIDEO_OUT2_KEY, NULL, "XF86Display", NULL },
/* Key code of the XF86RotateWindows key (present on some tablets) */
{ ROTATE_VIDEO_KEY, NULL, "XF86RotateWindows", NULL },
+ { MAGNIFIER_KEY, "magnifier", NULL, NULL },
+ { SCREENREADER_KEY, "screenreader", NULL, NULL },
+ { ON_SCREEN_KEYBOARD_KEY, "on-screen-keyboard", NULL, NULL },
};
#endif /* __ACME_H__ */
diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
index eec7d9b..38f36ee 100644
--- a/plugins/media-keys/gsd-media-keys-manager.c
+++ b/plugins/media-keys/gsd-media-keys-manager.c
@@ -1026,6 +1026,36 @@ do_video_rotate_action (GsdMediaKeysManager *manager,
return FALSE;
}
+static void
+do_toggle_accessibility_key (const char *key)
+{
+ GSettings *settings;
+ gboolean state;
+
+ settings = g_settings_new ("org.gnome.desktop.a11y.applications");
+ state = g_settings_get_boolean (settings, key);
+ g_settings_set_boolean (settings, key, !state);
+ g_object_unref (settings);
+}
+
+static void
+do_magnifier_action (GsdMediaKeysManager *manager)
+{
+ do_toggle_accessibility_key ("screen-magnifier-enabled");
+}
+
+static void
+do_screenreader_action (GsdMediaKeysManager *manager)
+{
+ do_toggle_accessibility_key ("screen-reader-enabled");
+}
+
+static void
+do_on_screen_keyboard_action (GsdMediaKeysManager *manager)
+{
+ do_toggle_accessibility_key ("screen-keyboard-enabled");
+}
+
static gboolean
do_action (GsdMediaKeysManager *manager,
int type,
@@ -1118,6 +1148,15 @@ do_action (GsdMediaKeysManager *manager,
case ROTATE_VIDEO_KEY:
do_video_rotate_action (manager, timestamp);
break;
+ case MAGNIFIER_KEY:
+ do_magnifier_action (manager);
+ break;
+ case SCREENREADER_KEY:
+ do_screenreader_action (manager);
+ break;
+ case ON_SCREEN_KEYBOARD_KEY:
+ do_on_screen_keyboard_action (manager);
+ break;
case HANDLED_KEYS:
g_assert_not_reached ();
/* Note, no default so compiler catches missing keys */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]