[gnome-shell/wip/aggregate-menu: 32/56] network: Revamp menu visibility when the network manager is offline
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/aggregate-menu: 32/56] network: Revamp menu visibility when the network manager is offline
- Date: Tue, 16 Jul 2013 20:56:44 +0000 (UTC)
commit 18699dd5848d431d4ea654c59a42a9f25a1e27b9
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Jun 6 16:46:07 2013 -0400
network: Revamp menu visibility when the network manager is offline
Remove the old hideDevices/showNormal code that was unbalanced and
just a bit weird, and add everything to one big section we hide/show.
js/ui/status/network.js | 37 +++++++++----------------------------
1 files changed, 9 insertions(+), 28 deletions(-)
---
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index f54907a..7fb2518 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -1398,28 +1398,31 @@ const NMApplet = new Lang.Class({
this._nmDevices = [];
this._devices = { };
+ this._section = new PopupMenu.PopupMenuSection();
+ this.menu.addMenuItem(this._section);
+
this._devices.wired = {
section: new PopupMenu.PopupMenuSection(),
devices: [ ],
};
- this.menu.addMenuItem(this._devices.wired.section);
+ this._section.addMenuItem(this._devices.wired.section);
this._devices.wireless = {
section: new PopupMenu.PopupMenuSection(),
devices: [ ],
};
- this.menu.addMenuItem(this._devices.wireless.section);
+ this._section.addMenuItem(this._devices.wireless.section);
this._devices.wwan = {
section: new PopupMenu.PopupMenuSection(),
devices: [ ],
};
- this.menu.addMenuItem(this._devices.wwan.section);
+ this._section.addMenuItem(this._devices.wwan.section);
this._vpnSection = new NMVPNSection(this._client);
this._vpnSection.connect('activation-failed', Lang.bind(this, this._onActivationFailed));
this._vpnSection.connect('icon-changed', Lang.bind(this, this._updateIcon));
- this.menu.addMenuItem(this._vpnSection.section);
+ this._section.addMenuItem(this._vpnSection.section);
this._readConnections();
this._readDevices();
@@ -1760,41 +1763,19 @@ const NMApplet = new Lang.Class({
}
},
- _hideDevices: function() {
- this._devicesHidden = true;
-
- for (let category in this._devices)
- this._devices[category].section.actor.hide();
- },
-
- _showNormal: function() {
- if (!this._devicesHidden) // nothing to do
- return;
- this._devicesHidden = false;
-
- for (let category in this._devices)
- this._devices[category].section.actor.show();
- },
-
_syncNMState: function() {
this.mainIcon.visible = this._client.manager_running;
this.actor.visible = this.mainIcon.visible;
- if (!this._client.networking_enabled) {
- this.setIcon('network-offline-symbolic');
- this._hideDevices();
- return;
- }
-
- this._showNormal();
this._syncActiveConnections();
+ this._section.actor.visible = this._client.networking_enabled;
},
_updateIcon: function() {
let hasApIcon = false;
let hasMobileIcon = false;
- if (!this._mainConnection) {
+ if (!this._client.networking_enabled || !this._mainConnection) {
this.setIcon('network-offline-symbolic');
} else {
let dev = this._mainConnection._primaryDevice;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]