diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2022-03-08 15:38:36 +0100 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2022-03-21 13:55:00 +0100 |
commit | 2c60686d15892c4ddc40ab4f5c34de884618d9b8 (patch) | |
tree | 2bda37edb7d10689c615c6a33b225689240bdb9f | |
parent | 7bb56034be86e414efa701b91382ab96a2b6a737 (diff) | |
download | network-manager-applet-2c60686d15892c4ddc40ab4f5c34de884618d9b8.tar.gz |
applet: replace lock icon for WEP networks with an exclaimation mark
This is supposed to indicate that the network is not secure, analogously
to what web browsers do for bad certificates.
It's not beautiful, but I guess it's not a huge problem. By now the applet
is a probably a niche tool.
https://gitlab.gnome.org/GNOME/network-manager-applet/-/merge_requests/112
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | icons/22/nm-insecure-warn.png | bin | 0 -> 7437 bytes | |||
-rw-r--r-- | icons/meson.build | 1 | ||||
-rw-r--r-- | src/ap-menu-item.c | 38 |
4 files changed, 29 insertions, 11 deletions
diff --git a/Makefile.am b/Makefile.am index ad8407a9..9ce11178 100644 --- a/Makefile.am +++ b/Makefile.am @@ -65,6 +65,7 @@ icon22_DATA = \ icons/22/nm-device-wired-secure.png \ icons/22/nm-device-wired.png \ icons/22/nm-device-wwan.png \ + icons/22/nm-insecure-warn.png \ icons/22/nm-mb-roam.png \ icons/22/nm-no-connection.png \ icons/22/nm-secure-lock.png \ diff --git a/icons/22/nm-insecure-warn.png b/icons/22/nm-insecure-warn.png Binary files differnew file mode 100644 index 00000000..81ed16c6 --- /dev/null +++ b/icons/22/nm-insecure-warn.png diff --git a/icons/meson.build b/icons/meson.build index 4341112b..1b101897 100644 --- a/icons/meson.build +++ b/icons/meson.build @@ -9,6 +9,7 @@ icons_22 = [ 'nm-device-wired-secure.png', 'nm-device-wired.png', 'nm-device-wwan.png', + 'nm-insecure-warn.png', 'nm-mb-roam.png', 'nm-no-connection.png', 'nm-secure-lock.png', diff --git a/src/ap-menu-item.c b/src/ap-menu-item.c index 1da010fa..7f439301 100644 --- a/src/ap-menu-item.c +++ b/src/ap-menu-item.c @@ -34,6 +34,7 @@ typedef struct { gboolean has_connections; gboolean is_adhoc; gboolean is_encrypted; + gboolean is_insecure; } NMNetworkMenuItemPrivate; /******************************************************************/ @@ -71,6 +72,10 @@ update_atk_desc (NMNetworkMenuItem *item) g_string_append (desc, ", "); g_string_append (desc, _("secure.")); } + if (priv->is_insecure) { + g_string_append (desc, ", "); + g_string_append (desc, _("insecure.")); + } } atk_object_set_name (gtk_widget_get_accessible (GTK_WIDGET (item)), desc->str); @@ -100,18 +105,24 @@ update_icon (NMNetworkMenuItem *item, NMApplet *applet) icon = nma_icon_check_and_load (icon_name, applet); if (icon) { - if (priv->is_encrypted) { - GdkPixbuf *encrypted = nma_icon_check_and_load ("nm-secure-lock", applet); + GdkPixbuf *extra_icon; + + if (priv->is_insecure) { + extra_icon = nma_icon_check_and_load ("nm-insecure-warn", applet); + } else if (priv->is_encrypted) { + extra_icon = nma_icon_check_and_load ("nm-secure-lock", applet); + } else { + extra_icon = NULL; + } - if (encrypted) { - icon = icon_free = gdk_pixbuf_copy (icon); + if (extra_icon) { + icon = icon_free = gdk_pixbuf_copy (icon); - gdk_pixbuf_composite (encrypted, icon, 0, 0, - gdk_pixbuf_get_width (encrypted), - gdk_pixbuf_get_height (encrypted), - 0, 0, 1.0, 1.0, - GDK_INTERP_NEAREST, 255); - } + gdk_pixbuf_composite (extra_icon, icon, 0, 0, + gdk_pixbuf_get_width (extra_icon), + gdk_pixbuf_get_height (extra_icon), + 0, 0, 1.0, 1.0, + GDK_INTERP_NEAREST, 255); } /* Scale to menu size if larger so the menu doesn't look awful */ @@ -279,8 +290,13 @@ nm_network_menu_item_new (NMAccessPoint *ap, ap_flags = nm_access_point_get_flags (ap); ap_wpa = nm_access_point_get_wpa_flags (ap); ap_rsn = nm_access_point_get_rsn_flags (ap); - if ((ap_flags & NM_802_11_AP_FLAGS_PRIVACY) || ap_wpa || ap_rsn) + + if ((ap_flags & NM_802_11_AP_FLAGS_PRIVACY) && !ap_wpa && !ap_rsn) { + /* WEP connections. */ + priv->is_insecure = TRUE; + } else if ((ap_flags & NM_802_11_AP_FLAGS_PRIVACY) || ap_wpa || ap_rsn) { priv->is_encrypted = TRUE; + } /* Don't enable the menu item the device can't even connect to the AP */ if ( !nm_utils_security_valid (NMU_SEC_NONE, dev_caps, TRUE, priv->is_adhoc, ap_flags, ap_wpa, ap_rsn) |