Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 46ef092a92244f60eed1921776289740 > files > 9

NetworkManager-0.7.0-4.sl5_2.0.6.4.src.rpm

Index: NetworkManager-0.6.4/gnome/applet/applet.c
===================================================================
--- NetworkManager-0.6.4/gnome/applet/applet.c	(revision 448)
+++ NetworkManager-0.6.4/gnome/applet/applet.c	(working copy)
@@ -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 @@ static GdkPixbuf *nma_get_connected_icon
 			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;
 }
@@ -1096,10 +1096,14 @@ void nma_update_state (NMApplet *applet)
 			break;
 
 		case NM_STATE_CONNECTED:
-			if (network_device_is_wired (act_dev))
-				tip = g_strdup (_("Wired network connection"));
-			else if (network_device_is_wireless (act_dev))
-			{
+			if (network_device_is_wired (act_dev)) {
+				const char *str_addr = network_device_get_ip4_address (act_dev);
+
+				if (str_addr && !strncmp (str_addr, LL_ADDR_PREFIX, strlen (LL_ADDR_PREFIX)))
+					tip = g_strdup (_("Wired network connection with a self-assigned address"));
+				else
+					tip = g_strdup (_("Wired network connection"));
+			} else if (network_device_is_wireless (act_dev)) {
 				if (applet->is_adhoc)
 					tip = g_strdup (_("Connected to an Ad-Hoc wireless network"));
 				else
@@ -2589,6 +2597,7 @@ static void nma_icons_free (NMApplet *ap
 
 	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 @@ static void nma_icons_zero (NMApplet *ap
 
 	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 @@ nma_icons_load_from_disk (NMApplet *appl
 
 	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");
 
Index: NetworkManager-0.6.4/gnome/applet/applet.h
===================================================================
--- NetworkManager-0.6.4/gnome/applet/applet.h	(revision 448)
+++ NetworkManager-0.6.4/gnome/applet/applet.h	(working copy)
@@ -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 @@ typedef struct
 
 	GdkPixbuf *		no_connection_icon;
 	GdkPixbuf *		wired_icon;
+	GdkPixbuf *		wired_autoip_icon;
 	GdkPixbuf *		adhoc_icon;
 	GdkPixbuf *		wireless_00_icon;
 	GdkPixbuf *		wireless_25_icon;
Index: NetworkManager-0.6.4/gnome/applet/applet-dbus-devices.c
===================================================================
--- NetworkManager-0.6.4/gnome/applet/applet-dbus-devices.c	(revision 448)
+++ NetworkManager-0.6.4/gnome/applet/applet-dbus-devices.c	(working copy)
@@ -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 @@ static void nma_dbus_device_activated_cb
 
 #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);
Index: NetworkManager-0.6.4/gnome/applet/icons/Makefile.am
===================================================================
--- NetworkManager-0.6.4/gnome/applet/icons/Makefile.am	(revision 448)
+++ NetworkManager-0.6.4/gnome/applet/icons/Makefile.am	(working copy)
@@ -9,6 +9,7 @@ smallicondir=${datadir}/icons/hicolor/22
 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	\