diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2022-03-08 15:38:36 +0100 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2022-03-08 15:41:10 +0100 |
commit | cb8604e6e8b0a4f31d04f18b416c50b4bedf57ef (patch) | |
tree | e7f438a08c1b33c042e1573070858c0697c9a4bf | |
parent | 041077276468333e09313e77927ce722daabd507 (diff) | |
download | network-manager-applet-lr/bad-wep.tar.gz |
applet: replace lock icon for WEP networks with an exclaimation marklr/bad-wep
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.
-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) |