aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2005-04-11 03:28:10 +0800
committerChristian Persch <chpe@src.gnome.org>2005-04-11 03:28:10 +0800
commit36dbd0e5b656c62c8a0860f668c313cf3ae010de (patch)
treee12e05e4d94962431db354d0ab5424768a60cd4d
parentb53d58efcee1ef734894b4b7d27afe9535f9e922 (diff)
downloadgsoc2013-epiphany-36dbd0e5b656c62c8a0860f668c313cf3ae010de.tar
gsoc2013-epiphany-36dbd0e5b656c62c8a0860f668c313cf3ae010de.tar.gz
gsoc2013-epiphany-36dbd0e5b656c62c8a0860f668c313cf3ae010de.tar.bz2
gsoc2013-epiphany-36dbd0e5b656c62c8a0860f668c313cf3ae010de.tar.lz
gsoc2013-epiphany-36dbd0e5b656c62c8a0860f668c313cf3ae010de.tar.xz
gsoc2013-epiphany-36dbd0e5b656c62c8a0860f668c313cf3ae010de.tar.zst
gsoc2013-epiphany-36dbd0e5b656c62c8a0860f668c313cf3ae010de.zip
Restore original URL when pressing ESC. Fixes bug #171179.
2005-04-10 Christian Persch <chpe@cvs.gnome.org> * lib/widgets/ephy-location-entry.c: (entry_key_press_cb), (ephy_location_entry_construct_contents), (ephy_location_entry_get_location), (ephy_location_entry_restore_location): * lib/widgets/ephy-location-entry.h: Restore original URL when pressing ESC. Fixes bug #171179.
-rw-r--r--ChangeLog10
-rw-r--r--lib/widgets/ephy-location-entry.c32
-rw-r--r--lib/widgets/ephy-location-entry.h2
3 files changed, 44 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 1f375dc27..9a229db66 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2005-04-10 Christian Persch <chpe@cvs.gnome.org>
+ * lib/widgets/ephy-location-entry.c: (entry_key_press_cb),
+ (ephy_location_entry_construct_contents),
+ (ephy_location_entry_get_location),
+ (ephy_location_entry_restore_location):
+ * lib/widgets/ephy-location-entry.h:
+
+ Restore original URL when pressing ESC. Fixes bug #171179.
+
+2005-04-10 Christian Persch <chpe@cvs.gnome.org>
+
* lib/ephy-node-db.c: (ephy_node_db_get_property),
(ephy_node_db_set_property), (ephy_node_db_finalize),
(ephy_node_db_write_to_xml_safe), (ephy_node_db_class_init),
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c
index b78612f72..426c874b9 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -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,23 @@ entry_button_press_cb (GtkWidget *entry, GdkEventButton *event, EphyLocationEntr
}
static gboolean
+entry_key_press_cb (GtkWidget *widget,
+ GdkEventKey *event,
+ EphyLocationEntry *entry)
+{
+ if (event->keyval == GDK_Escape)
+ {
+ ephy_location_entry_restore_location (entry);
+
+ /* 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 +604,8 @@ ephy_location_entry_construct_contents (EphyLocationEntry *entry)
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",
@@ -702,6 +722,18 @@ ephy_location_entry_get_location (EphyLocationEntry *le)
}
void
+ephy_location_entry_restore_location (EphyLocationEntry *entry)
+{
+ char *url = NULL;
+
+ g_return_if_fail (EPHY_IS_LOCATION_ENTRY (entry));
+
+ g_signal_emit (entry, signals[GET_LOCATION], 0, &url);
+ gtk_entry_set_text (GTK_ENTRY (entry->priv->entry), url ? url : "");
+ g_free (url);
+}
+
+void
ephy_location_entry_activate (EphyLocationEntry *le)
{
GtkWidget *toplevel;
diff --git a/lib/widgets/ephy-location-entry.h b/lib/widgets/ephy-location-entry.h
index 2c72590a8..1373a5ba2 100644
--- a/lib/widgets/ephy-location-entry.h
+++ b/lib/widgets/ephy-location-entry.h
@@ -78,6 +78,8 @@ void ephy_location_entry_set_location (EphyLocationEntry *le,
const char *ephy_location_entry_get_location (EphyLocationEntry *le);
+void ephy_location_entry_restore_location (EphyLocationEntry *le);
+
void ephy_location_entry_activate (EphyLocationEntry *le);
GtkWidget *ephy_location_entry_get_entry (EphyLocationEntry *entry);