diff options
author | Xan Lopez <xan@gnome.org> | 2009-06-14 06:04:41 +0800 |
---|---|---|
committer | Xan Lopez <xan@gnome.org> | 2009-06-14 06:04:41 +0800 |
commit | a1af750fa1343236fd81ea9c1b6962e8ebabd4af (patch) | |
tree | 34076370c0e37249f164860e616995a9e2601ece | |
parent | 44e17944c010fd3e4aeb2b3eacd6ccc0be624df8 (diff) | |
download | gsoc2013-epiphany-a1af750fa1343236fd81ea9c1b6962e8ebabd4af.tar gsoc2013-epiphany-a1af750fa1343236fd81ea9c1b6962e8ebabd4af.tar.gz gsoc2013-epiphany-a1af750fa1343236fd81ea9c1b6962e8ebabd4af.tar.bz2 gsoc2013-epiphany-a1af750fa1343236fd81ea9c1b6962e8ebabd4af.tar.lz gsoc2013-epiphany-a1af750fa1343236fd81ea9c1b6962e8ebabd4af.tar.xz gsoc2013-epiphany-a1af750fa1343236fd81ea9c1b6962e8ebabd4af.tar.zst gsoc2013-epiphany-a1af750fa1343236fd81ea9c1b6962e8ebabd4af.zip |
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.
-rw-r--r-- | embed/ephy-embed.c | 6 | ||||
-rw-r--r-- | embed/ephy-web-view.c | 77 | ||||
-rw-r--r-- | embed/ephy-web-view.h | 3 | ||||
-rw-r--r-- | src/ephy-window.c | 14 |
4 files changed, 5 insertions, 95 deletions
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c index 9be89dd62..dbc4d1fee 100644 --- a/embed/ephy-embed.c +++ b/embed/ephy-embed.c @@ -254,15 +254,13 @@ load_started_cb (WebKitWebView *web_view, static void load_progress_changed_cb (WebKitWebView *web_view, - int progress, + GParamSpec *spec, EphyEmbed *embed) { EphyEmbed *wembed = EPHY_EMBED (embed); if (wembed->priv->load_state == EPHY_EMBED_LOAD_STARTED) wembed->priv->load_state = EPHY_EMBED_LOAD_LOADING; - - ephy_web_view_set_load_percent (EPHY_WEB_VIEW (web_view), progress); } static void @@ -767,7 +765,7 @@ ephy_embed_init (EphyEmbed *embed) "signal::load-committed", G_CALLBACK (load_committed_cb), embed, "signal::load-started", G_CALLBACK (load_started_cb), embed, "signal::load_finished", G_CALLBACK (load_finished_cb), embed, - "signal::load-progress-changed", G_CALLBACK (load_progress_changed_cb), embed, + "signal::notify::progress", G_CALLBACK (load_progress_changed_cb), embed, "signal::hovering-over-link", G_CALLBACK (hovering_over_link_cb), embed, "signal::mime-type-policy-decision-requested", G_CALLBACK (mime_type_policy_decision_requested_cb), embed, "signal::download-requested", G_CALLBACK (download_requested_cb), embed, 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: @@ -575,15 +569,6 @@ ephy_web_view_class_init (EphyWebViewClass *klass) 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", "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 @@ -1761,20 +1698,6 @@ ephy_web_view_get_document_type (EphyWebView *view) } /** - * 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 * diff --git a/embed/ephy-web-view.h b/embed/ephy-web-view.h index ed8b7a4dd..0a727a88d 100644 --- a/embed/ephy-web-view.h +++ b/embed/ephy-web-view.h @@ -181,7 +181,6 @@ gboolean ephy_web_view_get_load_status (EphyWebView const char * ephy_web_view_get_loading_title (EphyWebView *view); GdkPixbuf * ephy_web_view_get_icon (EphyWebView *view); EphyWebViewDocumentType ephy_web_view_get_document_type (EphyWebView *view); -int ephy_web_view_get_load_percent (EphyWebView *view); EphyWebViewNavigationFlags ephy_web_view_get_navigation_flags (EphyWebView *view); const char * ephy_web_view_get_status_message (EphyWebView *view); const char * ephy_web_view_get_link_message (EphyWebView *view); @@ -233,8 +232,6 @@ void ephy_web_view_update_from_net_state (EphyWebView EphyWebViewNetState state); void ephy_web_view_location_changed (EphyWebView *view, const char *location); -void ephy_web_view_set_load_percent (EphyWebView *view, - int percent); void ephy_web_view_set_loading_title (EphyWebView *view, const char *title, gboolean is_address); diff --git a/src/ephy-window.c b/src/ephy-window.c index c8b117303..f90b315a5 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -1606,7 +1606,7 @@ clear_progress_cb (EphyWindow *window) static void sync_tab_load_progress (EphyWebView *view, GParamSpec *pspec, EphyWindow *window) { - gdouble progress, previous_progress; + gdouble progress; gboolean loading; if (window->priv->closing) return; @@ -1617,17 +1617,9 @@ sync_tab_load_progress (EphyWebView *view, GParamSpec *pspec, EphyWindow *window window->priv->clear_progress_timeout_id = 0; } - progress = ephy_web_view_get_load_percent (view)/100.0; + progress = webkit_web_view_get_progress (WEBKIT_WEB_VIEW (view))/100.0; loading = ephy_web_view_get_load_status (view); - /* Do not show a 'blink' progress from pages that go from 0 to 100, - * for example about:blank. */ - /* This might be refined by actually checking that the transition - * from 0 to 100 indeed took almost no time at all */ - previous_progress = gtk_entry_get_progress_fraction (GTK_ENTRY (window->priv->entry)); - if (previous_progress == 0.0 && progress == 1.0) - return; - if (progress == 1.0 && loading) { window->priv->clear_progress_timeout_id = @@ -2848,7 +2840,7 @@ ephy_window_set_active_tab (EphyWindow *window, EphyEmbed *new_embed) g_signal_connect_object (view, "ge-context-menu", G_CALLBACK (tab_context_menu_cb), window, G_CONNECT_AFTER); - g_signal_connect_object (view, "notify::load-progress", + g_signal_connect_object (view, "notify::progress", G_CALLBACK (sync_tab_load_progress), window, 0); g_signal_connect_object (view, "ge_dom_mouse_click", |