[gnome-shell] status: Respect always-show-universal-access-status setting



commit c95ec8e99f30d05ec50a84cdf92abda736fd4121
Author: Tanner Doshier <doshitan gmail com>
Date:   Tue Aug 13 11:39:07 2013 -0500

    status: Respect always-show-universal-access-status setting
    
    https://bugzilla.gnome.org/show_bug.cgi?id=705733

 js/ui/status/accessibility.js |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/js/ui/status/accessibility.js b/js/ui/status/accessibility.js
index 35d92e2..bab194f 100644
--- a/js/ui/status/accessibility.js
+++ b/js/ui/status/accessibility.js
@@ -9,7 +9,10 @@ const St = imports.gi.St;
 const PanelMenu = imports.ui.panelMenu;
 const PopupMenu = imports.ui.popupMenu;
 
-const A11Y_SCHEMA = 'org.gnome.desktop.a11y.keyboard';
+const A11Y_SCHEMA = 'org.gnome.desktop.a11y'
+const KEY_ALWAYS_SHOW = 'always-show-universal-access-status';
+
+const A11Y_KEYBOARD_SCHEMA = 'org.gnome.desktop.a11y.keyboard'
 const KEY_STICKY_KEYS_ENABLED = 'stickykeys-enable';
 const KEY_BOUNCE_KEYS_ENABLED = 'bouncekeys-enable';
 const KEY_SLOW_KEYS_ENABLED   = 'slowkeys-enable';
@@ -46,6 +49,9 @@ const ATIndicator = new Lang.Class({
 
         this.actor.add_child(this._hbox);
 
+        this._a11ySettings = new Gio.Settings({ schema: A11Y_SCHEMA });
+        this._a11ySettings.connect('changed::' + KEY_ALWAYS_SHOW, Lang.bind(this, 
this._queueSyncMenuVisibility));
+
         let highContrast = this._buildHCItem();
         this.menu.addMenuItem(highContrast);
 
@@ -67,16 +73,16 @@ const ATIndicator = new Lang.Class({
         let visualBell = this._buildItem(_("Visual Alerts"), WM_SCHEMA, KEY_VISUAL_BELL);
         this.menu.addMenuItem(visualBell);
 
-        let stickyKeys = this._buildItem(_("Sticky Keys"), A11Y_SCHEMA, KEY_STICKY_KEYS_ENABLED);
+        let stickyKeys = this._buildItem(_("Sticky Keys"), A11Y_KEYBOARD_SCHEMA, KEY_STICKY_KEYS_ENABLED);
         this.menu.addMenuItem(stickyKeys);
 
-        let slowKeys = this._buildItem(_("Slow Keys"), A11Y_SCHEMA, KEY_SLOW_KEYS_ENABLED);
+        let slowKeys = this._buildItem(_("Slow Keys"), A11Y_KEYBOARD_SCHEMA, KEY_SLOW_KEYS_ENABLED);
         this.menu.addMenuItem(slowKeys);
 
-        let bounceKeys = this._buildItem(_("Bounce Keys"), A11Y_SCHEMA, KEY_BOUNCE_KEYS_ENABLED);
+        let bounceKeys = this._buildItem(_("Bounce Keys"), A11Y_KEYBOARD_SCHEMA, KEY_BOUNCE_KEYS_ENABLED);
         this.menu.addMenuItem(bounceKeys);
 
-        let mouseKeys = this._buildItem(_("Mouse Keys"), A11Y_SCHEMA, KEY_MOUSE_KEYS_ENABLED);
+        let mouseKeys = this._buildItem(_("Mouse Keys"), A11Y_KEYBOARD_SCHEMA, KEY_MOUSE_KEYS_ENABLED);
         this.menu.addMenuItem(mouseKeys);
 
         this._syncMenuVisibility();
@@ -85,9 +91,10 @@ const ATIndicator = new Lang.Class({
     _syncMenuVisibility: function() {
         this._syncMenuVisibilityIdle = 0;
 
+        let alwaysShow = this._a11ySettings.get_boolean(KEY_ALWAYS_SHOW);
         let items = this.menu._getMenuItems();
 
-        this.actor.visible = items.some(function(f) { return !!f.state; });
+        this.actor.visible = alwaysShow || items.some(function(f) { return !!f.state; });
 
         return false;
     },


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]