Index: lib/widgets/ephy-location-entry.c
===================================================================
RCS file: /cvs/gnome/epiphany/lib/widgets/ephy-location-entry.c,v
retrieving revision 1.57
diff -p -u -u -p -r1.57 ephy-location-entry.c
--- lib/widgets/ephy-location-entry.c	6 Feb 2005 14:37:12 -0000	1.57
+++ lib/widgets/ephy-location-entry.c	22 Mar 2005 08:41:43 -0000
@@ -32,6 +32,7 @@
 #include "ephy-debug.h"
 
 #include <glib/gi18n.h>
+#include <gdk/gdkkeysyms.h>
 #include <gtk/gtktoolbar.h>
 #include <gtk/gtkentry.h>
 #include <gtk/gtkwindow.h>
@@ -246,6 +247,27 @@ entry_button_press_cb (GtkWidget *entry,
 }
 
 static gboolean
+entry_key_press_cb (GtkWidget *widget,
+		    GdkEventKey *event,
+		    EphyLocationEntry *entry)
+{
+	if (event->keyval == GDK_Escape)
+	{
+		char *url = NULL;
+
+		g_signal_emit (entry, signals[GET_LOCATION], 0, &url);
+		gtk_entry_set_text (GTK_ENTRY (widget), url ? url : "");
+		g_free (url);
+
+		/* Don't consume the keypress, since we want the default
+		 * action (close autocompletion popup) too.
+		 */
+	}
+
+	return FALSE;
+}
+
+static gboolean
 keyword_match (const char *list,
 	       const char *keyword)
 {
@@ -586,6 +608,8 @@ ephy_location_entry_construct_contents (
 			  G_CALLBACK (entry_populate_popup_cb), entry);
 	g_signal_connect (priv->entry, "button_press_event",
 			  G_CALLBACK (entry_button_press_cb), entry);
+	g_signal_connect (priv->entry, "key-press-event",
+			  G_CALLBACK (entry_key_press_cb), entry);
 	g_signal_connect (priv->entry, "changed",
 			  G_CALLBACK (editable_changed_cb), entry);
 	g_signal_connect (priv->entry, "drag_motion",
