diff options
author | Cosimo Cecchi <cosimoc@src.gnome.org> | 2008-01-11 04:40:35 +0800 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@src.gnome.org> | 2008-01-11 04:40:35 +0800 |
commit | f7d3936f5ec8297531b32d973a39750ed182809b (patch) | |
tree | f330ecdf7b34b06612d73c890aeba9c682b43b3b /src/ephy-shell.c | |
parent | 00a6ae4ccf4be271165755d6866211c708cc09f7 (diff) | |
download | gsoc2013-epiphany-f7d3936f5ec8297531b32d973a39750ed182809b.tar.gz gsoc2013-epiphany-f7d3936f5ec8297531b32d973a39750ed182809b.tar.zst gsoc2013-epiphany-f7d3936f5ec8297531b32d973a39750ed182809b.zip |
Open externally opened link in current tab if it is blank.
Fix bug #499613.
svn path=/trunk/; revision=7856
Diffstat (limited to 'src/ephy-shell.c')
-rw-r--r-- | src/ephy-shell.c | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/src/ephy-shell.c b/src/ephy-shell.c index afbfa8d8c..22fd81e14 100644 --- a/src/ephy-shell.c +++ b/src/ephy-shell.c @@ -450,7 +450,7 @@ load_homepage (EphyEmbed *embed) EphyEmbed * ephy_shell_new_tab_full (EphyShell *shell, EphyWindow *parent_window, - EphyEmbed *previous_tab, + EphyEmbed *previous_embed, const char *url, EphyNewTabFlags flags, EphyEmbedChrome chrome, @@ -458,10 +458,10 @@ ephy_shell_new_tab_full (EphyShell *shell, guint32 user_time) { EphyWindow *window; - EphyEmbed *embed; + EphyEmbed *embed = NULL; gboolean in_new_window = TRUE; gboolean jump_to; - EphyEmbed *previous_embed = NULL; + gboolean active_is_blank = FALSE; GtkWidget *nb; int position = -1; gboolean is_empty = FALSE; @@ -489,28 +489,43 @@ ephy_shell_new_tab_full (EphyShell *shell, toolbar = EPHY_TOOLBAR (ephy_window_get_toolbar (window)); - if ((flags & EPHY_NEW_TAB_APPEND_AFTER) && previous_tab != NULL) + if ((flags & EPHY_NEW_TAB_APPEND_AFTER) && previous_embed != NULL) { nb = ephy_window_get_notebook (window); /* FIXME this assumes the tab is the direct notebook child */ position = gtk_notebook_page_num (GTK_NOTEBOOK (nb), GTK_WIDGET (previous_embed)) + 1; } - - embed = EPHY_EMBED (ephy_embed_factory_new_object (EPHY_TYPE_EMBED)); - g_assert (embed != NULL); - gtk_widget_show (GTK_WIDGET (embed)); - - ephy_embed_container_add_child (EPHY_EMBED_CONTAINER (window), embed, position, jump_to); + + if (flags & EPHY_NEW_TAB_FROM_EXTERNAL) + { + /* If the active embed is blank, use that to open the url and jump to it */ + embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window)); + if (embed != NULL) + { + if (ephy_embed_get_is_blank (embed)) + { + active_is_blank = TRUE; + } + } + } + if (active_is_blank == FALSE) + { + embed = EPHY_EMBED (ephy_embed_factory_new_object (EPHY_TYPE_EMBED)); + g_assert (embed != NULL); + gtk_widget_show (GTK_WIDGET (embed)); + + ephy_embed_container_add_child (EPHY_EMBED_CONTAINER (window), embed, position, jump_to); + } if (previous_embed != NULL) - { + { ephy_embed_shistory_copy (previous_embed, embed, TRUE, /* back history */ TRUE, /* forward history */ FALSE); /* current index */ - } + } ephy_gui_window_update_user_time (GTK_WIDGET (window), user_time); |