Display nm-secure-lock in appet if wlan is secure



Hi guys,

I'm new to the list. Sorry if this kind of message is not appropriate.

The thing is that I find it a bit annoying that nm applet does not show the nm-secure-lock icon on top of the nm-signal-XX icon when I'm connected to a secure wlan network. I connect to may different wlans on a daily basis. In some of them my packets are transmitted encrypted, in some others are transmitted in the clear, and it would be great to have a visual aid to remind me to which kind of wlan I'm connected to (so I don't, for example, check my email using POP3).

I wanted to provide a proper patch for the issue but I haven't been able to compile nm from the sources. However, I attach an incomplete and untested patch, that maybe one of you guys can use. Do you think something like this could be implemented in trunk?

Thank you very much for your help.

Regards,

G.

 
--- applet-device-wifi.c	2010-08-10 20:47:03.000000000 +0200
+++ applet-device-wifi.c.patched	2011-06-11 13:10:15.000000000 +0200
@@ -1262,6 +1262,16 @@
 	g_free (esc_ssid);
 }
 
+int current_wlan_is_secure(){
+    // If current connection is "secure"
+    //   return 1
+    // else
+    // TODO: Unimplemented @todo: This function should check from some global
+    // variable if the wireless connection is secure or not.
+    return 0;
+}
+
+
 static GdkPixbuf *
 wireless_get_icon (NMDevice *device,
                    NMDeviceState state,
@@ -1271,7 +1281,7 @@
 {
 	NMSettingConnection *s_con;
 	NMAccessPoint *ap;
-	GdkPixbuf *pixbuf = NULL;
+	GdkPixbuf *pixbuf = NULL, *top = NULL;
 	const char *id;
 	char *ssid = NULL;
 
@@ -1330,6 +1340,16 @@
 			pixbuf = nma_icon_check_and_load ("nm-signal-00", &applet->wireless_00_icon, applet);
 			*tip = g_strdup_printf (_("Wireless network connection '%s' active"), id);
 		}
+
+        /* If the AP is "secure", composite the lock icon on top of the signal bars */
+        if ( current_wlan_is_secure() ) {
+            top = nma_icon_check_and_load ("nm-secure-lock", &applet->secure_lock_icon, applet);
+            gdk_pixbuf_composite (top, pixbuf, 0, 0, gdk_pixbuf_get_width (top),
+                                  gdk_pixbuf_get_height (top),
+                                  0, 0, 1.0, 1.0,
+                                  GDK_INTERP_NEAREST, 255);
+        }
+    
 		break;
 	default:
 		break;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]