[epiphany] ephy-web-view: Add ephy_web_view_load_failed()



commit ccc2a6f6a9cfea8a06dd7b8968c3ad59597950e9
Author: Carlos Garcia Campos <cgarcia igalia com>
Date:   Thu Jun 21 17:17:18 2012 +0200

    ephy-web-view: Add ephy_web_view_load_failed()
    
    To check whether the load operation in the web view failed.

 doc/reference/epiphany-sections.txt |    1 +
 embed/ephy-web-view.c               |   18 ++++++++++++++++++
 embed/ephy-web-view.h               |    1 +
 3 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/doc/reference/epiphany-sections.txt b/doc/reference/epiphany-sections.txt
index 2a02e37..4ea6859 100644
--- a/doc/reference/epiphany-sections.txt
+++ b/doc/reference/epiphany-sections.txt
@@ -30,6 +30,7 @@ ephy_web_view_get_visibility
 ephy_web_view_go_up
 ephy_web_view_has_modified_forms
 ephy_web_view_is_loading
+ephy_web_view_load_failed
 ephy_web_view_load_request
 ephy_web_view_load_url
 ephy_web_view_location_changed
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index c0350a3..df290c8 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -83,6 +83,7 @@ struct _EphyWebViewPrivate {
   guint visibility : 1;
   guint loading_homepage : 1;
   guint is_setting_zoom : 1;
+  guint load_failed : 1;
 
   char *address;
   char *typed_address;
@@ -1943,6 +1944,7 @@ load_status_cb (WebKitWebView *web_view,
     WebKitWebDataSource *source;
     WebKitNetworkRequest *request;
 
+    priv->load_failed = FALSE;
     frame = webkit_web_view_get_main_frame (web_view);
 
     source = webkit_web_frame_get_provisional_data_source (frame);
@@ -2074,6 +2076,7 @@ load_status_cb (WebKitWebView *web_view,
     break;
   }
   case WEBKIT_LOAD_FAILED:
+    priv->load_failed = TRUE;
     ephy_web_view_set_link_message (view, NULL);
     ephy_web_view_set_loading_title (view, NULL, FALSE);
 
@@ -3160,6 +3163,21 @@ ephy_web_view_is_loading (EphyWebView *view)
 }
 
 /**
+ * ephy_web_view_load_failed:
+ * @view: an #EphyWebView
+ *
+ * Returns whether the web page in @view has failed to load.
+ *
+ * Return value: %TRUE if the page failed to load, %FALSE if it's loading
+ * or load finished successfully
+ **/
+gboolean
+ephy_web_view_load_failed (EphyWebView *view)
+{
+  return view->priv->load_failed;
+}
+
+/**
  * ephy_web_view_get_loading_title:
  * @view: an #EphyWebView
  *
diff --git a/embed/ephy-web-view.h b/embed/ephy-web-view.h
index 28203b2..398285a 100644
--- a/embed/ephy-web-view.h
+++ b/embed/ephy-web-view.h
@@ -137,6 +137,7 @@ void                       ephy_web_view_load_url                 (EphyWebView
 void                       ephy_web_view_copy_back_history        (EphyWebView               *source,
                                                                    EphyWebView               *dest);
 gboolean                   ephy_web_view_is_loading               (EphyWebView               *view);
+gboolean                   ephy_web_view_load_failed              (EphyWebView               *view);
 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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]