diff options
author | infirit <[email protected]> | 2014-11-02 15:04:36 +0100 |
---|---|---|
committer | infirit <[email protected]> | 2014-11-02 17:43:10 +0100 |
commit | b8e3a26d0975cb43cb5a315bceaf581f6ea2a5a8 (patch) | |
tree | ec0df37035271d681b220c966bcafc8d5943ba90 /plugins | |
parent | af56e3974762769171f51378fde8cb63da5db1fd (diff) | |
download | mate-settings-daemon-b8e3a26d0975cb43cb5a315bceaf581f6ea2a5a8.tar.bz2 mate-settings-daemon-b8e3a26d0975cb43cb5a315bceaf581f6ea2a5a8.tar.xz |
a11y-keybindings: Move to media-keys plugin
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/media-keys/acme.h | 6 | ||||
-rw-r--r-- | plugins/media-keys/msd-media-keys-manager.c | 39 |
2 files changed, 45 insertions, 0 deletions
diff --git a/plugins/media-keys/acme.h b/plugins/media-keys/acme.h index 0f87bc6..17ce1ed 100644 --- a/plugins/media-keys/acme.h +++ b/plugins/media-keys/acme.h @@ -45,6 +45,9 @@ enum { STOP_KEY, PREVIOUS_KEY, NEXT_KEY, + MAGNIFIER_KEY, + SCREENREADER_KEY, + ON_SCREEN_KEYBOARD_KEY, HANDLED_KEYS }; @@ -72,6 +75,9 @@ static struct { { STOP_KEY, "stop", NULL }, { PREVIOUS_KEY, "previous", NULL }, { NEXT_KEY, "next", 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/msd-media-keys-manager.c b/plugins/media-keys/msd-media-keys-manager.c index 1ff0291..f0b0229 100644 --- a/plugins/media-keys/msd-media-keys-manager.c +++ b/plugins/media-keys/msd-media-keys-manager.c @@ -880,6 +880,36 @@ do_multimedia_player_action (MsdMediaKeysManager *manager, return msd_media_player_key_pressed (manager, key); } +static void +do_toggle_accessibility_key (const char *key) +{ + GSettings *settings; + gboolean state; + + settings = g_settings_new ("org.mate.applications-at"); + state = g_settings_get_boolean (settings, key); + g_settings_set_boolean (settings, key, !state); + g_object_unref (settings); +} + +static void +do_magnifier_action (MsdMediaKeysManager *manager) +{ + do_toggle_accessibility_key ("screen-magnifier-enabled"); +} + +static void +do_screenreader_action (MsdMediaKeysManager *manager) +{ + do_toggle_accessibility_key ("screen-reader-enabled"); +} + +static void +do_on_screen_keyboard_action (MsdMediaKeysManager *manager) +{ + do_toggle_accessibility_key ("screen-keyboard-enabled"); +} + static gboolean do_action (MsdMediaKeysManager *manager, int type) @@ -969,6 +999,15 @@ do_action (MsdMediaKeysManager *manager, case NEXT_KEY: return do_multimedia_player_action (manager, "Next"); 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; default: g_assert_not_reached (); } |