[gnome-shell] network: Remove the enable networking item



commit e62045eb7fb482840aed4be407259c0c528e1fb2
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon Apr 29 15:35:14 2013 -0400

    network: Remove the enable networking item
    
    This is a part of the new system status design, see
    https://wiki.gnome.org/GnomeShell/Design/Guidelines/SystemStatus/
    for design details.
    
    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 ed2e911..f82989b 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -1368,15 +1368,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 = [ ];
 
@@ -1386,28 +1377,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();
@@ -1747,45 +1741,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]