After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 686357 - NM-applet always show full signal strength in connection established notification
NM-applet always show full signal strength in connection established notifica...
Status: RESOLVED FIXED
Product: NetworkManager
Classification: Platform
Component: nm-applet
git master
Other Linux
: Normal minor
: ---
Assigned To: NetworkManager maintainer(s)
NetworkManager maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2012-10-18 08:58 UTC by Marius Kotsbak
Modified: 2016-02-23 22:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Modified the wifi connected notification to indicate true signal strength (1.63 KB, patch)
2015-05-27 10:48 UTC, Matias Wilkman
none Details | Review
applet: indicate true signal strength in wifi connected notification (1.43 KB, patch)
2015-06-02 21:45 UTC, Thomas Haller
none Details | Review

Description Marius Kotsbak 2012-10-18 08:58:33 UTC
In applet-device-xxx.c, when the connections are establisthed, a notification is triggered "Connection Established", but the icon is always e.g. "notification-gsm-high".

We need separate icons for the other network strengths, or if it is too early to know the network strength, the icon should not look like signal strength.
Comment 1 Marius Kotsbak 2012-10-18 09:00:37 UTC
Downstream Ubuntu bug report: https://bugs.launchpad.net/network-manager/+bug/387626
Comment 2 Marius Kotsbak 2014-08-13 08:49:57 UTC
This is now called "nm-signal-100" in src/applet-device-gsm.c, but it is still the same used regardless of signal strength. Seems like for wifi, a general icon is used without any signal strength.
Comment 3 Matias Wilkman 2015-05-27 10:44:55 UTC
(In reply to Marius Kotsbak from comment #0)
> In applet-device-xxx.c, when the connections are establisthed, a
> notification is triggered "Connection Established", but the icon is always
> e.g. "notification-gsm-high".
> 
> We need separate icons for the other network strengths, or if it is too
> early to know the network strength, the icon should not look like signal
> strength.

This bothered me too, so I made a patch that makes the icon in the notification vary based on actual signal strength. Note that the icons used are the 22x22 ones that ship with nm-applet, whereas the one used previously, nm-device-wireless.png, is 48x48. This leads to some image interpolation blur. Also, if the signal strength changes during the display time of the notification, this change does not reflect in the icon (unlike the system tray status icon).

Here's the patch:

From add14003900cc18d4af35bde9197a17ace417606 Mon Sep 17 00:00:00 2001
From: Matias Wilkman <matias.wilkman@gmail.com>
Date: Wed, 27 May 2015 13:06:24 +0300
Subject: [PATCH 1/1] Modified the wifi connected notification to indicate true
 signal strength instead of showing full bars always.

---
 src/applet-device-wifi.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/applet-device-wifi.c b/src/applet-device-wifi.c
index 91d0ea8..99c2d78 100644
--- a/src/applet-device-wifi.c
+++ b/src/applet-device-wifi.c
@@ -1226,13 +1226,30 @@ wifi_notify_connected (NMDevice *device,
 	NMAccessPoint *ap;
 	char *esc_ssid;
 	char *ssid_msg;
+	char *signal_strength_icon;
+	guint8 strength;
 
 	ap = g_object_get_data (G_OBJECT (device), ACTIVE_AP_TAG);
 
 	esc_ssid = get_ssid_utf8 (ap);
+
+	strength = ap ? nm_access_point_get_strength (ap) : 0;
+	strength = MIN (strength, 100);
+ 
+	if (strength > 80)
+		signal_strength_icon = "nm-signal-100";
+	else if (strength > 55)
+		signal_strength_icon = "nm-signal-75";
+	else if (strength > 30)
+		signal_strength_icon = "nm-signal-50";
+	else if (strength > 5)
+		signal_strength_icon = "nm-signal-25";
+	else
+		signal_strength_icon = "nm-signal-00";
+
 	ssid_msg = g_strdup_printf (_("You are now connected to the Wi-Fi network '%s'."), esc_ssid);
 	applet_do_notify_with_pref (applet, _("Connection Established"),
-	                            ssid_msg, "nm-device-wireless",
+	                            ssid_msg, signal_strength_icon/*"nm-device-wireless"*/,
 	                            PREF_DISABLE_CONNECTED_NOTIFICATIONS);
 	g_free (ssid_msg);
 	g_free (esc_ssid);
-- 
2.1.4
Comment 4 Matias Wilkman 2015-05-27 10:48:21 UTC
Created attachment 304057 [details] [review]
Modified the wifi connected notification to indicate true  signal strength

Note that the icons used are the 22x22 ones that ship with nm-applet, whereas the one used previously, nm-device-wireless.png, is 48x48. This leads to some image interpolation blur. Also, if the signal strength changes during the display time of the notification, this change does not reflect in the icon (unlike the system tray status icon).
Comment 5 Thomas Haller 2015-05-27 12:42:40 UTC
(In reply to Matias Wilkman from comment #4)
> Created attachment 304057 [details] [review] [review]
> Modified the wifi connected notification to indicate true  signal strength
> 
> Note that the icons used are the 22x22 ones that ship with nm-applet,
> whereas the one used previously, nm-device-wireless.png, is 48x48. This
> leads to some image interpolation blur. Also, if the signal strength changes
> during the display time of the notification, this change does not reflect in
> the icon (unlike the system tray status icon).

IMO it's ok that later changes are not considered for the notification-icon.



How about replacing the if/else with:


+
+    if (!ap)
+         signal_strength_icon = "nm-device-wireless";
+    else
+         signal_strength_icon = mobile_helper_get_quality_icon_name (nm_access_point_get_strength (ap));
+


for one, if we don't have an @ap, continue to use "nm-device-wireless".
Secondly, reuse mobile_helper_get_quality_icon_name().
Comment 6 Matias Wilkman 2015-05-27 13:19:28 UTC
>How about replacing the if/else with:

Yes, that's better!
Comment 7 Thomas Haller 2015-06-02 21:45:29 UTC
Created attachment 304460 [details] [review]
applet: indicate true signal strength in wifi connected notification

Instead of showing always full bars.

[thaller@redhat.com: modified original patch]
Comment 8 Matias Wilkman 2015-06-17 01:55:38 UTC
As far as I can tell, this is now fixed in network-manager-gnome 1.0.2-1 in Debian Unstable. Feel free to close this issue after verification.
Comment 9 Dan Williams 2016-02-23 17:00:44 UTC
(In reply to Thomas Haller from comment #7)
> Created attachment 304460 [details] [review] [review]
> applet: indicate true signal strength in wifi connected notification
> 
> Instead of showing always full bars.
> 
> [thaller@redhat.com: modified original patch]

LGTM
Comment 11 Thomas Haller 2016-02-23 22:11:36 UTC
and a second fix for nm-device-broadband.c:

https://git.gnome.org/browse/network-manager-applet/commit/?id=0261738a42f2c082114a7ef7b7085908498cac56


Closing bug as RESOLVED.