diff options
author | Xan Lopez <xan@gnome.org> | 2009-09-10 21:34:47 +0800 |
---|---|---|
committer | Xan Lopez <xan@gnome.org> | 2009-09-10 21:38:59 +0800 |
commit | b2dbd47c3f06203d4394c10599011734ad77ae32 (patch) | |
tree | 5e3e2f47b494e4009794d0315d89d6a9a1ea8415 | |
parent | 8512d034350be7c2484a365c3b200fe9f83f521e (diff) | |
download | gsoc2013-epiphany-b2dbd47c3f06203d4394c10599011734ad77ae32.tar gsoc2013-epiphany-b2dbd47c3f06203d4394c10599011734ad77ae32.tar.gz gsoc2013-epiphany-b2dbd47c3f06203d4394c10599011734ad77ae32.tar.bz2 gsoc2013-epiphany-b2dbd47c3f06203d4394c10599011734ad77ae32.tar.lz gsoc2013-epiphany-b2dbd47c3f06203d4394c10599011734ad77ae32.tar.xz gsoc2013-epiphany-b2dbd47c3f06203d4394c10599011734ad77ae32.tar.zst gsoc2013-epiphany-b2dbd47c3f06203d4394c10599011734ad77ae32.zip |
ephy-location-action.c: unblock address sync on switch-page too
We need to unblock the address syncing for the location on switch-page
too, since it's not guaranteed that we'll receive a focus-out or
activate event before we are interested in resyncing the URL entry
again. For example, if the focus is on the entry and we switch tabs
with the keyboard shortcut the entry will go out of sync, keeping the
URL of the previous tab.
Bug #594346
-rw-r--r-- | src/ephy-location-action.c | 52 |
1 files changed, 46 insertions, 6 deletions
diff --git a/src/ephy-location-action.c b/src/ephy-location-action.c index 0394d6e4a..66a3c6393 100644 --- a/src/ephy-location-action.c +++ b/src/ephy-location-action.c @@ -39,6 +39,7 @@ struct _EphyLocationActionPrivate { EphyWindow *window; + GtkWidget *proxy; GList *actions; char *address; char *typed_address; @@ -180,12 +181,14 @@ entry_activate_cb (GtkEntry *entry, const char *content; char *address; GtkAction *action; + EphyLocationActionPrivate *priv; action = gtk_activatable_get_related_action (GTK_ACTIVATABLE (proxy)); + priv = EPHY_LOCATION_ACTION (action)->priv; - if (EPHY_LOCATION_ACTION (action)->priv->sync_address_is_blocked) + if (priv->sync_address_is_blocked) { - EPHY_LOCATION_ACTION (action)->priv->sync_address_is_blocked = FALSE; + priv->sync_address_is_blocked = FALSE; g_signal_handlers_unblock_by_func (action, G_CALLBACK (sync_address), proxy); } @@ -396,11 +399,14 @@ focus_in_event_cb (GtkWidget *entry, GtkWidget *proxy) { GtkAction *action; + EphyLocationActionPrivate *priv; + action = gtk_activatable_get_related_action (GTK_ACTIVATABLE (proxy)); - if (!EPHY_LOCATION_ACTION (action)->priv->sync_address_is_blocked) + priv = EPHY_LOCATION_ACTION (action)->priv; + if (!priv->sync_address_is_blocked) { - EPHY_LOCATION_ACTION (action)->priv->sync_address_is_blocked = TRUE; + priv->sync_address_is_blocked = TRUE; g_signal_handlers_block_by_func (action, G_CALLBACK (sync_address), proxy); } @@ -413,11 +419,14 @@ focus_out_event_cb (GtkWidget *entry, GtkWidget *proxy) { GtkAction *action; + EphyLocationActionPrivate *priv; + action = gtk_activatable_get_related_action (GTK_ACTIVATABLE (proxy)); + priv = EPHY_LOCATION_ACTION (action)->priv; - if (EPHY_LOCATION_ACTION (action)->priv->sync_address_is_blocked) + if (priv->sync_address_is_blocked) { - EPHY_LOCATION_ACTION (action)->priv->sync_address_is_blocked = FALSE; + priv->sync_address_is_blocked = FALSE; g_signal_handlers_unblock_by_func (action, G_CALLBACK (sync_address), proxy); } @@ -425,6 +434,23 @@ focus_out_event_cb (GtkWidget *entry, } static void +switch_page_cb (GtkNotebook *notebook, + GtkNotebookPage *page, + guint page_num, + GtkAction *action) +{ + EphyLocationActionPrivate *priv; + + priv = EPHY_LOCATION_ACTION (action)->priv; + + if (priv->sync_address_is_blocked == TRUE) + { + priv->sync_address_is_blocked = FALSE; + g_signal_handlers_unblock_by_func (action, G_CALLBACK (sync_address), priv->proxy); + } +} + +static void connect_proxy (GtkAction *action, GtkWidget *proxy) { if (EPHY_IS_LOCATION_ENTRY (proxy)) @@ -432,6 +458,16 @@ connect_proxy (GtkAction *action, GtkWidget *proxy) EphyLocationEntry *lentry = EPHY_LOCATION_ENTRY (proxy); EphyCompletionModel *model; GtkWidget *entry; + GtkWidget *notebook; + EphyLocationActionPrivate *priv; + + priv = EPHY_LOCATION_ACTION (action)->priv; + priv->proxy = proxy; + + notebook = ephy_window_get_notebook (priv->window); + + g_signal_connect (notebook, "switch-page", + G_CALLBACK (switch_page_cb), action); model = ephy_completion_model_new (); ephy_location_entry_set_completion (EPHY_LOCATION_ENTRY (proxy), @@ -504,6 +540,10 @@ disconnect_proxy (GtkAction *action, GtkWidget *proxy) { EphyLocationEntry *lentry = EPHY_LOCATION_ENTRY (proxy); GtkWidget *entry; + EphyLocationActionPrivate *priv; + + priv = EPHY_LOCATION_ACTION (action)->priv; + priv->proxy = NULL; entry = ephy_location_entry_get_entry (lentry); |