From fbca7353191c20b3ce70fe2390491305ba3968fa Mon Sep 17 00:00:00 2001 From: rbuj Date: Thu, 10 Dec 2020 10:42:59 +0100 Subject: netspeed: show ipv6 address in tooltip if ipv4 address is not used --- netspeed/src/netspeed.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'netspeed/src/netspeed.c') 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) { -- cgit v1.2.1