Blame SOURCES/0001-network-Don-t-disable-switch-in-wifi-section-while-c.patch

b97e22
From aaecd03d5f14fe3332659ab4997b39448814abcd Mon Sep 17 00:00:00 2001
b97e22
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
b97e22
Date: Thu, 5 Sep 2013 15:37:12 +0200
b97e22
Subject: [PATCH] network: Don't disable switch in wifi section while
b97e22
 connecting
b97e22
b97e22
Establishing a wireless connection may take some time during which
b97e22
users may change their mind and want to disable it (again).
b97e22
This is currently impossible, as we overlay the device status if
b97e22
the device is not fully (dis)connected. Instead, display this status
b97e22
on the active AP and leave the switch alone.
b97e22
---
b97e22
 js/ui/status/network.js | 57 ++++++++++++++++++++++++++++++++++++++++++++++++-
b97e22
 1 file changed, 56 insertions(+), 1 deletion(-)
b97e22
b97e22
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
b97e22
index ca4e462..370afa0 100644
b97e22
--- a/js/ui/status/network.js
b97e22
+++ b/js/ui/status/network.js
b97e22
@@ -1,4 +1,5 @@
b97e22
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
b97e22
+const Clutter = imports.gi.Clutter;
b97e22
 const GLib = imports.gi.GLib;
b97e22
 const GObject = imports.gi.GObject;
b97e22
 const Gio = imports.gi.Gio;
b97e22
@@ -122,8 +123,10 @@ const NMNetworkMenuItem = new Lang.Class({
b97e22
         this._label = new St.Label({ text: title });
b97e22
         this.actor.label_actor = this._label;
b97e22
         this.addActor(this._label);
b97e22
+        this._stack = new St.Widget({ layout_manager: new Clutter.BinLayout() });
b97e22
+        this.addActor(this._stack, { align: St.Align.END });
b97e22
         this._icons = new St.BoxLayout({ style_class: 'nm-menu-item-icons' });
b97e22
-        this.addActor(this._icons, { align: St.Align.END });
b97e22
+        this._stack.add_actor(this._icons);
b97e22
 
b97e22
         this._signalIcon = new St.Icon({ icon_name: this._getIcon(),
b97e22
                                          style_class: 'popup-menu-icon' });
b97e22
@@ -134,6 +137,8 @@ const NMNetworkMenuItem = new Lang.Class({
b97e22
             this.bestAP._secType != NMAccessPointSecurity.NONE)
b97e22
             this._secureIcon.icon_name = 'network-wireless-encrypted-symbolic';
b97e22
         this._icons.add_actor(this._secureIcon);
b97e22
+        this._statusLabel = new St.Label({ visible: false });
b97e22
+        this._stack.add_actor(this._statusLabel, { align: St.Align.END });
b97e22
     },
b97e22
 
b97e22
     updateBestAP: function(ap) {
b97e22
@@ -141,6 +146,14 @@ const NMNetworkMenuItem = new Lang.Class({
b97e22
         this._signalIcon.icon_name = this._getIcon();
b97e22
     },
b97e22
 
b97e22
+    setStatus: function(status) {
b97e22
+        let visible = status != null;
b97e22
+        this._statusLabel.visible = visible;
b97e22
+        this._icons.visible = !visible;
b97e22
+
b97e22
+        this._statusLabel.text = status;
b97e22
+    },
b97e22
+
b97e22
     _getIcon: function() {
b97e22
         if (this.bestAP.mode == NM80211Mode.ADHOC)
b97e22
             return 'network-workgroup-symbolic';
b97e22
@@ -1372,6 +1385,48 @@ const NMDeviceWireless = new Lang.Class({
b97e22
                                                                           'network-wireless-connected-symbolic',
b97e22
                                                                           { reactive: false });
b97e22
         this._activeConnectionItem.setShowDot(true);
b97e22
+
b97e22
+        if (this._activeNetwork)
b97e22
+            this._activeConnectionItem.setStatus(this.getActiveStatusLabel());
b97e22
+    },
b97e22
+
b97e22
+    getStatusLabel: function() {
b97e22
+        if (!this.device)
b97e22
+            return null;
b97e22
+
b97e22
+        switch(this.device.state) {
b97e22
+        case NetworkManager.DeviceState.DEACTIVATING:
b97e22
+        case NetworkManager.DeviceState.PREPARE:
b97e22
+        case NetworkManager.DeviceState.CONFIG:
b97e22
+        case NetworkManager.DeviceState.IP_CONFIG:
b97e22
+        case NetworkManager.DeviceState.IP_CHECK:
b97e22
+        case NetworkManager.DeviceState.SECONDARIES:
b97e22
+        case NetworkManager.DeviceState.NEED_AUTH:
b97e22
+            return null;
b97e22
+        default:
b97e22
+            return this.parent();
b97e22
+        }
b97e22
+    },
b97e22
+
b97e22
+    getActiveStatusLabel: function() {
b97e22
+        if (!this.device)
b97e22
+            return null;
b97e22
+
b97e22
+        switch(this.device.state) {
b97e22
+        case NetworkManager.DeviceState.DEACTIVATING:
b97e22
+            return _("disconnecting...");
b97e22
+        case NetworkManager.DeviceState.PREPARE:
b97e22
+        case NetworkManager.DeviceState.CONFIG:
b97e22
+        case NetworkManager.DeviceState.IP_CONFIG:
b97e22
+        case NetworkManager.DeviceState.IP_CHECK:
b97e22
+        case NetworkManager.DeviceState.SECONDARIES:
b97e22
+            return _("connecting...");
b97e22
+        case NetworkManager.DeviceState.NEED_AUTH:
b97e22
+            /* Translators: this is for network connections that require some kind of key or password */
b97e22
+            return _("authentication required");
b97e22
+        default:
b97e22
+            return null;
b97e22
+        }
b97e22
     },
b97e22
 
b97e22
     _createAutomaticConnection: function(apObj) {
b97e22
-- 
b97e22
1.8.4.2
b97e22