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 ++++++++++++++++++++++++++------ embed/ephy-web-view.h | 16 +++++++++++----- 2 files changed, 37 insertions(+), 11 deletions(-) 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; +} diff --git a/embed/ephy-web-view.h b/embed/ephy-web-view.h index 789d6cfa5..46336e75b 100644 --- a/embed/ephy-web-view.h +++ b/embed/ephy-web-view.h @@ -124,6 +124,8 @@ struct _EphyWebViewClass void (* new_document_now) (EphyWebView *view, const char *uri); + + void (* loading_homepage) (EphyWebView *view); }; GType ephy_web_view_get_type (void); @@ -190,11 +192,15 @@ void ephy_web_view_save (EphyWebView const char *uri); void ephy_web_view_load_homepage (EphyWebView *view); -char * -ephy_web_view_create_web_application (EphyWebView *view, const char *title, GdkPixbuf *icon); - -GdkPixbuf * -ephy_web_view_get_snapshot (EphyWebView *view, int x, int y, int width, int height); +char * ephy_web_view_create_web_application (EphyWebView *view, + const char *title, + GdkPixbuf *icon); +GdkPixbuf * ephy_web_view_get_snapshot (EphyWebView *view, + int x, + int y, + int width, + int height); +gboolean ephy_web_view_is_loading_homepage (EphyWebView *view); G_END_DECLS -- cgit v1.2.3