diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ephy-link.c | 2 | ||||
-rw-r--r-- | src/ephy-tab.c | 24 | ||||
-rw-r--r-- | src/ephy-window.c | 15 |
3 files changed, 33 insertions, 8 deletions
diff --git a/src/ephy-link.c b/src/ephy-link.c index 06c58afff..e48758e8c 100644 --- a/src/ephy-link.c +++ b/src/ephy-link.c @@ -45,7 +45,7 @@ ephy_link_base_init (gpointer g_class) signals[OPEN_LINK] = g_signal_new
("open-link",
EPHY_TYPE_LINK,
- G_SIGNAL_RUN_FIRST | G_SIGNAL_RUN_LAST,
+ G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (EphyLinkIface, open_link),
ephy_signal_accumulator_object, ephy_tab_get_type,
ephy_marshal_OBJECT__STRING_OBJECT_FLAGS,
diff --git a/src/ephy-tab.c b/src/ephy-tab.c index f7dfe6cad..09debb6f1 100644 --- a/src/ephy-tab.c +++ b/src/ephy-tab.c @@ -42,6 +42,7 @@ #include "ephy-embed-single.h" #include "ephy-shell.h" #include "ephy-permission-manager.h" +#include "ephy-link.h" #include <glib/gi18n.h> #include <libgnomevfs/gnome-vfs-uri.h> @@ -162,10 +163,21 @@ ephy_tab_get_type (void) 0, /* n_preallocs */ (GInstanceInitFunc) ephy_tab_init }; + static const GInterfaceInfo link_info = + { + NULL, + NULL, + NULL + }; + type = g_type_register_static (GTK_TYPE_BIN, "EphyTab", &our_info, 0); + + g_type_add_interface_static (type, + EPHY_TYPE_LINK, + &link_info); } return type; @@ -1402,6 +1414,7 @@ ephy_tab_size_to_cb (EphyEmbed *embed, gint width, gint height, } } + static gboolean open_link_in_new_tab (EphyTab *tab, const char *link_address) @@ -1416,13 +1429,11 @@ open_link_in_new_tab (EphyTab *tab, if (new_tab) { - ephy_shell_new_tab (ephy_shell, window, tab, - link_address, - EPHY_NEW_TAB_OPEN_PAGE | - EPHY_NEW_TAB_IN_EXISTING_WINDOW); + return ephy_link_open (EPHY_LINK (tab), link_address, + tab, EPHY_LINK_NEW_TAB) != NULL; } - return new_tab; + return FALSE; } static void @@ -1459,8 +1470,9 @@ clipboard_text_received_cb (GtkClipboard *clipboard, if (*weak_ptr != NULL && text != NULL) { EphyEmbed *embed = (EphyEmbed *) *weak_ptr; + EphyTab *tab = ephy_tab_for_embed (embed); - ephy_embed_load_url (embed, text); + ephy_link_open (EPHY_LINK (tab), text, tab, 0); } if (*weak_ptr != NULL) diff --git a/src/ephy-window.c b/src/ephy-window.c index 77953976c..cd0f4f7f6 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -1979,12 +1979,16 @@ static gboolean modal_alert_cb (EphyEmbed *embed, EphyWindow *window) { + EphyWindowPrivate *priv = window->priv; EphyTab *tab; char *address; tab = ephy_tab_for_embed (embed); g_return_val_if_fail (tab != NULL, FALSE); + /* if we're in ppv mode, we cannot switch tabs, so inhibit the alert */ + if (priv->ppv_mode) return TRUE; + /* switch the window to the tab, and bring the window to the foreground * (since the alert is modal, the user won't be able to do anything * with his current window anyway :|) @@ -1994,7 +1998,7 @@ modal_alert_cb (EphyEmbed *embed, /* make sure the location entry shows the real URL of the tab's page */ address = ephy_embed_get_location (embed, TRUE); - ephy_toolbar_set_location (window->priv->toolbar, address); + ephy_toolbar_set_location (priv->toolbar, address); g_free (address); /* don't suppress alert */ @@ -2080,6 +2084,9 @@ tab_added_cb (EphyNotebook *notebook, g_signal_connect_object (G_OBJECT (tab), "notify::visibility", G_CALLBACK (sync_tab_visibility), window, 0); + g_signal_connect_object (G_OBJECT (tab), "open-link", + G_CALLBACK (ephy_link_open), window, + G_CONNECT_SWAPPED); embed = ephy_tab_get_embed (tab); g_return_if_fail (embed != NULL); @@ -2108,6 +2115,9 @@ tab_removed_cb (EphyNotebook *notebook, g_signal_handlers_disconnect_by_func (G_OBJECT (tab), G_CALLBACK (sync_tab_visibility), + window); + g_signal_handlers_disconnect_by_func (G_OBJECT (tab), + G_CALLBACK (ephy_link_open), window); window->priv->num_tabs--; @@ -2525,6 +2535,9 @@ ephy_window_open_link (EphyLink *link, g_return_val_if_fail (address != NULL, NULL); + /* don't do anything in ppv mode */ + if (window->priv->ppv_mode) return NULL; + if (tab == NULL) { tab = ephy_window_get_active_tab (window); |