--- gnome-network-properties.c	2010-03-22 18:36:53.000000000 +0100
+++ gnome-network-properties.c.new	2010-03-22 18:36:31.000000000 +0100
@@ -1338,20 +1338,7 @@
 static GConfValue *
 extract_proxy_host (GConfPropertyEditor *peditor, const GConfValue *orig)
 {
-	char const *entered_text = gconf_value_get_string (orig);
-	GConfValue *res = NULL;
-
-	if (entered_text != NULL) {
-		gchar *host = get_hostname_from_uri (entered_text);
-
-		if (host != NULL) {
-			res = gconf_value_new (GCONF_VALUE_STRING);
-			gconf_value_set_string (res, host);
-			g_free (host);
-		}
-	}
-
-	return (res != NULL) ? res : gconf_value_copy (orig);
+	return gconf_value_copy(orig);
 }
 
 static void
@@ -1407,6 +1394,26 @@
 	populate_listmodel (GTK_LIST_STORE (model), ignore_hosts);
 }
 
+static gboolean
+cb_host_entry_focus_out(GtkEntry *entry,
+						GdkEventFocus *event,
+				        gpointer key)
+{
+	GConfClient *client;
+	client = gconf_client_get_default ();
+
+	char const *entered_text = gtk_entry_get_text(entry);
+	gchar *host = NULL;
+
+	if (entered_text != NULL)
+		host = get_hostname_from_uri (entered_text);
+
+	gconf_client_set_string (client, (gchar *)key, (host != NULL)?host:entered_text, NULL);
+	g_free(host);
+	g_object_unref (client);
+	return FALSE;
+}
+
 static void
 setup_dialog (GtkBuilder *builder)
 {
@@ -1483,6 +1490,10 @@
 			  "clicked",
 			  G_CALLBACK (cb_http_details_button_clicked),
 			  _gtk_builder_get_widget (builder, "network_dialog"));
+	g_signal_connect (gtk_builder_get_object (builder, "http_host_entry"),
+			  "focus-out-event",
+			  G_CALLBACK (cb_host_entry_focus_out),
+			  HTTP_PROXY_HOST_KEY);
 
 	/* Secure */
  	port_value = gconf_client_get_int (client, SECURE_PROXY_PORT_KEY, NULL);
@@ -1496,6 +1507,10 @@
 			NULL, SECURE_PROXY_PORT_KEY,
 			_gtk_builder_get_widget (builder, "secure_port_spinbutton"),
 			NULL));
+	g_signal_connect (gtk_builder_get_object (builder, "secure_host_entry"),
+			  "focus-out-event",
+			  G_CALLBACK (cb_host_entry_focus_out),
+			  SECURE_PROXY_HOST_KEY);
 
 	/* Ftp */
  	port_value = gconf_client_get_int (client, FTP_PROXY_PORT_KEY, NULL);
@@ -1509,6 +1524,10 @@
 			NULL, FTP_PROXY_PORT_KEY,
 			_gtk_builder_get_widget (builder, "ftp_port_spinbutton"),
 			NULL));
+	g_signal_connect (gtk_builder_get_object (builder, "ftp_host_entry"),
+			  "focus-out-event",
+			  G_CALLBACK (cb_host_entry_focus_out),
+			  FTP_PROXY_HOST_KEY);
 
 	/* Socks */
  	port_value = gconf_client_get_int (client, SOCKS_PROXY_PORT_KEY, NULL);
@@ -1522,6 +1541,10 @@
 			NULL, SOCKS_PROXY_PORT_KEY,
 			_gtk_builder_get_widget (builder, "socks_port_spinbutton"),
 			NULL));
+	g_signal_connect (gtk_builder_get_object (builder, "socks_host_entry"),
+			  "focus-out-event",
+			  G_CALLBACK (cb_host_entry_focus_out),
+			  SOCKS_PROXY_HOST_KEY);
 
 	/* Set the proxy entries insensitive if we are using the same proxy for all,
 	   and make sure they are all synchronized */
