[gnome-shell] NetworkMenu: don't notify for failed connections if cancelled by the user



commit 6b1e6326219d323a0b52378cf7620078e2903645
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Tue Oct 2 21:02:59 2012 +0200

    NetworkMenu: don't notify for failed connections if cancelled by the user
    
    If the user cancels the secret dialog, the NM will report the connection
    failure, but we should not notify it as it is a user-initiated action.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=684823

 js/ui/status/network.js |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index 9da066d..e355415 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -574,7 +574,11 @@ const NMDevice = new Lang.Class({
             this.emit('network-lost');
         }
 
-        if (newstate == NetworkManager.DeviceState.FAILED) {
+        /* Emit a notification if activation fails, but don't do it
+           if the reason is no secrets, as that indicates the user
+           cancelled the agent dialog */
+        if (newstate == NetworkManager.DeviceState.FAILED &&
+            reason != NetworkManager.DeviceStateReason.NO_SECRETS) {
             this.emit('activation-failed', reason);
         }
 
@@ -1540,7 +1544,8 @@ const NMVPNSection = new Lang.Class({
     },
 
     _connectionStateChanged: function(vpnConnection, newstate, reason) {
-        if (newstate == NetworkManager.VPNConnectionState.FAILED) {
+        if (newstate == NetworkManager.VPNConnectionState.FAILED &&
+            reason != NetworkManager.VPNConnectionStateReason.NO_SECRETS) {
             // FIXME: if we ever want to show something based on reason,
             // we need to convert from NetworkManager.VPNConnectionStateReason
             // to NetworkManager.DeviceStateReason



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