changeset 27276:df8d6f75535a

Don't colourize the IP entry field when it's empty, and reset the actual public IP pref as well, so old entries don't keep showing up.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sat, 04 Jul 2009 04:22:25 +0000
parents 00d9a2e24797
children c65ad9007e42
files pidgin/gtkprefs.c
diffstat 1 files changed, 18 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkprefs.c	Sat Jul 04 03:24:43 2009 +0000
+++ b/pidgin/gtkprefs.c	Sat Jul 04 04:22:25 2009 +0000
@@ -1642,22 +1642,25 @@
 	const gchar *text = gtk_entry_get_text(entry);
 	GdkColor color;
 
-	if (purple_ip_address_is_valid(text))
-	{
-		color.red = 0xAFFF;
-		color.green = 0xFFFF;
-		color.blue = 0xAFFF;
-
-		purple_network_set_public_ip(text);
+	if (text && *text) {
+		if (purple_ip_address_is_valid(text)) {
+			color.red = 0xAFFF;
+			color.green = 0xFFFF;
+			color.blue = 0xAFFF;
+
+			purple_network_set_public_ip(text);
+		} else {
+			color.red = 0xFFFF;
+			color.green = 0xAFFF;
+			color.blue = 0xAFFF;
+		}
+
+		gtk_widget_modify_base(GTK_WIDGET(entry), GTK_STATE_NORMAL, &color);
+
+	} else {
+		purple_network_set_public_ip("");
+		gtk_widget_modify_base(GTK_WIDGET(entry), GTK_STATE_NORMAL, NULL);
 	}
-	else
-	{
-		color.red = 0xFFFF;
-		color.green = 0xAFFF;
-		color.blue = 0xAFFF;
-	}
-
-	gtk_widget_modify_base(GTK_WIDGET(entry), GTK_STATE_NORMAL, &color);
 }
 
 static gboolean