[gnome-shell] Network: destroy notifications when the connection completes



commit 7b1deba5908d5e223072557d3b47310029a4b3a4
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Sun Sep 4 21:17:33 2011 +0200

    Network: destroy notifications when the connection completes
    
    When you finish reconnecting, we should remove any Connection Lost
    or Connection Failed notification.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=658049

 js/ui/status/network.js |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index c4c42a5..85dcc9d 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -1828,7 +1828,7 @@ NMApplet.prototype = {
             if (!a._inited) {
                 a._notifyDefaultId = a.connect('notify::default', Lang.bind(this, this._updateIcon));
                 a._notifyDefault6Id = a.connect('notify::default6', Lang.bind(this, this._updateIcon));
-                a._notifyStateId = a.connect('notify::state', Lang.bind(this, this._updateIcon));
+                a._notifyStateId = a.connect('notify::state', Lang.bind(this, this._notifyActivated));
 
                 a._inited = true;
             }
@@ -1872,12 +1872,28 @@ NMApplet.prototype = {
 
                 if (a._primaryDevice)
                     a._primaryDevice.setActiveConnection(a);
+
+                if (a.state == NetworkManager.ActiveConnectionState.ACTIVATED
+                    && a._primaryDevice && a._primaryDevice._notification) {
+                    a._primaryDevice._notification.destroy();
+                    a._primaryDevice._notification = null;
+                }
             }
         }
 
         this._mainConnection = activating || default_ip4 || default_ip6 || this._activeConnections[0] || null;
     },
 
+    _notifyActivated: function(activeConnection) {
+        if (activeConnection.state == NetworkManager.ActiveConnectionState.ACTIVATED
+            && activeConnection._primaryDevice && activeConnection._primaryDevice._notification) {
+            activeConnection._primaryDevice._notification.destroy();
+            activeConnection._primaryDevice._notification = null;
+        }
+
+        this._updateIcon();
+    },
+
     _readConnections: function() {
         let connections = this._settings.list_connections();
         for (let i = 0; i < connections.length; i++) {



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