[gnome-shell] network: Ensure the connection list is sorted after rename



commit 30e17036e8bec8dd47f68eb6b1d3cfe3ca037caf
Author: Benjamin Berg <bberg redhat com>
Date:   Mon Feb 13 14:52:23 2017 +0100

    network: Ensure the connection list is sorted after rename
    
    Items were inserted correctly but the synchronisation was lost if the
    name of a connection was changed. Simply making sure the position is
    correct after a connection is updated fixes the issue.
    
    Reported-by: Oliver Haessler <ohaessle redhat com>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=778686

 js/ui/status/network.js |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index 835c315..72f973a 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -299,11 +299,22 @@ const NMConnectionSection = new Lang.Class({
 
         let item = this._connectionItems.get(connection.get_uuid());
         if (item)
-            item.updateForConnection(connection);
+            this._updateForConnection(item, connection);
         else
             this._addConnection(connection);
     },
 
+    _updateForConnection: function(item, connection) {
+        let pos = this._connections.indexOf(connection);
+
+        this._connections.splice(pos, 1);
+        pos = Util.insertSorted(this._connections, connection, Lang.bind(this, 
this._connectionSortFunction));
+        this._labelSection.moveMenuItem(item.labelItem, pos);
+        this._radioSection.moveMenuItem(item.radioItem, pos);
+
+        item.updateForConnection(connection);
+    },
+
     _addConnection: function(connection) {
         let item = this._makeConnectionItem(connection);
         if (!item)


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