[gnome-shell/wip/aggregate-menu: 79/101] power: Add an Airplane Mode menu
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/aggregate-menu: 79/101] power: Add an Airplane Mode menu
- Date: Mon, 15 Jul 2013 17:18:30 +0000 (UTC)
commit 9cebbf31656cdcae705df8731b8703267402db57
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Mon May 27 17:54:50 2013 -0400
power: Add an Airplane Mode menu
js/ui/status/power.js | 24 +++++++++++++++++++++---
1 files changed, 21 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/status/power.js b/js/ui/status/power.js
index 343344f..e5964dc 100644
--- a/js/ui/status/power.js
+++ b/js/ui/status/power.js
@@ -20,6 +20,7 @@ const PowerManagerInterface = <interface name="org.gnome.SettingsDaemon.Power">
<arg type="(susdut)" direction="out" />
</method>
<property name="Icon" type="s" access="read" />
+<property name="AirplaneMode" type="b" access="readwrite" />
</interface>;
const PowerManagerProxy = Gio.DBusProxy.makeProxyWrapper(PowerManagerInterface);
@@ -38,14 +39,26 @@ 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.PopupSubMenuMenuItem(_("Battery"), true);
this._batteryItem.menu.addSettingsAction(_("Power Settings"), 'gnome-power-panel.desktop');
this.menu.addMenuItem(this._batteryItem);
+ // The menu only appears when airplane mode is on, so just
+ // statically build it as if it was on, rather than dynamically
+ // changing the menu contents.
+ this._airplaneModeMenu = new PopupMenu.PopupSubMenuMenuItem(_("Airplane Mode"), true);
+ this._airplaneModeMenu.icon.icon_name = 'airplane-mode-symbolic';
+ this._airplaneModeMenu.status.text = _("On");
+ this._airplaneModeMenu.menu.addAction(_("Turn Off"), Lang.bind(this, function() {
+ this._proxy.AirplaneMode = false;
+ }));
+ this._airplaneModeMenu.menu.addSettingsAction(_("Network Settings"), 'gnome-network-panel.desktop');
+ this.menu.addMenuItem(this._airplaneModeMenu);
+
Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated));
this._sessionUpdated();
},
@@ -117,8 +130,13 @@ const Indicator = new Lang.Class({
this.actor.visible = hasIcon;
},
- _devicesChanged: function() {
+ _syncAirplaneMode: function() {
+ this._airplaneModeMenu.actor.visible = this._proxy.AirplaneMode;
+ },
+
+ _propertiesChanged: function() {
this._syncIcon();
+ this._syncAirplaneMode();
this._readPrimaryDevice();
}
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]