[epiphany: 11/14] ephy-web-view: move history management to EphyWebView



commit 1b941be52d0ed9ec90036efe4987740076c501a2
Author: Xan Lopez <xan igalia com>
Date:   Wed Mar 14 12:48:23 2012 +0100

    ephy-web-view: move history management to EphyWebView

 embed/ephy-embed.c    |   27 +--------------------------
 embed/ephy-web-view.c |   20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 26 deletions(-)
---
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index 44a8466..a0ed87c 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -277,33 +277,8 @@ load_status_changed_cb (WebKitWebView *web_view,
 {
   WebKitLoadStatus status = webkit_web_view_get_load_status (web_view);
 
-  if (status == WEBKIT_LOAD_COMMITTED) {
-    const gchar* uri;
-    char *history_uri;
-    EphyHistoryPageVisitType visit_type;
-    EphyWebView *view = EPHY_WEB_VIEW (web_view);
-
-    uri = webkit_web_view_get_uri (web_view);
-
+  if (status == WEBKIT_LOAD_COMMITTED)
     ephy_embed_destroy_top_widgets (embed);
-
-    if (ephy_web_view_is_loading_homepage (view))
-      return;
-
-    /* TODO: move the normalization down to the history service? */
-    if (g_str_has_prefix (uri, EPHY_ABOUT_SCHEME))
-      history_uri = g_strdup_printf ("about:%s", uri + EPHY_ABOUT_SCHEME_LEN + 1);
-    else
-      history_uri = g_strdup (uri);
-
-    visit_type = ephy_web_view_get_visit_type (view);
-
-    ephy_history_service_visit_url (embed->priv->history_service,
-                                    history_uri,
-                                    visit_type);
-
-    g_free (history_uri);
-  }
 }
 
 static void
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 55aa51d..47f7c0b 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -1936,12 +1936,14 @@ load_status_cb (WebKitWebView *web_view,
       const gchar* uri;
       EphyWebViewSecurityLevel security_level;
 
+      /* Title and location. */
       uri = webkit_web_view_get_uri (web_view);
       ephy_web_view_location_changed (view,
                                       uri);
 
       ephy_web_view_set_title (view, NULL);
 
+      /* Security status. */
       if (uri && g_str_has_prefix (uri, "https")) {
         WebKitWebFrame *frame;
         WebKitWebDataSource *source;
@@ -1963,7 +1965,25 @@ load_status_cb (WebKitWebView *web_view,
 
       ephy_web_view_set_security_level (EPHY_WEB_VIEW (web_view), security_level);
 
+      /* Zoom level. */
       restore_zoom_level (view, uri);
+
+      /* History. */
+      if (!ephy_web_view_is_loading_homepage (view)) {
+        char *history_uri = NULL;
+
+        /* TODO: move the normalization down to the history service? */
+        if (g_str_has_prefix (uri, EPHY_ABOUT_SCHEME))
+          history_uri = g_strdup_printf ("about:%s", uri + EPHY_ABOUT_SCHEME_LEN + 1);
+        else
+          history_uri = g_strdup (uri);
+        
+        ephy_history_service_visit_url (priv->history_service,
+                                        history_uri,
+                                        priv->visit_type);
+        
+        g_free (history_uri);
+      }
     }
     break;
   case WEBKIT_LOAD_FINISHED: {



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