[gnome-shell/wip/aggregate-menu: 45/69] network: Don't pass a list of connections to the devices



commit b6cb1d1ecbafa0471607a8976d453631f55e8b1f
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Jul 17 01:10:42 2013 -0400

    network: Don't pass a list of connections to the devices
    
    Instead, just add them after they're constructed. This allows us to
    not have to pass the connections to each device, and prevents issues
    with having to enumerate the connections in the middle of construction.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=704670

 js/ui/status/network.js |   21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)
---
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index eae87b8..7e2fe7c 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -117,12 +117,11 @@ const NMDevice = new Lang.Class({
     Name: 'NMDevice',
     Abstract: true,
 
-    _init: function(client, device, connections) {
+    _init: function(client, device) {
         this._client = client;
         this._setDevice(device);
 
         this._connections = [];
-        connections.forEach(Lang.bind(this, this.checkConnection));
 
         this._activeConnection = null;
         this._activeConnectionItem = null;
@@ -463,7 +462,7 @@ const NMDeviceModem = new Lang.Class({
     Extends: NMDevice,
     category: NMConnectionCategory.WWAN,
 
-    _init: function(client, device, connections) {
+    _init: function(client, device) {
         device._description = _("Mobile broadband");
         this.mobileDevice = null;
 
@@ -498,7 +497,7 @@ const NMDeviceModem = new Lang.Class({
             }));
         }
 
-        this.parent(client, device, connections);
+        this.parent(client, device);
     },
 
     destroy: function() {
@@ -566,12 +565,12 @@ const NMDeviceBluetooth = new Lang.Class({
     Name: 'NMDeviceBluetooth',
     Extends: NMDevice,
 
-    _init: function(client, device, connections) {
+    _init: function(client, device) {
         device._description = _("Bluetooth");
 
         this.category = NMConnectionCategory.WWAN;
 
-        this.parent(client, device, connections);
+        this.parent(client, device);
     },
 
     _activateAutomaticConnection: function() {
@@ -596,12 +595,12 @@ const NMDeviceWireless = new Lang.Class({
     Name: 'NMDeviceWireless',
     Extends: NMDevice,
 
-    _init: function(client, device, connections) {
+    _init: function(client, device) {
         this.category = NMConnectionCategory.WIRELESS;
 
         this._networks = [ ];
 
-        this.parent(client, device, connections);
+        this.parent(client, device);
 
         let accessPoints = device.get_access_points() || [ ];
         accessPoints.forEach(Lang.bind(this, function(ap) {
@@ -1373,12 +1372,16 @@ const NMApplet = new Lang.Class({
 
         let wrapperClass = this._dtypes[device.get_device_type()];
         if (wrapperClass) {
-            let wrapper = new wrapperClass(this._client, device, this._connections);
+            let wrapper = new wrapperClass(this._client, device);
             this._addDeviceWrapper(wrapper);
 
             this._nmDevices.push(device);
             if (!skipSyncDeviceNames)
                 this._syncDeviceNames();
+
+            this._connections.forEach(function(connection) {
+                wrapper.checkConnection(connection);
+            });
         }
     },
 


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