aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGustavo Noronha Silva <gns@gnome.org>2013-03-16 10:58:09 +0800
committerGustavo Noronha Silva <gns@gnome.org>2013-03-19 20:47:59 +0800
commit10f300b27a14c450c9a20b12c23f4e542942655c (patch)
tree628ad29531c841bb63b5e55638a39f2cea628f0f
parent62c163a3a9d84ea993d24cc0dbfd1324066f6e3c (diff)
downloadgsoc2013-epiphany-10f300b27a14c450c9a20b12c23f4e542942655c.tar
gsoc2013-epiphany-10f300b27a14c450c9a20b12c23f4e542942655c.tar.gz
gsoc2013-epiphany-10f300b27a14c450c9a20b12c23f4e542942655c.tar.bz2
gsoc2013-epiphany-10f300b27a14c450c9a20b12c23f4e542942655c.tar.lz
gsoc2013-epiphany-10f300b27a14c450c9a20b12c23f4e542942655c.tar.xz
gsoc2013-epiphany-10f300b27a14c450c9a20b12c23f4e542942655c.tar.zst
gsoc2013-epiphany-10f300b27a14c450c9a20b12c23f4e542942655c.zip
Load back item when back is clicked with control held/middle clicked, for wk2
In WebKit2 the back/forward list is not copiable, so that assumption doesn't hold, and the current code path fails. With this change we tell EphyShell to not copy the list and load the URL held by the back item of the existing WebView in the new WebView instead, for WebKit2. https://bugzilla.gnome.org/show_bug.cgi?id=695951
-rw-r--r--src/ephy-navigation-history-action.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/ephy-navigation-history-action.c b/src/ephy-navigation-history-action.c
index ce53df929..dec229011 100644
--- a/src/ephy-navigation-history-action.c
+++ b/src/ephy-navigation-history-action.c
@@ -106,6 +106,29 @@ action_activate (GtkAction *action)
if (history_action->priv->direction == EPHY_NAVIGATION_HISTORY_DIRECTION_BACK) {
if (ephy_gui_is_middle_click () ||
ephy_link_action_get_button (EPHY_LINK_ACTION (history_action)) == 2) {
+ /* FIXME: in WebKit2 the back/forward list is immutable, so we are not able to
+ * copy it. Ideally the webkit1 code path should also work for webkit2. */
+#ifdef HAVE_WEBKIT2
+ const char *back_uri;
+ WebKitBackForwardList *history;
+ WebKitBackForwardListItem *back_item;
+
+ history = webkit_web_view_get_back_forward_list (web_view);
+ back_item = webkit_back_forward_list_get_back_item (history);
+ back_uri = webkit_back_forward_list_item_get_original_uri (back_item);
+
+ embed = ephy_shell_new_tab (ephy_shell_get_default (),
+ EPHY_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (embed))),
+ NULL,
+ NULL,
+ EPHY_NEW_TAB_IN_EXISTING_WINDOW | EPHY_NEW_TAB_DONT_COPY_HISTORY);
+
+ web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
+ webkit_web_view_load_uri (web_view, back_uri);
+ gtk_widget_grab_focus (GTK_WIDGET (embed));
+ return;
+ }
+#else
embed = ephy_shell_new_tab (ephy_shell_get_default (),
EPHY_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (embed))),
embed,
@@ -113,6 +136,8 @@ action_activate (GtkAction *action)
EPHY_NEW_TAB_IN_EXISTING_WINDOW);
web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
}
+#endif
+
webkit_web_view_go_back (web_view);
gtk_widget_grab_focus (GTK_WIDGET (embed));
} else if (history_action->priv->direction == EPHY_NAVIGATION_HISTORY_DIRECTION_FORWARD) {