diff options
Diffstat (limited to 'embed')
-rw-r--r-- | embed/ephy-embed.c | 22 | ||||
-rw-r--r-- | embed/ephy-embed.h | 11 | ||||
-rw-r--r-- | embed/ephy-web-view.c | 46 | ||||
-rw-r--r-- | embed/ephy-web-view.h | 3 | ||||
-rw-r--r-- | embed/webkit/webkit-embed.c | 41 |
5 files changed, 49 insertions, 74 deletions
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c index 9243075fe..b52d0107e 100644 --- a/embed/ephy-embed.c +++ b/embed/ephy-embed.c @@ -501,28 +501,6 @@ ephy_embed_get_js_status (EphyEmbed *embed) } /** - * ephy_embed_shistory_copy: - * @source: the #EphyEmbed to copy the history from - * @dest: the #EphyEmbed to copy the history to - * @copy_back: %TRUE to copy the back history - * @copy_forward: %TRUE to copy the forward history - * @copy_current: %TRUE to set the current page to that in the copied history - * - * Copy's the back and/or forward history from @source to @dest, - * and optionally set @dest to the current page of @source as well. - **/ -void -ephy_embed_shistory_copy (EphyEmbed *source, - EphyEmbed *dest, - gboolean copy_back, - gboolean copy_forward, - gboolean copy_current) -{ - EphyEmbedIface *iface = EPHY_EMBED_GET_IFACE (source); - iface->shistory_copy (source, dest, copy_back, copy_forward, copy_current); -} - -/** * ephy_embed_get_security_level: * @embed: an #EphyEmbed * @level: return value of security level diff --git a/embed/ephy-embed.h b/embed/ephy-embed.h index 8809bf6f5..814eda3a3 100644 --- a/embed/ephy-embed.h +++ b/embed/ephy-embed.h @@ -167,11 +167,6 @@ struct _EphyEmbedIface gboolean toplevel); const char * (* get_link_message) (EphyEmbed *embed); char * (* get_js_status) (EphyEmbed *embed); - void (* shistory_copy) (EphyEmbed *source, - EphyEmbed *dest, - gboolean copy_back, - gboolean copy_forward, - gboolean copy_current); void (* get_security_level) (EphyEmbed *embed, EphyEmbedSecurityLevel *level, char **description); @@ -232,12 +227,6 @@ GSList *ephy_embed_get_go_up_list (EphyEmbed *embed); void ephy_embed_go_up (EphyEmbed *embed); -void ephy_embed_shistory_copy (EphyEmbed *source, - EphyEmbed *dest, - gboolean copy_back, - gboolean copy_forward, - gboolean copy_current); - void ephy_embed_get_security_level (EphyEmbed *embed, EphyEmbedSecurityLevel *level, char **description); diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c index 1aade87ee..cb98dacc7 100644 --- a/embed/ephy-web-view.c +++ b/embed/ephy-web-view.c @@ -22,6 +22,7 @@ #include "ephy-web-view.h" #include "ephy-debug.h" +#include "ephy-embed-utils.h" #include <gtk/gtk.h> #include <webkit/webkit.h> @@ -74,3 +75,48 @@ ephy_web_view_load_request (EphyWebView *web_view, main_frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW(web_view)); webkit_web_frame_load_request(main_frame, request); } + +/** + * ephy_web_view_copy_back_history: + * @source: the #EphyWebView from which to get the back history + * @dest: the #EphyWebView to copy the history to + * + * Sets the back history (up to the current item) of @source as the + * back history of @dest. + * + * Useful to keep the history when opening links in new tabs or + * windows. + **/ +void +ephy_web_view_copy_back_history (EphyWebView *source, + EphyWebView *dest) +{ + WebKitWebView *source_view, *dest_view; + WebKitWebBackForwardList* source_bflist, *dest_bflist; + WebKitWebHistoryItem *item; + GList *items; + + g_return_if_fail(EPHY_IS_WEB_VIEW(source)); + g_return_if_fail(EPHY_IS_WEB_VIEW(dest)); + + source_view = WEBKIT_WEB_VIEW (source); + dest_view = WEBKIT_WEB_VIEW (dest); + + source_bflist = webkit_web_view_get_back_forward_list (source_view); + dest_bflist = webkit_web_view_get_back_forward_list (dest_view); + + items = webkit_web_back_forward_list_get_back_list_with_limit (source_bflist, EPHY_WEBKIT_BACK_FORWARD_LIMIT); + /* We want to add the items in the reverse order here, so the + history ends up the same */ + items = g_list_reverse (items); + for (; items; items = items->next) { + item = (WebKitWebHistoryItem*)items->data; + webkit_web_back_forward_list_add_item (dest_bflist, g_object_ref (item)); + } + g_list_free (items); + + /* The ephy/gecko behavior is to add the current item of the source + embed at the end of the back history, so keep doing that */ + item = webkit_web_back_forward_list_get_current_item (source_bflist); + webkit_web_back_forward_list_add_item (dest_bflist, g_object_ref (item)); +} diff --git a/embed/ephy-web-view.h b/embed/ephy-web-view.h index 9fc31355e..870b54c43 100644 --- a/embed/ephy-web-view.h +++ b/embed/ephy-web-view.h @@ -63,6 +63,9 @@ GtkWidget *ephy_web_view_new (void); void ephy_web_view_load_request (EphyWebView *web_view, WebKitNetworkRequest *request); +void ephy_web_view_copy_back_history (EphyWebView *source, + EphyWebView *dest); + G_END_DECLS #endif diff --git a/embed/webkit/webkit-embed.c b/embed/webkit/webkit-embed.c index 060b243c3..ddb69dc8b 100644 --- a/embed/webkit/webkit-embed.c +++ b/embed/webkit/webkit-embed.c @@ -830,46 +830,6 @@ impl_get_location (EphyEmbed *embed, } static void -impl_shistory_copy (EphyEmbed *source, - EphyEmbed *dest, - gboolean copy_back, - gboolean copy_forward, - gboolean copy_current) -{ - WebKitWebView *source_view, *dest_view; - WebKitWebBackForwardList* source_bflist, *dest_bflist; - WebKitWebHistoryItem *item; - GList *items; - - source_view = WEBKIT_EMBED (source)->priv->web_view; - dest_view = WEBKIT_EMBED (dest)->priv->web_view; - - source_bflist = webkit_web_view_get_back_forward_list (source_view); - dest_bflist = webkit_web_view_get_back_forward_list (dest_view); - - if (copy_back) { - items = webkit_web_back_forward_list_get_back_list_with_limit (source_bflist, EPHY_WEBKIT_BACK_FORWARD_LIMIT); - /* We want to add the items in the reverse order here, so the - history ends up the same */ - items = g_list_reverse (items); - for (; items; items = items->next) { - item = (WebKitWebHistoryItem*)items->data; - webkit_web_back_forward_list_add_item (dest_bflist, g_object_ref (item)); - } - g_list_free (items); - } - - /* The ephy/gecko behavior is to add the current item of the source - embed at the end of the back history, so keep doing that */ - item = webkit_web_back_forward_list_get_current_item (source_bflist); - webkit_web_back_forward_list_add_item (dest_bflist, g_object_ref (item)); - - /* We ignore the 'copy_current' flag, it's unused in Epiphany */ - /* We ignore the 'copy_forward' flag, ephy/gecko did nothing with it - either AFAICT*/ -} - -static void impl_get_security_level (EphyEmbed *embed, EphyEmbedSecurityLevel *level, char **description) @@ -925,7 +885,6 @@ ephy_embed_iface_init (EphyEmbedIface *iface) iface->go_up = impl_go_up; iface->get_location = impl_get_location; iface->get_js_status = impl_get_js_status; - iface->shistory_copy = impl_shistory_copy; iface->show_page_certificate = impl_show_page_certificate; iface->set_print_preview_mode = impl_set_print_preview_mode; iface->print_preview_n_pages = impl_print_preview_n_pages; |