[gnome-shell/wip/aggregate-menu: 52/74] network: Remove syncDescription



commit 4928a854c03a4c3a0e96d16e5e3d171517af69e9
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Jul 17 01:01:44 2013 -0400

    network: Remove syncDescription
    
    Replace it with setDeviceDescription, which gives device wrappers
    more control about how to handle description changes.

 js/ui/status/network.js |   21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index cb8cc55..30ae01a 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -179,6 +179,7 @@ const NMConnectionSection = new Lang.Class({
 
         this.item.status.text = this._getStatus();
         this.item.icon.icon_name = this._getMenuIcon();
+        this.item.label.text = this._getDescription();
     },
 
     _getStatus: function() {
@@ -211,10 +212,6 @@ const NMConnectionSection = new Lang.Class({
         return new NMConnectionItem(this._client, connection);
     },
 
-    syncDescription: function() {
-        this.item.label.text = this._getDescription();
-    },
-
     checkConnection: function(connection) {
         if (!this._connectionValid(connection))
             return;
@@ -311,6 +308,7 @@ const NMDeviceModem = new Lang.Class({
             }));
         }
 
+        this._description = '';
         this._stateChangedId = this._device.connect('state-changed', Lang.bind(this, 
this._deviceStateChanged));
         this._activeConnectionChangedId = this._device.connect('notify::active-connection', Lang.bind(this, 
this._activeConnectionChanged));
 
@@ -385,6 +383,15 @@ const NMDeviceModem = new Lang.Class({
         return this._device.connection_valid(connection);
     },
 
+    setDeviceDescription: function(desc) {
+        this._description = desc;
+        this._sync();
+    },
+
+    _getDescription: function() {
+        return this._description;
+    },
+
     _getStatus: function() {
         if (!this._device)
             return null;
@@ -524,8 +531,6 @@ const NMVPNSection = new Lang.Class({
 
     _init: function(client) {
         this.parent(client);
-
-        this.syncDescription();
         this._sync();
     },
 
@@ -697,9 +702,9 @@ const NMApplet = new Lang.Class({
         let names = NMGtk.utils_disambiguate_device_names(this._nmDevices);
         for (let i = 0; i < this._nmDevices.length; i++) {
             let device = this._nmDevices[i];
-            device._description = names[i];
+            let description = names[i];
             if (device._delegate)
-                device._delegate.syncDescription();
+                device._delegate.setDeviceDescription(description);
         }
     },
 


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