[gnome-shell/wip/aggregate-menu: 39/69] network: Remove separators between device sections



commit 3990085f00b5dc820827c4a8e9a6e560f8716fab
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Apr 26 01:37:19 2013 -0400

    network: Remove separators between device sections
    
    This is not needed in the new design. Doing this allows us to
    remove some complex section visibility tracking, also.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=704670

 js/ui/status/network.js |   50 ++++++++++++++++-------------------------------
 1 files changed, 17 insertions(+), 33 deletions(-)
---
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index 776e6db..dd6feff 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -1450,7 +1450,6 @@ const NMApplet = new Lang.Class({
         }));
         this._statusSection.actor.hide();
         this.menu.addMenuItem(this._statusSection);
-        this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
 
         this._activeConnections = [ ];
         this._connections = [ ];
@@ -1465,10 +1464,7 @@ const NMApplet = new Lang.Class({
             section: new PopupMenu.PopupMenuSection(),
             devices: [ ],
         };
-
-        this._devices.wired.section.actor.hide();
         this.menu.addMenuItem(this._devices.wired.section);
-        this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
 
         this._devices.wireless = {
             section: new PopupMenu.PopupMenuSection(),
@@ -1476,17 +1472,13 @@ const NMApplet = new Lang.Class({
             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());
 
         this._devices.wwan = {
             section: new PopupMenu.PopupMenuSection(),
             devices: [ ],
         };
-        this._devices.wwan.section.actor.hide();
         this.menu.addMenuItem(this._devices.wwan.section);
-        this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
 
         this._vpnSection = new NMVPNSection(this._client);
         this._vpnSection.connect('activation-failed', Lang.bind(this, this._onActivationFailed));
@@ -1534,29 +1526,22 @@ const NMApplet = new Lang.Class({
     _syncSectionTitle: function(category) {
         let devices = this._devices[category].devices;
         let item = this._devices[category].item;
-        let section = this._devices[category].section;
-
-        if (devices.length == 0)
-            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);
-                }
+        // 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);
             }
         }
     },
@@ -1895,9 +1880,8 @@ const NMApplet = new Lang.Class({
 
         this._statusSection.actor.hide();
 
-        this._syncSectionTitle(NMConnectionCategory.WIRED);
-        this._syncSectionTitle(NMConnectionCategory.WIRELESS);
-        this._syncSectionTitle(NMConnectionCategory.WWAN);
+        for (let category in this._devices)
+            this._devices[category].section.actor.show();
     },
 
     _syncNMState: function() {


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