diff options
author | Xan Lopez <xan@igalia.com> | 2012-03-15 16:34:23 +0800 |
---|---|---|
committer | Xan Lopez <xan@igalia.com> | 2012-03-15 16:34:23 +0800 |
commit | 00276359e926f4f1fba732534a0b47bec88371f5 (patch) | |
tree | 22a62c515b839fc4d56add2fd2b14e673320efc3 /embed/ephy-web-view.c | |
parent | d72eec43e48839540e349ce8986b300c34005414 (diff) | |
download | gsoc2013-epiphany-00276359e926f4f1fba732534a0b47bec88371f5.tar.gz gsoc2013-epiphany-00276359e926f4f1fba732534a0b47bec88371f5.tar.zst gsoc2013-epiphany-00276359e926f4f1fba732534a0b47bec88371f5.zip |
ephy-web-view: make ephy_web_view_clear_history private
It's only used by the class itself now.
Diffstat (limited to 'embed/ephy-web-view.c')
-rw-r--r-- | embed/ephy-web-view.c | 100 |
1 files changed, 47 insertions, 53 deletions
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c index c0b59db59..d7aeb61dc 100644 --- a/embed/ephy-web-view.c +++ b/embed/ephy-web-view.c @@ -1045,6 +1045,53 @@ _ephy_web_view_hook_into_links (EphyWebView *web_view) } static void +update_navigation_flags (EphyWebView *view) +{ + EphyWebViewPrivate *priv = view->priv; + guint flags = 0; + WebKitWebView *web_view = WEBKIT_WEB_VIEW (view); + + if (ephy_web_view_can_go_up (view)) + flags |= EPHY_WEB_VIEW_NAV_UP; + + if (webkit_web_view_can_go_back (web_view)) + flags |= EPHY_WEB_VIEW_NAV_BACK; + + if (webkit_web_view_can_go_forward (web_view)) + flags |= EPHY_WEB_VIEW_NAV_FORWARD; + + if (priv->nav_flags != (EphyWebViewNavigationFlags)flags) { + priv->nav_flags = (EphyWebViewNavigationFlags)flags; + + g_object_notify (G_OBJECT (view), "navigation"); + } +} + +static void +ephy_web_view_clear_history (EphyWebView *view) +{ + WebKitWebBackForwardList *history_list; + + g_return_if_fail (EPHY_IS_WEB_VIEW (view)); + + history_list = webkit_web_view_get_back_forward_list (WEBKIT_WEB_VIEW (view)); + if (history_list != NULL) { + WebKitWebHistoryItem *current_item; + + /* Save a ref to the first element to add it later */ + current_item = webkit_web_back_forward_list_get_current_item (history_list); + g_object_ref (current_item); + + /* Clear the history and add the first element once again */ + webkit_web_back_forward_list_clear (history_list); + webkit_web_back_forward_list_add_item (history_list, current_item); + g_object_unref (current_item); + + update_navigation_flags (view); + } +} + +static void ephy_web_view_history_cleared_cb (EphyHistoryService *history_service, EphyWebView *view) { @@ -1807,29 +1854,6 @@ geolocation_policy_decision_requested_cb (WebKitWebView *web_view, return TRUE; } -static void -update_navigation_flags (EphyWebView *view) -{ - EphyWebViewPrivate *priv = view->priv; - guint flags = 0; - WebKitWebView *web_view = WEBKIT_WEB_VIEW (view); - - if (ephy_web_view_can_go_up (view)) - flags |= EPHY_WEB_VIEW_NAV_UP; - - if (webkit_web_view_can_go_back (web_view)) - flags |= EPHY_WEB_VIEW_NAV_BACK; - - if (webkit_web_view_can_go_forward (web_view)) - flags |= EPHY_WEB_VIEW_NAV_FORWARD; - - if (priv->nav_flags != (EphyWebViewNavigationFlags)flags) { - priv->nav_flags = (EphyWebViewNavigationFlags)flags; - - g_object_notify (G_OBJECT (view), "navigation"); - } -} - static gboolean delete_web_app_cb (WebKitDOMHTMLElement *button, WebKitDOMEvent *dom_event, @@ -2625,36 +2649,6 @@ ephy_web_view_copy_back_history (EphyWebView *source, } /** - * ephy_web_view_clear_history: - * @view: the #EphyWebView to clear the history from - * - * Clears history of @view. - **/ -void -ephy_web_view_clear_history (EphyWebView *view) -{ - WebKitWebBackForwardList *history_list; - - g_return_if_fail (EPHY_IS_WEB_VIEW (view)); - - history_list = webkit_web_view_get_back_forward_list (WEBKIT_WEB_VIEW (view)); - if (history_list != NULL) { - WebKitWebHistoryItem *current_item; - - /* Save a ref to the first element to add it later */ - current_item = webkit_web_back_forward_list_get_current_item (history_list); - g_object_ref (current_item); - - /* Clear the history and add the first element once again */ - webkit_web_back_forward_list_clear (history_list); - webkit_web_back_forward_list_add_item (history_list, current_item); - g_object_unref (current_item); - - update_navigation_flags (view); - } -} - -/** * ephy_web_view_set_is_blank: * @view: an #EphyWebView * @is_blank: if @view is the blank page |