[epiphany] Load back item when back is clicked with control held/middle clicked, for wk2
- From: Gustavo Noronha Silva <gns src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Load back item when back is clicked with control held/middle clicked, for wk2
- Date: Tue, 19 Mar 2013 12:48:19 +0000 (UTC)
commit 10f300b27a14c450c9a20b12c23f4e542942655c
Author: Gustavo Noronha Silva <gns gnome org>
Date: Fri Mar 15 23:58:09 2013 -0300
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
src/ephy-navigation-history-action.c | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/src/ephy-navigation-history-action.c b/src/ephy-navigation-history-action.c
index ce53df9..dec2290 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) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]