[gnome-shell/wip/aggregate-menu: 25/36] network: Remove _createAPItem



commit d804eee9d460393e16b78f99f84844d472da76e8
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Apr 25 20:39:19 2013 -0400

    network: Remove _createAPItem
    
    The code flows better if this is inlined like this.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=698918

 js/ui/status/network.js |   29 ++++++++++++-----------------
 1 files changed, 12 insertions(+), 17 deletions(-)
---
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index 1e6a68f..b282c7c 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -987,21 +987,6 @@ const NMDeviceWireless = new Lang.Class({
         }
     },
 
-    _createAPItem: function(connection, accessPointObj) {
-        let item = new NMNetworkMenuItem(accessPointObj.accessPoints[0]);
-        item._connection = connection;
-        item.connect('activate', Lang.bind(this, function() {
-            let accessPoints = accessPointObj.accessPoints;
-            for (let i = 0; i < accessPoints.length; i++) {
-                if (accessPoints[i].connection_valid(connection)) {
-                    this._client.activate_connection(connection, this.device, accessPoints[i].dbus_path, 
null);
-                    break;
-                }
-            }
-        }));
-        return item;
-    },
-
     _clearSection: function() {
         this.parent();
 
@@ -1098,10 +1083,20 @@ const NMDeviceWireless = new Lang.Class({
             return;
         }
 
+        network.item = new NMNetworkMenuItem(network.accessPoints[0]);
         if(network.connections.length > 0) {
-            network.item = this._createAPItem(network.connections[0], network);
+            let connection = network.connections[0];
+            network.item._connection = connection;
+            network.item.connect('activate', Lang.bind(this, function() {
+                let accessPoints = network.accessPoints;
+                for (let i = 0; i < accessPoints.length; i++) {
+                    if (accessPoints[i].connection_valid(connection)) {
+                        this._client.activate_connection(connection, this.device, accessPoints[i].dbus_path, 
null);
+                        break;
+                    }
+                }
+            }));
         } else {
-            network.item = new NMNetworkMenuItem(network.accessPoints[0]);
             network.item.connect('activate', Lang.bind(this, function() {
                 let accessPoints = network.accessPoints;
                 if (   (accessPoints[0]._secType == NMAccessPointSecurity.WPA2_ENT)


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