[gnome-shell/wip/aggregate-menu: 16/36] power: Add an Airplane Mode switch



commit 5b184db7c36404fd322eb453f721e312ab6d3a5e
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon May 27 17:54:50 2013 -0400

    power: Add an Airplane Mode switch

 js/ui/status/power.js |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/status/power.js b/js/ui/status/power.js
index 76f3afa..ec7739f 100644
--- a/js/ui/status/power.js
+++ b/js/ui/status/power.js
@@ -37,14 +37,20 @@ const Indicator = new Lang.Class({
                                                     return;
                                                 }
                                                 this._proxy.connect('g-properties-changed',
-                                                                    Lang.bind(this, this._devicesChanged));
-                                                this._devicesChanged();
+                                                                    Lang.bind(this, 
this._propertiesChanged));
+                                                this._propertiesChanged();
                                             }));
 
         this._batteryItem = new PopupMenu.PopupMenuItem(_("Battery"), { reactive: false });
         this._status = new St.Label({ style_class: 'popup-status-menu-item' });
         this._batteryItem.addActor(this._status, { align: St.Align.END });
         this.menu.addMenuItem(this._batteryItem);
+
+        this._airplaneModeItem = new PopupMenu.PopupSwitchMenuItem(_("Airplane Mode"), false);
+        this._airplaneModeItem.connect('toggled', Lang.bind(this, function(item, state) {
+            this._proxy.AirplaneMode = state;
+        }));
+        this.menu.addMenuItem(this._airplaneModeItem);
     },
 
     _statusForDevice: function(device) {
@@ -108,8 +114,14 @@ const Indicator = new Lang.Class({
         this.actor.visible = hasIcon;
     },
 
-    _devicesChanged: function() {
+    _syncAirplaneMode: function() {
+        let airplaneMode = this._proxy.AirplaneMode;
+        this._airplaneModeItem.setActive(airplaneMode);
+    },
+
+    _propertiesChanged: function() {
         this._syncIcon();
+        this._syncAirplaneMode();
         this._readPrimaryDevice();
     }
 });


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