[gnome-shell/wip/aggregate-menu: 42/69] network: Remove the enable networking item
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/aggregate-menu: 42/69] network: Remove the enable networking item
- Date: Fri, 26 Jul 2013 04:35:31 +0000 (UTC)
commit d575c9408637a20a1886a2cc56f83c9222bf227c
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Mon Apr 29 15:35:14 2013 -0400
network: Remove the enable networking item
If networking is disabled, like in an rfkill case, the menus should
be completely hidden.
Additionally, with this gone, we can clean up how we handle menu
item visibility.
https://bugzilla.gnome.org/show_bug.cgi?id=704670
js/ui/status/network.js | 50 ++++++++--------------------------------------
1 files changed, 9 insertions(+), 41 deletions(-)
---
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index 91172d6..9ad624e 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -1363,15 +1363,6 @@ const NMApplet = new Lang.Class({
if (!this._client || !this._settings)
return;
- this._statusSection = new PopupMenu.PopupMenuSection();
- this._statusItem = new PopupMenu.PopupMenuItem('', { reactive: false });
- this._statusSection.addMenuItem(this._statusItem);
- this._statusSection.addAction(_("Enable networking"), Lang.bind(this, function() {
- this._client.networking_enabled = true;
- }));
- this._statusSection.actor.hide();
- this.menu.addMenuItem(this._statusSection);
-
this._activeConnections = [ ];
this._connections = [ ];
@@ -1381,28 +1372,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();
@@ -1742,45 +1736,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;
-
- this._statusSection.actor.hide();
-
- 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();
- this._statusItem.label.text = _("Networking is disabled");
- this._statusSection.actor.show();
- 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]