network-manager-applet r450 - in branches/network-manager-applet-0-6: . icons src



Author: dcbw
Date: Wed Jan 16 21:14:28 2008
New Revision: 450
URL: http://svn.gnome.org/viewvc/network-manager-applet?rev=450&view=rev

Log:
2008-01-16  Dan Williams  <dcbw redhat com>

	* src/applet.c
	  src/applet.h
		- (nma_get_connected_icon): use a different icon to indicate an autoip
			connection
		- (nma_icons_free, nma_icons_zero, nma_icons_load_from_disk):
			housekeeping on the wired autoip icon

	* icons/nm-device-wired-autoip.png
	  icons/Makefile.am
		- new icon for wired-but-self-assigned-ip

	* src/applet-dbus-devices.c
		- (nma_dbus_device_activated_cb): change tooltip and notification icon
			when connected using an autoip address



Added:
   branches/network-manager-applet-0-6/icons/nm-device-wired-autoip.png   (contents, props changed)
Modified:
   branches/network-manager-applet-0-6/ChangeLog
   branches/network-manager-applet-0-6/icons/Makefile.am
   branches/network-manager-applet-0-6/src/applet-dbus-devices.c
   branches/network-manager-applet-0-6/src/applet.c
   branches/network-manager-applet-0-6/src/applet.h

Modified: branches/network-manager-applet-0-6/icons/Makefile.am
==============================================================================
--- branches/network-manager-applet-0-6/icons/Makefile.am	(original)
+++ branches/network-manager-applet-0-6/icons/Makefile.am	Wed Jan 16 21:14:28 2008
@@ -9,6 +9,7 @@
 smallicon_DATA=		\
 	nm-no-connection.png\
 	nm-device-wired.png	\
+	nm-device-wired-autoip.png	\
 	nm-adhoc.png		\
 	nm-stage01-connecting01.png	\
 	nm-stage01-connecting02.png	\

Added: branches/network-manager-applet-0-6/icons/nm-device-wired-autoip.png
==============================================================================
Binary file. No diff available.

Modified: branches/network-manager-applet-0-6/src/applet-dbus-devices.c
==============================================================================
--- branches/network-manager-applet-0-6/src/applet-dbus-devices.c	(original)
+++ branches/network-manager-applet-0-6/src/applet-dbus-devices.c	Wed Jan 16 21:14:28 2008
@@ -33,6 +33,9 @@
 #include <string.h>
 #include <dbus/dbus.h>
 #include <dbus/dbus-glib-lowlevel.h>
+#include <sys/types.h>
+#include <arpa/inet.h>
+#include <sys/socket.h>
 #include "applet-notifications.h"
 #include "applet-dbus-devices.h"
 #include "applet-dbus.h"
@@ -904,24 +907,27 @@
 
 #ifdef ENABLE_NOTIFY
 	active_device = nma_get_first_active_device (applet->device_list);
-	if (active_device && network_device_is_wireless (active_device))
-	{
-		if (applet->is_adhoc)
-		{
+	if (!active_device)
+		goto out;
+
+	if (network_device_is_wireless (active_device)) {
+		if (applet->is_adhoc) {
 			message = g_strdup_printf (_("You are now connected to the Ad-Hoc wireless network '%s'."), essid);
 			icon = "nm-adhoc";
-		}
-		else
-		{
+		} else {
 			message = g_strdup_printf (_("You are now connected to the wireless network '%s'."), essid);
 			icon = "nm-device-wireless";
 		}
+	} else {
+		const char *str_addr = network_device_get_ip4_address (active_device);
 		
-	}
-	else
-	{
-		message = g_strdup (_("You are now connected to the wired network."));
-		icon = "nm-device-wired";
+		if (str_addr && !strncmp (str_addr, LL_ADDR_PREFIX, strlen (LL_ADDR_PREFIX))) {
+			message = g_strdup (_("You are now connected to the wired network with a self-assigned address."));
+			icon = "nm-device-wired-autoip";
+		} else {
+			message = g_strdup (_("You are now connected to the wired network."));
+			icon = "nm-device-wired";
+		}
 	}
 
 	nm_info ("%s", message);

Modified: branches/network-manager-applet-0-6/src/applet.c
==============================================================================
--- branches/network-manager-applet-0-6/src/applet.c	(original)
+++ branches/network-manager-applet-0-6/src/applet.c	Wed Jan 16 21:14:28 2008
@@ -32,6 +32,9 @@
 #endif
 
 #include <string.h>
+#include <sys/types.h>
+#include <arpa/inet.h>
+#include <sys/socket.h>
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
 #include <libgnomeui/libgnomeui.h>
@@ -878,9 +881,14 @@
 			else
 				pixbuf = applet->wireless_00_icon;
 		}
+	} else {
+		const char *str_addr = network_device_get_ip4_address (dev);
+
+		if (str_addr && !strncmp (str_addr, LL_ADDR_PREFIX, strlen (LL_ADDR_PREFIX)))
+			pixbuf = applet->wired_autoip_icon;
+		else
+			pixbuf = applet->wired_icon;
 	}
-	else
-		pixbuf = applet->wired_icon;
 
 	return pixbuf;
 }
@@ -2589,6 +2597,7 @@
 
 	g_object_unref (applet->no_connection_icon);
 	g_object_unref (applet->wired_icon);
+	g_object_unref (applet->wired_autoip_icon);
 	g_object_unref (applet->adhoc_icon);
 	g_object_unref (applet->vpn_lock_icon);
 
@@ -2616,6 +2625,7 @@
 
 	applet->no_connection_icon = NULL;
 	applet->wired_icon = NULL;
+	applet->wired_autoip_icon = NULL;
 	applet->adhoc_icon = NULL;
 	applet->vpn_lock_icon = NULL;
 
@@ -2664,6 +2674,7 @@
 
 	ICON_LOAD(applet->no_connection_icon, "nm-no-connection");
 	ICON_LOAD(applet->wired_icon, "nm-device-wired");
+	ICON_LOAD(applet->wired_autoip_icon, "nm-device-wired-autoip");
 	ICON_LOAD(applet->adhoc_icon, "nm-adhoc");
 	ICON_LOAD(applet->vpn_lock_icon, "nm-vpn-lock");
 

Modified: branches/network-manager-applet-0-6/src/applet.h
==============================================================================
--- branches/network-manager-applet-0-6/src/applet.h	(original)
+++ branches/network-manager-applet-0-6/src/applet.h	Wed Jan 16 21:14:28 2008
@@ -42,6 +42,8 @@
 #include <libnotify/notify.h>
 #endif
 
+#include <arpa/inet.h>
+
 /*
  * Preference locations
  */
@@ -50,6 +52,7 @@
 #define GCONF_PATH_VPN_CONNECTIONS		"/system/networking/vpn_connections"
 #define GCONF_PATH_PREFS				"/apps/NetworkManagerApplet"
 
+#define LL_ADDR_PREFIX "169.254."
 
 typedef struct VPNConnection VPNConnection;
 
@@ -96,6 +99,7 @@
 
 	GdkPixbuf *		no_connection_icon;
 	GdkPixbuf *		wired_icon;
+	GdkPixbuf *		wired_autoip_icon;
 	GdkPixbuf *		adhoc_icon;
 	GdkPixbuf *		wireless_00_icon;
 	GdkPixbuf *		wireless_25_icon;



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