From 420f2f02c59a71e416c53237c7ecf2e4f0b45a14 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Thu, 30 Jul 2009 23:38:14 +0200 Subject: [PATCH] Copy the back forward history when opening a new tab --- midori/midori-browser.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/midori/midori-browser.c b/midori/midori-browser.c index 8abfe476..7ea43290 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -1089,6 +1089,32 @@ midori_view_attach_inspector_cb (GtkWidget* view, browser->inspector_view = inspector_view; } +static void +midori_browser_view_copy_history (GtkWidget* view_to, + GtkWidget* view_from) +{ + WebKitWebView* copy_from; + WebKitWebBackForwardList* list_from; + WebKitWebView* copy_to; + WebKitWebBackForwardList* list_to; + guint length_from; + guint i; + + copy_from = WEBKIT_WEB_VIEW (gtk_bin_get_child (GTK_BIN (view_from))); + list_from = webkit_web_view_get_back_forward_list (copy_from); + copy_to = WEBKIT_WEB_VIEW (gtk_bin_get_child (GTK_BIN (view_to))); + list_to = webkit_web_view_get_back_forward_list (copy_to); + length_from = webkit_web_back_forward_list_get_back_length (list_from); + + g_return_if_fail (!webkit_web_back_forward_list_get_back_length (list_to)); + + for (i = -length_from; i <= 0; i++) + { + webkit_web_back_forward_list_add_item (list_to, + webkit_web_back_forward_list_get_nth_item (list_from, i)); + } +} + static void midori_view_new_tab_cb (GtkWidget* view, const gchar* uri, @@ -1096,6 +1122,9 @@ midori_view_new_tab_cb (GtkWidget* view, MidoriBrowser* browser) { gint n = midori_browser_add_uri (browser, uri); + midori_browser_view_copy_history (midori_browser_get_nth_tab (browser, n), + view); + if (!background) midori_browser_set_current_page (browser, n); } -- 2.39.5