commit 281aec72ee536612b4a6bddfc89604ed65cf6deb
Author: Alejandro G. Castro <alex@igalia.com>
Date:   Tue Feb 9 19:13:15 2010 +0100

    Removed the EphyWebViewNetState enum
    
    We can use the webkit load status (WebKitLoadStatus) and avoid
    defining our own enum to check the net states.
    
    Bug #593743

diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index c7e6ae5..b265b56 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -232,7 +232,6 @@ load_status_changed_cb (WebKitWebView *view,
 
     ephy_web_view_set_security_level (EPHY_WEB_VIEW (view), security_level);
   } else if (status == WEBKIT_LOAD_PROVISIONAL || status == WEBKIT_LOAD_FINISHED) {
-    EphyWebViewNetState estate = EPHY_WEB_VIEW_STATE_UNKNOWN;
     char *loading_uri = NULL;
 
     if (status == WEBKIT_LOAD_PROVISIONAL) {
@@ -249,12 +248,6 @@ load_status_changed_cb (WebKitWebView *view,
        * we will want to use it in WEBKIT_LOAD_FINISHED, because if a
        * load fails we may never get to committed */
       priv->loading_uri = g_strdup (loading_uri);
-
-      estate = (EphyWebViewNetState) (estate |
-                                      EPHY_WEB_VIEW_STATE_START |
-                                      EPHY_WEB_VIEW_STATE_NEGOTIATING |
-                                      EPHY_WEB_VIEW_STATE_IS_REQUEST |
-                                      EPHY_WEB_VIEW_STATE_IS_NETWORK);
       
       g_signal_emit_by_name (EPHY_WEB_VIEW (view), "new-document-now", loading_uri);
     } else if (status == WEBKIT_LOAD_FINISHED) {
@@ -263,15 +256,11 @@ load_status_changed_cb (WebKitWebView *view,
       /* Will be freed below */
       priv->loading_uri = NULL;
 
-      estate = (EphyWebViewNetState) (estate |
-                                      EPHY_WEB_VIEW_STATE_STOP |
-                                      EPHY_WEB_VIEW_STATE_IS_DOCUMENT |
-                                      EPHY_WEB_VIEW_STATE_IS_NETWORK);
     }
 
     ephy_web_view_update_from_net_state (EPHY_WEB_VIEW (view),
                                          loading_uri,
-                                         (EphyWebViewNetState)estate);
+                                         status);
 
     g_free (loading_uri);
 
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index ed745ae..fa60300 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -2268,7 +2268,7 @@ ensure_page_info (EphyWebView *view, const char *address)
 }
 
 static void
-update_net_state_message (EphyWebView *view, const char *uri, EphyWebViewNetState flags)
+update_net_state_message (EphyWebView *view, const char *uri, WebKitLoadStatus status)
 {
   const char *msg = NULL;
   char *host = NULL;
@@ -2278,25 +2278,12 @@ update_net_state_message (EphyWebView *view, const char *uri, EphyWebViewNetStat
 
   if (host == NULL) goto out;
 
-  /* IS_REQUEST and IS_NETWORK can be both set */
-  if (flags & EPHY_WEB_VIEW_STATE_IS_REQUEST) {
-    if (flags & EPHY_WEB_VIEW_STATE_REDIRECTING) {
-      msg = _ ("Redirecting to “%s”…");
-    } else if (flags & EPHY_WEB_VIEW_STATE_TRANSFERRING) {
-      msg = _ ("Transferring data from “%s”…");
-    } else if (flags & EPHY_WEB_VIEW_STATE_NEGOTIATING) {
-      msg = _ ("Waiting for authorization from “%s”…");
-    }
-  }
-
-  if (flags & EPHY_WEB_VIEW_STATE_IS_NETWORK) {
-    if (flags & EPHY_WEB_VIEW_STATE_START) {
+  /* FIXME: add REDIRECTING and NEGOTIATING states to WebKitGTK */
+  if (status == WEBKIT_LOAD_PROVISIONAL)  {
       msg = _ ("Loading “%s”…");
     }
-  }
 
-  if ((flags & EPHY_WEB_VIEW_STATE_IS_NETWORK) &&
-      (flags & EPHY_WEB_VIEW_STATE_STOP)) {
+  if (status == WEBKIT_LOAD_FINISHED) {
     g_free (view->priv->status_message);
     view->priv->status_message = NULL;
     g_object_notify (G_OBJECT (view), "status-message");
@@ -2344,21 +2331,21 @@ update_navigation_flags (EphyWebView *view)
  * ephy_web_view_update_from_net_state:
  * @view: an #EphyWebView
  * @uri: the uri associated with @view
- * @state: an #EphyWebViewNetState
+ * @state: an #WebKitLoadStatus
  *
  * Update @view at @uri with info from @state.
  **/
 void
 ephy_web_view_update_from_net_state (EphyWebView *view,
                                      const char *uri,
-                                     EphyWebViewNetState state)
+                                     WebKitLoadStatus status)
 {
   EphyWebViewPrivate *priv = view->priv;
 
-  update_net_state_message (view, uri, state);
+  update_net_state_message (view, uri, status);
 
-  if (state & EPHY_WEB_VIEW_STATE_IS_NETWORK) {
-    if (state & EPHY_WEB_VIEW_STATE_START) {
+  if (status == WEBKIT_LOAD_PROVISIONAL || status == WEBKIT_LOAD_FINISHED) {
+    if (status == WEBKIT_LOAD_PROVISIONAL)  {
       GObject *object = G_OBJECT (view);
 
       g_object_freeze_notify (object);
@@ -2370,7 +2357,7 @@ ephy_web_view_update_from_net_state (EphyWebView *view,
       g_object_notify (object, "embed-title");
 
       g_object_thaw_notify (object);
-    } else if (state & EPHY_WEB_VIEW_STATE_STOP) {
+    } else if (status == WEBKIT_LOAD_FINISHED) {
       GObject *object = G_OBJECT (view);
 
       g_object_freeze_notify (object);
diff --git a/embed/ephy-web-view.h b/embed/ephy-web-view.h
index 57dde0b..1a5fc95 100644
--- a/embed/ephy-web-view.h
+++ b/embed/ephy-web-view.h
@@ -54,22 +54,6 @@ typedef enum
 
 typedef enum
 {
-	EPHY_WEB_VIEW_STATE_UNKNOWN		= 0,
-	EPHY_WEB_VIEW_STATE_START		= 1 << 0,
-	EPHY_WEB_VIEW_STATE_REDIRECTING		= 1 << 1,
-	EPHY_WEB_VIEW_STATE_TRANSFERRING	= 1 << 2,
-	EPHY_WEB_VIEW_STATE_NEGOTIATING		= 1 << 3,
-	EPHY_WEB_VIEW_STATE_STOP		= 1 << 4,
-
-	EPHY_WEB_VIEW_STATE_IS_REQUEST	= 1 << 5,
-	EPHY_WEB_VIEW_STATE_IS_DOCUMENT	= 1 << 6,
-	EPHY_WEB_VIEW_STATE_IS_NETWORK	= 1 << 7,
-	EPHY_WEB_VIEW_STATE_IS_WINDOW	= 1 << 8,
-	EPHY_WEB_VIEW_STATE_RESTORING	= 1 << 9
-} EphyWebViewNetState;
-
-typedef enum
-{
 	EPHY_WEB_VIEW_CHROME_MENUBAR		= 1 << 0,
 	EPHY_WEB_VIEW_CHROME_TOOLBAR		= 1 << 1,
 	EPHY_WEB_VIEW_CHROME_STATUSBAR		= 1 << 2,
@@ -196,7 +180,7 @@ void                       ephy_web_view_set_address             (EphyWebView
                                                                   const char                      *address);
 void                       ephy_web_view_update_from_net_state   (EphyWebView                     *view,
                                                                   const char                      *uri,
-                                                                  EphyWebViewNetState              state);
+                                                                  WebKitLoadStatus                state);
 void                       ephy_web_view_location_changed        (EphyWebView                     *view,
                                                                   const char                      *location);
 void                       ephy_web_view_set_loading_title       (EphyWebView                     *view,
