epiphany r8239 - trunk/src
- From: cosimoc svn gnome org
- To: svn-commits-list gnome org
- Subject: epiphany r8239 - trunk/src
- Date: Mon, 19 May 2008 19:36:47 +0000 (UTC)
Author: cosimoc
Date: Mon May 19 19:36:47 2008
New Revision: 8239
URL: http://svn.gnome.org/viewvc/epiphany?rev=8239&view=rev
Log:
Block updates of the location entry while it is keyboard-focused.
This is to avoid deletion of the text while the user is typing.
Close bug #488680.
Modified:
trunk/src/ephy-location-action.c
Modified: trunk/src/ephy-location-action.c
==============================================================================
--- trunk/src/ephy-location-action.c (original)
+++ trunk/src/ephy-location-action.c Mon May 19 19:36:47 2008
@@ -58,6 +58,7 @@
guint editable : 1;
guint show_lock : 1;
guint secure : 1;
+ gboolean sync_address_is_blocked;
};
static void ephy_location_action_init (EphyLocationAction *action);
@@ -243,11 +244,20 @@
static void
entry_activate_cb (GtkEntry *entry,
- EphyLocationAction *action)
+ EphyLocationAction *proxy)
{
EphyBookmarks *bookmarks;
const char *content;
char *address;
+ GtkAction *action;
+
+ action = gtk_widget_get_action (GTK_WIDGET (proxy));
+
+ if (EPHY_LOCATION_ACTION (action)->priv->sync_address_is_blocked)
+ {
+ EPHY_LOCATION_ACTION (action)->priv->sync_address_is_blocked = FALSE;
+ g_signal_handlers_unblock_by_func (action, G_CALLBACK (sync_address), proxy);
+ }
content = gtk_entry_get_text (entry);
if (content == NULL || content[0] == '\0') return;
@@ -450,6 +460,40 @@
G_CALLBACK (action_activated_cb), action);
}
+static gboolean
+focus_in_event_cb (GtkWidget *entry,
+ GdkEventFocus *event,
+ GtkWidget *proxy)
+{
+ GtkAction *action;
+ action = gtk_widget_get_action (proxy);
+
+ if (!EPHY_LOCATION_ACTION (action)->priv->sync_address_is_blocked)
+ {
+ EPHY_LOCATION_ACTION (action)->priv->sync_address_is_blocked = TRUE;
+ g_signal_handlers_block_by_func (action, G_CALLBACK (sync_address), proxy);
+ }
+
+ return FALSE;
+}
+
+static gboolean
+focus_out_event_cb (GtkWidget *entry,
+ GdkEventFocus *event,
+ GtkWidget *proxy)
+{
+ GtkAction *action;
+ action = gtk_widget_get_action (GTK_WIDGET (proxy));
+
+ if (EPHY_LOCATION_ACTION (action)->priv->sync_address_is_blocked)
+ {
+ EPHY_LOCATION_ACTION (action)->priv->sync_address_is_blocked = FALSE;
+ g_signal_handlers_unblock_by_func (action, G_CALLBACK (sync_address), proxy);
+ }
+
+ return FALSE;
+}
+
static void
connect_proxy (GtkAction *action, GtkWidget *proxy)
{
@@ -501,7 +545,7 @@
entry = ephy_location_entry_get_entry (lentry);
g_signal_connect_object (entry, "activate",
G_CALLBACK (entry_activate_cb),
- action, 0);
+ proxy, 0);
g_signal_connect_object (proxy, "user-changed",
G_CALLBACK (user_changed_cb), action, 0);
g_signal_connect_object (proxy, "lock-clicked",
@@ -510,6 +554,10 @@
G_CALLBACK (get_location_cb), action, 0);
g_signal_connect_object (proxy, "get-title",
G_CALLBACK (get_title_cb), action, 0);
+ g_signal_connect_object (entry, "focus-in-event",
+ G_CALLBACK (focus_in_event_cb), proxy, 0);
+ g_signal_connect_object (entry, "focus-out-event",
+ G_CALLBACK (focus_out_event_cb), proxy, 0);
}
GTK_ACTION_CLASS (ephy_location_action_parent_class)->connect_proxy (action, proxy);
@@ -825,6 +873,7 @@
priv->bookmarks = ephy_shell_get_bookmarks (ephy_shell);
priv->smart_bmks = ephy_bookmarks_get_smart_bookmarks
(action->priv->bookmarks);
+ priv->sync_address_is_blocked = FALSE;
init_actions_list (action);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]