summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrbuj <[email protected]>2020-12-10 10:42:59 +0100
committerraveit65 <[email protected]>2020-12-13 16:15:04 +0100
commitfbca7353191c20b3ce70fe2390491305ba3968fa (patch)
tree0870facf4a4a103ca04093df2aaf65e5e2c913f6
parent61e25238728dd5cb9922932a5b7279eb6cdb15da (diff)
downloadmate-applets-fbca7353191c20b3ce70fe2390491305ba3968fa.tar.bz2
mate-applets-fbca7353191c20b3ce70fe2390491305ba3968fa.tar.xz
netspeed: show ipv6 address in tooltip if ipv4 address is not used
-rw-r--r--netspeed/src/netspeed.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/netspeed/src/netspeed.c b/netspeed/src/netspeed.c
index 3d1e202c..a8eb1cc3 100644
--- a/netspeed/src/netspeed.c
+++ b/netspeed/src/netspeed.c
@@ -873,9 +873,9 @@ update_applet (MateNetspeedApplet *applet)
#endif
}
- update_tooltip(applet);
+ update_tooltip (applet);
- /* Refresh the text of the labels and tooltip */
+ /* Refresh the text of the labels */
if (applet->show_sum) {
gtk_label_set_text (GTK_LABEL (applet->sum_label),
applet->devinfo->sum_rate);
@@ -1475,13 +1475,19 @@ update_tooltip (MateNetspeedApplet* applet)
g_string_printf(tooltip, _("%s is down"), applet->devinfo->name);
else {
char ipv4_text [INET_ADDRSTRLEN];
+ char ipv6_text [INET6_ADDRSTRLEN];
char *ip;
if (applet->devinfo->ip) {
format_ipv4 (applet->devinfo->ip, ipv4_text);
ip = ipv4_text;
} else {
- ip = _("has no ip");
+ format_ipv6 (applet->devinfo->ipv6, ipv6_text);
+ if (strlen (ipv6_text) > 2) {
+ ip = ipv6_text;
+ } else {
+ ip = _("has no ip");
+ }
}
if (applet->show_sum) {