Make it possible to always show the a11y status

A switch for this is part of the redesign for the universal
access control-center panel.

https://bugzilla.gnome.org/show_bug.cgi?id=698001
This commit is contained in:
Matthias Clasen 2013-04-14 09:35:56 -04:00
parent 96994721ef
commit 6ce79c62eb
2 changed files with 16 additions and 0 deletions

View File

@ -73,6 +73,14 @@ value here is from the GsmPresenceStatus enumeration.</_summary>
menuitem in single-user, single-session situations. menuitem in single-user, single-session situations.
</_description> </_description>
</key> </key>
<key name="always-show-universal-access" type="b">
<default>false</default>
<_summary>Always show the Universal Access status.</_summary>
<_description>
This key overrides the automatic hiding of the Universal
Access status icon when no accessibility features are enabled.
</_description>
</key>
<key name="remember-mount-password" type="b"> <key name="remember-mount-password" type="b">
<default>false</default> <default>false</default>
<_summary>Whether to remember password for mounting encrypted or remote filesystems</_summary> <_summary>Whether to remember password for mounting encrypted or remote filesystems</_summary>

View File

@ -26,6 +26,8 @@ const KEY_ICON_THEME = 'icon-theme';
const KEY_WM_THEME = 'theme'; const KEY_WM_THEME = 'theme';
const KEY_TEXT_SCALING_FACTOR = 'text-scaling-factor'; const KEY_TEXT_SCALING_FACTOR = 'text-scaling-factor';
const KEY_ALWAYS_SHOW_UNIVERSAL_ACCESS = 'always-show-universal-access';
const HIGH_CONTRAST_THEME = 'HighContrast'; const HIGH_CONTRAST_THEME = 'HighContrast';
const ATIndicator = new Lang.Class({ const ATIndicator = new Lang.Class({
@ -71,12 +73,18 @@ const ATIndicator = new Lang.Class({
this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem()); this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
this.menu.addSettingsAction(_("Universal Access Settings"), 'gnome-universal-access-panel.desktop'); this.menu.addSettingsAction(_("Universal Access Settings"), 'gnome-universal-access-panel.desktop');
global.settings.connect('changed::' + KEY_ALWAYS_SHOW_UNIVERSAL_ACCESS, Lang.bind (this, this._queueSyncMenuVisibility));
this._syncMenuVisibility(); this._syncMenuVisibility();
}, },
_syncMenuVisibility: function() { _syncMenuVisibility: function() {
this._syncMenuVisibilityIdle = 0; this._syncMenuVisibilityIdle = 0;
if (global.settings.get_boolean(KEY_ALWAYS_SHOW_UNIVERSAL_ACCESS)) {
this.actor.visible = true;
return false;
}
let items = this.menu._getMenuItems(); let items = this.menu._getMenuItems();
this.actor.visible = items.some(function(f) { return !!f.state; }); this.actor.visible = items.some(function(f) { return !!f.state; });