From 603a9503df75635a63a5dc42454a9a61bcc518c2 Mon Sep 17 00:00:00 2001 From: Xan Lopez Date: Wed, 7 Mar 2012 19:55:34 +0100 Subject: ephy-web-view: remember when we are loading the homepage And add a getter for the information. --- embed/ephy-web-view.c | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) (limited to 'embed/ephy-web-view.c') diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c index 6448b0e2d..404b6167a 100644 --- a/embed/ephy-web-view.c +++ b/embed/ephy-web-view.c @@ -79,6 +79,7 @@ struct _EphyWebViewPrivate { /* Flags */ guint is_blank : 1; guint visibility : 1; + guint loading_homepage : 1; char *address; char *typed_address; @@ -1136,6 +1137,12 @@ ephy_web_view_constructed (GObject *object) webkit_web_view_set_full_content_zoom (WEBKIT_WEB_VIEW (object), TRUE); } +static void +impl_loading_homepage (EphyWebView *view) +{ + view->priv->loading_homepage = TRUE; +} + static void ephy_web_view_class_init (EphyWebViewClass *klass) { @@ -1151,6 +1158,8 @@ ephy_web_view_class_init (EphyWebViewClass *klass) widget_class->button_press_event = ephy_web_view_button_press_event; widget_class->key_press_event = ephy_web_view_key_press_event; + klass->loading_homepage = impl_loading_homepage; + /** * EphyWebView:address: * @@ -1502,12 +1511,13 @@ ephy_web_view_class_init (EphyWebViewClass *klass) * load the homepage set by the user. **/ g_signal_new ("loading-homepage", - EPHY_TYPE_WEB_VIEW, - G_SIGNAL_RUN_FIRST, - 0, NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, - 0); + EPHY_TYPE_WEB_VIEW, + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (EphyWebViewClass, loading_homepage), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, + 0); g_type_class_add_private (gobject_class, sizeof (EphyWebViewPrivate)); } @@ -1895,6 +1905,8 @@ load_status_cb (WebKitWebView *web_view, case WEBKIT_LOAD_FINISHED: { SoupURI *uri; + priv->loading_homepage = FALSE; + g_free (priv->status_message); priv->status_message = NULL; g_object_notify (object, "status-message"); @@ -3770,3 +3782,11 @@ ephy_web_view_get_snapshot (EphyWebView *view, int x, int y, int width, int heig return snapshot; } + +gboolean +ephy_web_view_is_loading_homepage (EphyWebView *view) +{ + g_return_val_if_fail (EPHY_IS_WEB_VIEW (view), FALSE); + + return view->priv->loading_homepage; +} -- cgit