[gnome-shell] status/network: Always use toggles in VPN section



commit 9002344ec66ec13050676d07fac16348abc29075
Author: Florian Müllner <fmuellner gnome org>
Date:   Mon Aug 8 00:28:12 2022 +0200

    status/network: Always use toggles in VPN section
    
    Let's keep things simple and use the same appearance regardless
    of the number of configured VPNs. Also unlike for device items,
    every connection item in the VPN section is a toplevel item, so
    there isn't a real need for different presentations.
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>

 js/ui/status/network.js | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
---
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index 406509834b..a4ed4a4e6e 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -1472,6 +1472,7 @@ const NMVpnConnectionItem = GObject.registerClass({
         super(section, connection);
 
         this._label.x_expand = true;
+        this.radioMode = true;
 
         this._switch = new PopupMenu.Switch(this.is_active);
         this.add_child(this._switch);
@@ -1547,7 +1548,6 @@ var NMVpnSection = class extends PopupMenu.PopupMenuSection {
             this);
 
         this._loadInitialItems();
-        this._sync();
     }
 
     _loadInitialItems() {
@@ -1568,8 +1568,6 @@ var NMVpnSection = class extends PopupMenu.PopupMenuSection {
 
         for (const a of activeConnections)
             this._items.get(a.connection)?.setActiveConnection(a);
-
-        this._sync();
     }
 
     _shouldHandleConnection(connection) {
@@ -1619,8 +1617,6 @@ var NMVpnSection = class extends PopupMenu.PopupMenuSection {
         this._items.set(connection, item);
         const pos = this._itemSorter.upsert(item);
         this._section.addMenuItem(item, pos);
-
-        this._sync();
     }
 
     _removeConnection(connection) {
@@ -1632,13 +1628,6 @@ var NMVpnSection = class extends PopupMenu.PopupMenuSection {
         this._items.delete(connection);
 
         item.destroy();
-        this._sync();
-    }
-
-    _sync() {
-        const nItems = this._items.size;
-        for (const item of this._items.values())
-            item.radio_mode = nItems > 1;
     }
 
     get category() {


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