[gnome-shell] network: add security icons to WEP/WPA wireless networks



commit 526d11809f85cc57587dd58e525af2d408d7d286
Author: Dan Winship <danw gnome org>
Date:   Fri Mar 25 11:27:56 2011 -0400

    network: add security icons to WEP/WPA wireless networks
    
    https://bugzilla.gnome.org/show_bug.cgi?id=645647

 data/theme/gnome-shell.css |    4 ++++
 js/ui/status/network.js    |   22 +++++++++++++++++++---
 2 files changed, 23 insertions(+), 3 deletions(-)
---
diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css
index 1ae4165..e9aefb1 100644
--- a/data/theme/gnome-shell.css
+++ b/data/theme/gnome-shell.css
@@ -185,6 +185,10 @@ StTooltip StLabel {
     background-image: url("toggle-on-intl.svg");
 }
 
+.nm-menu-item-icons {
+    spacing: .5em;
+}
+
 /* Panel */
 
 #panel {
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index 189af80..6b00e49 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -92,16 +92,32 @@ function NMNetworkMenuItem() {
 }
 
 NMNetworkMenuItem.prototype = {
-    __proto__: PopupMenu.PopupImageMenuItem.prototype,
+    __proto__: PopupMenu.PopupBaseMenuItem.prototype,
 
     _init: function(accessPoints, title, params) {
+        PopupMenu.PopupBaseMenuItem.prototype._init.call(this, params);
+
         accessPoints = sortAccessPoints(accessPoints);
         this.bestAP = accessPoints[0];
 
         let ssid = this.bestAP.get_ssid();
         title = title || NetworkManager.utils_ssid_to_utf8(ssid) || _("<unknown>");
 
-        PopupMenu.PopupImageMenuItem.prototype._init.call(this, title, this._getIcon(), params);
+        this._label = new St.Label({ text: title });
+        this.addActor(this._label);
+        this._icons = new St.BoxLayout({ style_class: 'nm-menu-item-icons' });
+        this.addActor(this._icons, { align: St.Align.END });
+
+        this._signalIcon = new St.Icon({ icon_name: this._getIcon(),
+                                         style_class: 'popup-menu-icon' });
+        this._icons.add_actor(this._signalIcon);
+
+        if (this.bestAP._secType != NMAccessPointSecurity.UNKNOWN &&
+            this.bestAP._secType != NMAccessPointSecurity.NONE) {
+            this._secureIcon = new St.Icon({ icon_name: 'network-wireless-encrypted',
+                                             style_class: 'popup-menu-icon' });
+            this._icons.add_actor(this._secureIcon);
+        }
 
         this._accessPoints = [ ];
         for (let i = 0; i < accessPoints.length; i++) {
@@ -120,7 +136,7 @@ NMNetworkMenuItem.prototype = {
         if (strength > this.bestAP.strength)
             this.bestAP = ap;
 
-        this.setIcon(this._getIcon());
+        this._signalIcon.icon_name = this._getIcon();
     },
 
     _getIcon: function() {



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