[gnome-shell] AirplaneMode: don't show a "Turn off" item if HW enabled
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] AirplaneMode: don't show a "Turn off" item if HW enabled
- Date: Tue, 4 Feb 2014 21:25:03 +0000 (UTC)
commit df3a50bae8d2711f2b8b279b918a8aa71cf175f0
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Tue Oct 8 23:34:33 2013 +0200
AirplaneMode: don't show a "Turn off" item if HW enabled
If airplane mode is enabled with an HW switch, we can't turn it
off from the menu, so make the menu item insensitive and
replace it with a helpful tip.
https://bugzilla.gnome.org/show_bug.cgi?id=709685
js/ui/status/rfkill.js | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/status/rfkill.js b/js/ui/status/rfkill.js
index 487e05f..2be7bf9 100644
--- a/js/ui/status/rfkill.js
+++ b/js/ui/status/rfkill.js
@@ -12,6 +12,7 @@ const OBJECT_PATH = '/org/gnome/SettingsDaemon/Rfkill';
const RfkillManagerInterface = '<node> \
<interface name="org.gnome.SettingsDaemon.Rfkill"> \
<property name="AirplaneMode" type="b" access="readwrite" /> \
+<property name="HardwareAirplaneMode" type="b" access="read" /> \
</interface> \
</node>';
@@ -45,7 +46,7 @@ const Indicator = new Lang.Class({
this._item = new PopupMenu.PopupSubMenuMenuItem(_("Airplane Mode"), true);
this._item.icon.icon_name = 'airplane-mode-symbolic';
this._item.status.text = _("On");
- this._item.menu.addAction(_("Turn Off"), Lang.bind(this, function() {
+ this._offItem = this._item.menu.addAction(_("Turn Off"), Lang.bind(this, function() {
this._proxy.AirplaneMode = false;
}));
this._item.menu.addSettingsAction(_("Network Settings"), 'gnome-network-panel.desktop');
@@ -54,7 +55,15 @@ const Indicator = new Lang.Class({
_sync: function() {
let airplaneMode = this._proxy.AirplaneMode;
+ let hwAirplaneMode = this._proxy.HardwareAirplaneMode;
+
this._indicator.visible = airplaneMode;
this._item.actor.visible = airplaneMode;
+ this._offItem.setSensitive(!hwAirplaneMode);
+
+ if (hwAirplaneMode)
+ this._offItem.label.text = _("Use hardware switch to turn off");
+ else
+ this._offItem.label.text = _("Turn Off");
},
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]