From a1af750fa1343236fd81ea9c1b6962e8ebabd4af Mon Sep 17 00:00:00 2001 From: Xan Lopez Date: Sun, 14 Jun 2009 01:04:41 +0300 Subject: Get rid of redundant 'load-progress' property in EphyWebView. We now use WebKitWebView's 'progress' property directly. The "opening about:blank blinks the entry" bug is back because for some reason a) webkit reports a 10% progress for that URL b) get_uri reports NULL until 100% is loaded for only that page, so blacklisting by URI is not possible either. --- embed/ephy-web-view.c | 77 --------------------------------------------------- 1 file changed, 77 deletions(-) (limited to 'embed/ephy-web-view.c') diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c index 4944e5ab8..bde2e017e 100644 --- a/embed/ephy-web-view.c +++ b/embed/ephy-web-view.c @@ -69,7 +69,6 @@ struct _EphyWebViewPrivate { char *title; int cur_requests; int total_requests; - gint8 load_percent; char *loading_title; char *status_message; char *link_message; @@ -100,7 +99,6 @@ enum { PROP_ICON, PROP_ICON_ADDRESS, PROP_LINK_MESSAGE, - PROP_LOAD_PROGRESS, PROP_LOAD_STATUS, PROP_NAVIGATION, PROP_POPUPS_ALLOWED, @@ -411,9 +409,6 @@ ephy_web_view_get_property (GObject *object, case PROP_LINK_MESSAGE: g_value_set_string (value, priv->link_message); break; - case PROP_LOAD_PROGRESS: - g_value_set_int (value, priv->load_percent); - break; case PROP_NAVIGATION: g_value_set_flags (value, priv->nav_flags); break; @@ -458,7 +453,6 @@ ephy_web_view_set_property (GObject *object, case PROP_HIDDEN_POPUP_COUNT: case PROP_ICON: case PROP_LINK_MESSAGE: - case PROP_LOAD_PROGRESS: case PROP_LOAD_STATUS: case PROP_NAVIGATION: case PROP_SECURITY: @@ -574,15 +568,6 @@ ephy_web_view_class_init (EphyWebViewClass *klass) EPHY_WEB_VIEW_DOCUMENT_HTML, G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); - g_object_class_install_property (gobject_class, - PROP_LOAD_PROGRESS, - g_param_spec_int ("load-progress", - "Load progress", - "The view's load progress in percent", - 0, - 100, - 0, - G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property (gobject_class, PROP_LOAD_STATUS, g_param_spec_boolean ("load-status", @@ -1331,50 +1316,6 @@ update_navigation_flags (EphyWebView *view) } } -static int -build_load_percent (int requests_done, int requests_total) -{ - int percent = 0; - - if (requests_total > 0) { - percent = (requests_done * 100) / requests_total; - percent = CLAMP (percent, 0, 100); - } - - return percent; -} - -void -ephy_web_view_set_load_percent (EphyWebView *view, int percent) -{ - EphyWebViewPrivate *priv = view->priv; - - if (percent != priv->load_percent) { - priv->load_percent = percent; - - g_object_notify (G_OBJECT (view), "load-progress"); - } -} - -static void -build_progress_from_requests (EphyWebView *view, EphyWebViewNetState state) -{ - int load_percent; - - if (state & EPHY_WEB_VIEW_STATE_IS_REQUEST) { - if (state & EPHY_WEB_VIEW_STATE_START) { - view->priv->total_requests++; - } else if (state & EPHY_WEB_VIEW_STATE_STOP) { - view->priv->cur_requests++; - } - - load_percent = build_load_percent (view->priv->cur_requests, - view->priv->total_requests); - - ephy_web_view_set_load_percent (view, load_percent); - } -} - static void ephy_web_view_set_load_status (EphyWebView *view, gboolean status) { @@ -1408,7 +1349,6 @@ ephy_web_view_update_from_net_state (EphyWebView *view, priv->total_requests = 0; priv->cur_requests = 0; - ephy_web_view_set_load_percent (view, 0); ephy_web_view_set_load_status (view, TRUE); ensure_page_info (view, uri); @@ -1421,7 +1361,6 @@ ephy_web_view_update_from_net_state (EphyWebView *view, g_object_freeze_notify (object); - ephy_web_view_set_load_percent (view, 100); ephy_web_view_set_load_status (view, FALSE); g_free (priv->loading_title); @@ -1436,8 +1375,6 @@ ephy_web_view_update_from_net_state (EphyWebView *view, update_navigation_flags (view); } - - build_progress_from_requests (view, state); } void @@ -1760,20 +1697,6 @@ ephy_web_view_get_document_type (EphyWebView *view) return view->priv->document_type; } -/** - * ephy_web_view_get_load_percent: - * @view: an #EphyWebView - * - * Returns the page load percentage (displayed in the progressbar). - * - * Return value: a percentage from 0 to 100. - **/ -int -ephy_web_view_get_load_percent (EphyWebView *view) -{ - return view->priv->load_percent; -} - /** * ephy_web_view_get_navigation_flags: * @view: an #EphyWebView -- cgit