diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ephy-shell.c | 4 | ||||
-rw-r--r-- | src/ephy-tab.c | 53 | ||||
-rw-r--r-- | src/ephy-window.c | 20 | ||||
-rw-r--r-- | src/popup-commands.c | 4 | ||||
-rwxr-xr-x | src/toolbar.c | 73 | ||||
-rw-r--r-- | src/toolbar.h | 2 |
6 files changed, 77 insertions, 79 deletions
diff --git a/src/ephy-shell.c b/src/ephy-shell.c index 5489222d6..7af15a0a3 100644 --- a/src/ephy-shell.c +++ b/src/ephy-shell.c @@ -402,9 +402,9 @@ ephy_shell_new_tab (EphyShell *shell, if (flags & EPHY_NEW_TAB_HOME_PAGE || flags & EPHY_NEW_TAB_NEW_PAGE) { - toolbar_edit_location (toolbar); - + ephy_tab_set_location (tab, "", TAB_ADDRESS_EXPIRE_NEXT); load_homepage (embed); + toolbar_activate_location (toolbar); } else if (flags & EPHY_NEW_TAB_OPEN_PAGE) { diff --git a/src/ephy-tab.c b/src/ephy-tab.c index 35226b583..2c34b0542 100644 --- a/src/ephy-tab.c +++ b/src/ephy-tab.c @@ -59,6 +59,7 @@ struct EphyTabPrivate int load_percent; gboolean visibility; gboolean load_status; + TabAddressExpire address_expire; int cur_requests; int total_requests; int width; @@ -152,7 +153,8 @@ ephy_tab_set_property (GObject *object, { case PROP_ADDRESS: - ephy_tab_set_location (tab, g_value_get_string (value)); + ephy_tab_set_location (tab, g_value_get_string (value), + TAB_ADDRESS_EXPIRE_NOW); break; case PROP_WINDOW: ephy_tab_set_window (tab, g_value_get_object (value)); @@ -421,7 +423,7 @@ ephy_tab_set_link_message (EphyTab *tab, const char *message) g_free (tab->priv->link_message); tab->priv->link_message = g_strdup (message); - + g_object_notify (G_OBJECT (tab), "message"); } @@ -450,7 +452,7 @@ ephy_tab_set_window (EphyTab *tab, EphyWindow *window) if (window != tab->priv->window) { tab->priv->window = window; - + g_object_notify (G_OBJECT (tab), "window"); } } @@ -562,11 +564,14 @@ ephy_tab_link_message_cb (EphyEmbed *embed, static void ephy_tab_address_cb (EphyEmbed *embed, EphyTab *tab) { - char *address; + if (tab->priv->address_expire == TAB_ADDRESS_EXPIRE_NOW) + { + char *address; - ephy_embed_get_location (embed, TRUE, &address); - ephy_tab_set_location (tab, address); - g_free (address); + ephy_embed_get_location (embed, TRUE, &address); + ephy_tab_set_location (tab, address, TAB_ADDRESS_EXPIRE_NOW); + g_free (address); + } ephy_tab_set_link_message (tab, NULL); ephy_tab_set_icon_address (tab, NULL); @@ -709,9 +714,10 @@ build_progress_from_requests (EphyTab *tab, EmbedState state) static void ensure_address (EphyTab *tab, const char *address) { - if (tab->priv->address == NULL) - { - ephy_tab_set_location (tab, address); + if (tab->priv->address == NULL && + tab->priv->address_expire == TAB_ADDRESS_EXPIRE_NOW) + { + ephy_tab_set_location (tab, address, TAB_ADDRESS_EXPIRE_NOW); } } @@ -744,7 +750,7 @@ ephy_tab_net_state_cb (EphyEmbed *embed, const char *uri, } else if (state & EMBED_STATE_STOP) { - /* tab load completed, save in session */ + /* tab load completed, save in session */ Session *s; s = ephy_shell_get_session (ephy_shell); session_save (s, SESSION_CRASHED); @@ -752,6 +758,7 @@ ephy_tab_net_state_cb (EphyEmbed *embed, const char *uri, ephy_tab_set_load_percent (tab, 0); ephy_tab_set_load_status (tab, FALSE); ephy_tab_update_navigation_flags (tab); + tab->priv->address_expire = TAB_ADDRESS_EXPIRE_NOW; } } @@ -921,7 +928,7 @@ ephy_tab_init (EphyTab *tab) char *id; LOG ("EphyTab initialising %p", tab) - + single = ephy_embed_shell_get_embed_single (EPHY_EMBED_SHELL (ephy_shell)); @@ -942,7 +949,8 @@ ephy_tab_init (EphyTab *tab) tab->priv->link_message = NULL; tab->priv->security_level = STATE_IS_UNKNOWN; tab->priv->status_message = NULL; - tab->priv->zoom = 1.0; + tab->priv->zoom = 1.0; + tab->priv->address_expire = TAB_ADDRESS_EXPIRE_NOW; tab->priv->embed = ephy_embed_new (G_OBJECT(single)); ephy_embed_shell_add_embed (EPHY_EMBED_SHELL (ephy_shell), @@ -1063,9 +1071,9 @@ ephy_tab_update_navigation_flags (EphyTab *tab) if (flags != tab->priv->nav_flags) { tab->priv->nav_flags = flags; - + g_object_notify (G_OBJECT (tab), "navigation"); - } + } } TabNavigationFlags @@ -1168,13 +1176,24 @@ ephy_tab_get_location (EphyTab *tab) void ephy_tab_set_location (EphyTab *tab, - const char *address) + const char *address, + TabAddressExpire expire) { g_return_if_fail (IS_EPHY_TAB (tab)); if (tab->priv->address) g_free (tab->priv->address); tab->priv->address = g_strdup (address); - + + if (expire == TAB_ADDRESS_EXPIRE_CURRENT && + !tab->priv->load_status) + { + tab->priv->address_expire = TAB_ADDRESS_EXPIRE_NOW; + } + else + { + tab->priv->address_expire = expire; + } + g_object_notify (G_OBJECT (tab), "address"); } diff --git a/src/ephy-window.c b/src/ephy-window.c index dc2b39983..1af5df479 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -1792,16 +1792,6 @@ ephy_window_get_tabs (EphyWindow *window) } static void -save_old_embed_status (EphyTab *tab, EphyWindow *window) -{ - char *location; - - location = toolbar_get_location (window->priv->toolbar); - ephy_tab_set_location (tab, location); - g_free (location); -} - -static void update_embed_dialogs (EphyWindow *window, EphyTab *tab) { @@ -1824,7 +1814,7 @@ ephy_window_notebook_switch_page_cb (GtkNotebook *notebook, guint page_num, EphyWindow *window) { - EphyTab *tab, *old_tab; + EphyTab *tab; g_return_if_fail (IS_EPHY_WINDOW (window)); if (window->priv->closing) return; @@ -1832,14 +1822,6 @@ ephy_window_notebook_switch_page_cb (GtkNotebook *notebook, /* get the new tab */ tab = real_get_active_tab (window, page_num); - /* update old tab */ - old_tab = window->priv->active_tab; - if (old_tab && tab != old_tab) - { - g_return_if_fail (IS_EPHY_TAB (G_OBJECT (old_tab))); - save_old_embed_status (old_tab, window); - } - /* update new tab */ ephy_window_set_active_tab (window, tab); diff --git a/src/popup-commands.c b/src/popup-commands.c index 490982351..1b2c4d68a 100644 --- a/src/popup-commands.c +++ b/src/popup-commands.c @@ -32,7 +32,8 @@ get_event_info (EphyWindow *window) { EphyEmbedEvent *info; - info = EPHY_EMBED_EVENT (g_object_get_data (window, "context_event")); + info = EPHY_EMBED_EVENT (g_object_get_data + (G_OBJECT (window), "context_event")); g_return_val_if_fail (info != NULL, NULL); return info; @@ -228,7 +229,6 @@ popup_cmd_copy_link_address (EggAction *action, EphyEmbedEvent *event; const char *address; const GValue *value; - EphyEmbed *embed; event = get_event_info (window); g_return_if_fail (IS_EPHY_EMBED_EVENT (event)); diff --git a/src/toolbar.c b/src/toolbar.c index 2896c7341..78c0d39f5 100755 --- a/src/toolbar.c +++ b/src/toolbar.c @@ -81,7 +81,6 @@ struct ToolbarPrivate EggMenuMerge *ui_merge; EggActionGroup *action_group; gboolean visibility; - GtkWidget *location_entry; GtkWidget *spinner; GtkWidget *favicon; GtkWidget *go; @@ -457,6 +456,34 @@ update_toolbar_remove_flag (EphyToolbarsModel *model, gpointer data) } } +static GtkWidget * +get_location_entry (Toolbar *t) +{ + EggAction *action; + GtkWidget *location; + + action = egg_action_group_get_action + (t->priv->action_group, "Location"); + location = ephy_location_action_get_widget + (EPHY_LOCATION_ACTION (action)); + + return location; +} + +static void +location_user_changed_cb (GtkWidget *entry, EphyWindow *window) +{ + EphyTab *tab; + char *address; + + tab = ephy_window_get_active_tab (window); + g_return_if_fail (IS_EPHY_TAB (tab)); + + address = ephy_location_entry_get_location (EPHY_LOCATION_ENTRY (entry)); + ephy_tab_set_location (tab, address, TAB_ADDRESS_EXPIRE_CURRENT); + g_free (address); +} + static void toolbar_set_window (Toolbar *t, EphyWindow *window) { @@ -487,6 +514,10 @@ toolbar_set_window (Toolbar *t, EphyWindow *window) "MenuMerge", t->priv->ui_merge, NULL); init_bookmarks_toolbar (t); + + g_signal_connect_object (get_location_entry (t), "user_changed", + G_CALLBACK (location_user_changed_cb), + window, 0); } static void @@ -539,22 +570,6 @@ toolbar_new (EphyWindow *window) return t; } -void -toolbar_edit_location (Toolbar *t) -{ - EggAction *action; - GtkWidget *location; - - action = egg_action_group_get_action - (t->priv->action_group, "Location"); - location = ephy_location_action_get_widget - (EPHY_LOCATION_ACTION (action)); - g_return_if_fail (location != NULL); - - ephy_location_entry_edit - (EPHY_LOCATION_ENTRY(location)); -} - static void location_finished_cb (GtkWidget *location, GtkWidget *toolbar) { @@ -568,14 +583,10 @@ location_finished_cb (GtkWidget *location, GtkWidget *toolbar) void toolbar_activate_location (Toolbar *t) { - EggAction *action; GtkWidget *location; GtkWidget *location_tb; - action = egg_action_group_get_action - (t->priv->action_group, "Location"); - location = ephy_location_action_get_widget - (EPHY_LOCATION_ACTION (action)); + location = get_location_entry (t); g_return_if_fail (location != NULL); location_tb = gtk_widget_get_ancestor (location, EGG_TYPE_TOOLBAR); @@ -618,13 +629,9 @@ void toolbar_set_location (Toolbar *t, const char *alocation) { - EggAction *action; GtkWidget *location; - action = egg_action_group_get_action - (t->priv->action_group, "Location"); - location = ephy_location_action_get_widget - (EPHY_LOCATION_ACTION (action)); + location = get_location_entry (t); g_return_if_fail (location != NULL); ephy_location_entry_set_location @@ -650,13 +657,9 @@ toolbar_update_favicon (Toolbar *t) char * toolbar_get_location (Toolbar *t) { - EggAction *action; GtkWidget *location; - action = egg_action_group_get_action - (t->priv->action_group, "Location"); - location = ephy_location_action_get_widget - (EPHY_LOCATION_ACTION (action)); + location = get_location_entry (t); g_return_val_if_fail (location != NULL, NULL); return ephy_location_entry_get_location @@ -666,13 +669,9 @@ toolbar_get_location (Toolbar *t) void toolbar_clear_location_history (Toolbar *t) { - EggAction *action; GtkWidget *location; - action = egg_action_group_get_action - (t->priv->action_group, "Location"); - location = ephy_location_action_get_widget - (EPHY_LOCATION_ACTION (action)); + location = get_location_entry (t), g_return_if_fail (location != NULL); ephy_location_entry_clear_history (EPHY_LOCATION_ENTRY (location)); diff --git a/src/toolbar.h b/src/toolbar.h index e21d12d3c..0f1dabb4c 100644 --- a/src/toolbar.h +++ b/src/toolbar.h @@ -61,8 +61,6 @@ char *toolbar_get_location (Toolbar *t); void toolbar_set_location (Toolbar *t, const char *location); -void toolbar_edit_location (Toolbar *t); - void toolbar_activate_location (Toolbar *t); void toolbar_clear_location_history (Toolbar *t); |