[gnome-shell/wip/message-tray-menu: 95/109] network: Remove the global wireless kill-switch



commit 57372cea219bdecaf46cc8615224e8a44f9c107a
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Apr 26 00:28:08 2013 -0400

    network: Remove the global wireless kill-switch
    
    This will eventually be implemented separately with an Airplane Mode
    toggle, but for now, remove it.

 js/ui/status/network.js |  115 +----------------------------------------------
 1 files changed, 1 insertions(+), 114 deletions(-)
---
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index 25ad807..c1d9f3e 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -119,54 +119,6 @@ const NMNetworkMenuItem = new Lang.Class({
     }
 });
 
-const NMWirelessSectionTitleMenuItem = new Lang.Class({
-    Name: 'NMWirelessSectionTitleMenuItem',
-    Extends: PopupMenu.PopupSwitchMenuItem,
-
-    _init: function(client) {
-        this.parent(_("Wi-Fi"), false, { style_class: 'popup-subtitle-menu-item' });
-
-        this._client = client;
-        this._client.connect('notify::wireless-enabled', Lang.bind(this, this._propertyChanged));
-        this._client.connect('notify::wireless-hardware-enabled', Lang.bind(this, this._propertyChanged));
-
-        this._propertyChanged();
-    },
-
-    updateForDevice: function(device) {
-        // we show the switch
-        // - if there not just one device
-        // - if the switch is off (but it can be turned on)
-        // - if the device is activated or disconnected
-        if (!this._hardwareEnabled) {
-            this.setStatus(_("hardware disabled"));
-        } else if (device && this._softwareEnabled) {
-            let text = device.getStatusLabel();
-            this.setStatus(text);
-        } else
-            this.setStatus(null);
-    },
-
-    activate: function(event) {
-        this.parent(event);
-
-        this._client.wireless_set_enabled(this._switch.state);
-    },
-
-    _propertyChanged: function() {
-        this._softwareEnabled = this._client.wireless_enabled;
-        this._hardwareEnabled = this._client.wireless_hardware_enabled;
-
-        let enabled = this._softwareEnabled && this._hardwareEnabled;
-        this.setToggleState(enabled);
-        if (!this._hardwareEnabled)
-            /* Translators: this indicates that wireless or wwan is disabled by hardware killswitch */
-            this.setStatus(_("disabled"));
-
-        this.emit('enabled-changed', enabled);
-    }
-});
-
 const NMConnectionBased = new Lang.Class({
     Name: 'NMConnectionBased',
     Abstract: true,
@@ -397,11 +349,6 @@ const NMDevice = new Lang.Class({
         return this.device.connection_valid(connection);
     },
 
-    setEnabled: function(enabled) {
-        // do nothing by default, we want to keep the conneciton list visible
-        // in the majority of cases (wired, wwan)
-    },
-
     getStatusLabel: function() {
         if (!this.device)
             return null;
@@ -607,7 +554,6 @@ const NMDeviceModem = new Lang.Class({
         let is_wwan = false;
 
         device._description = _("Mobile broadband");
-        this._enabled = true;
         this.mobileDevice = null;
         this._connectionType = 'ppp';
 
@@ -663,23 +609,6 @@ const NMDeviceModem = new Lang.Class({
         this.parent(client, device, connections);
     },
 
-    setEnabled: function(enabled) {
-        this._enabled = enabled;
-        if (this.category == NMConnectionCategory.WWAN) {
-            if (enabled) {
-                // prevent "network unavailable" statuses
-                this.statusItem.setStatus(null);
-            } else
-                this.statusItem.setStatus(this.getStatusLabel());
-        }
-
-        this.parent(enabled);
-    },
-
-    get connected() {
-        return this._enabled && this.device.state == NetworkManager.DeviceState.ACTIVATED;
-    },
-
     destroy: function() {
         if (this._operatorNameId) {
             this.mobileDevice.disconnect(this._operatorNameId);
@@ -844,11 +773,6 @@ const NMDeviceWireless = new Lang.Class({
         this.parent();
     },
 
-    setEnabled: function(enabled) {
-        this.statusItem.actor.visible = enabled;
-        this.section.actor.visible = enabled;
-    },
-
     activate: function() {
         if (this._activeConnection)
             // nothing to do
@@ -1530,9 +1454,7 @@ const NMApplet = new Lang.Class({
         this._devices.wireless = {
             section: new PopupMenu.PopupMenuSection(),
             devices: [ ],
-            item: this._makeWirelessToggle()
         };
-        this._devices.wireless.section.addMenuItem(this._devices.wireless.item);
         this._devices.wireless.section.actor.hide();
         this.menu.addMenuItem(this._devices.wireless.section);
         this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
@@ -1561,21 +1483,8 @@ const NMApplet = new Lang.Class({
         this._settings.connect('new-connection', Lang.bind(this, this._newConnection));
     },
 
-    _makeWirelessToggle: function() {
-        let item = new NMWirelessSectionTitleMenuItem(this._client);
-        item.connect('enabled-changed', Lang.bind(this, function(item, enabled) {
-            let devices = this._devices.wireless.devices;
-            devices.forEach(function(dev) {
-                dev.setEnabled(enabled);
-            });
-            this._syncSectionTitle('wireless');
-        }));
-        return item;
-    },
-
     _syncSectionTitle: function(category) {
         let devices = this._devices[category].devices;
-        let item = this._devices[category].item;
         let section = this._devices[category].section;
 
         let visible;
@@ -1584,29 +1493,7 @@ const NMApplet = new Lang.Class({
         else
             visible = devices.length > 0;
 
-        if (!visible)
-            section.actor.hide();
-        else {
-            section.actor.show();
-
-            // Sync the relation between the section title
-            // item (the one with the airplane mode switch)
-            // and the individual device switches
-            if (item) {
-                if (devices.length == 1) {
-                    let dev = devices[0];
-                    dev.statusItem.actor.hide();
-                    item.updateForDevice(dev);
-                } else {
-                    devices.forEach(function(dev) {
-                        dev.statusItem.actor.show();
-                    });
-
-                    // remove status text from the section title item
-                    item.updateForDevice(null);
-                }
-            }
-        }
+        section.actor.visible = visible;
     },
 
     _readDevices: function() {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]