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 | |
parent | 00a6ae4ccf4be271165755d6866211c708cc09f7 (diff) | |
download | gsoc2013-epiphany-f7d3936f5ec8297531b32d973a39750ed182809b.tar gsoc2013-epiphany-f7d3936f5ec8297531b32d973a39750ed182809b.tar.gz gsoc2013-epiphany-f7d3936f5ec8297531b32d973a39750ed182809b.tar.bz2 gsoc2013-epiphany-f7d3936f5ec8297531b32d973a39750ed182809b.tar.lz gsoc2013-epiphany-f7d3936f5ec8297531b32d973a39750ed182809b.tar.xz 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')
-rw-r--r-- | src/ephy-activation.c | 6 | ||||
-rw-r--r-- | src/ephy-main.c | 2 | ||||
-rw-r--r-- | src/ephy-session.c | 4 | ||||
-rw-r--r-- | src/ephy-shell.c | 39 | ||||
-rw-r--r-- | src/ephy-shell.h | 1 |
5 files changed, 38 insertions, 14 deletions
diff --git a/src/ephy-activation.c b/src/ephy-activation.c index f2346f0ca..efd54df8f 100644 --- a/src/ephy-activation.c +++ b/src/ephy-activation.c @@ -64,8 +64,12 @@ ephy_activation_load_uri_list (EphyDbus *ephy_dbus, guint startup_id, GError **error) { + char *new_options; + + new_options = g_strconcat (options, "external,", NULL); return session_queue_command (EPHY_SESSION_CMD_OPEN_URIS, - options, uris, startup_id, error); + new_options, uris, startup_id, error); + g_free (new_options); } gboolean diff --git a/src/ephy-main.c b/src/ephy-main.c index bf71e2156..ae473719b 100644 --- a/src/ephy-main.c +++ b/src/ephy-main.c @@ -369,7 +369,7 @@ queue_commands (guint32 user_time) } if (open_in_new_tab) { - g_string_append (options, "new-tab,"); + g_string_append (options, "new-tab,external,"); } ephy_session_queue_command (session, diff --git a/src/ephy-session.c b/src/ephy-session.c index 9ad5c271c..c1b79d25d 100644 --- a/src/ephy-session.c +++ b/src/ephy-session.c @@ -673,6 +673,10 @@ session_command_open_uris (EphySession *session, window = ephy_session_get_active_window (session); + if (options != NULL && strstr (options, "external") != NULL) + { + flags |= EPHY_NEW_TAB_FROM_EXTERNAL; + } if (options != NULL && strstr (options, "new-window") != NULL) { window = NULL; 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); diff --git a/src/ephy-shell.h b/src/ephy-shell.h index e29122506..f0ee6f060 100644 --- a/src/ephy-shell.h +++ b/src/ephy-shell.h @@ -65,6 +65,7 @@ typedef enum /* The way to load */ EPHY_NEW_TAB_ALLOW_FIXUP = 1 << 12, + EPHY_NEW_TAB_FROM_EXTERNAL = 1 << 13, } EphyNewTabFlags; |