[yelp] yelp-location-entry: Don't show #frag for error pages



commit 6f0fc072edec9064d56785a17402fc08e7ee909f
Author: Shaun McCance <shaunm gnome org>
Date:   Thu Jan 6 15:47:49 2011 -0500

    yelp-location-entry: Don't show #frag for error pages

 libyelp/yelp-location-entry.c |   33 ++++++++++++++++++++-------------
 libyelp/yelp-view.c           |    2 +-
 2 files changed, 21 insertions(+), 14 deletions(-)
---
diff --git a/libyelp/yelp-location-entry.c b/libyelp/yelp-location-entry.c
index a597066..b206afd 100644
--- a/libyelp/yelp-location-entry.c
+++ b/libyelp/yelp-location-entry.c
@@ -1363,35 +1363,42 @@ view_page_title (YelpView          *view,
                  YelpLocationEntry *entry)
 {
     GtkTreeIter first;
-    gchar *title, *frag;
-    YelpUri *uri;
     YelpLocationEntryPrivate *priv = GET_PRIV (entry);
 
-    g_object_get (view, "page-title", &title, NULL);
-    if (title == NULL)
-        return;
-
-    g_object_get (view, "yelp-uri", &uri, NULL);
-    frag = yelp_uri_get_frag_id (uri);
-
     if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (priv->history), &first)) {
+        gchar *title, *frag = NULL;
+        YelpViewState state;
+        YelpUri *uri;
+
+        g_object_get (view,
+                      "page-title", &title,
+                      "state", &state,
+                      NULL);
+        if (title == NULL)
+            return;
+
+        if (state != YELP_VIEW_STATE_ERROR) {
+            YelpUri *uri;
+            g_object_get (view, "yelp-uri", &uri, NULL);
+            frag = yelp_uri_get_frag_id (uri);
+            g_object_unref (uri);
+        }
+
         if (frag) {
             gchar *tmp = g_strdup_printf ("%s (#%s)", title, frag);
             gtk_list_store_set (priv->history, &first,
                                 HISTORY_COL_TITLE, tmp,
                                 -1);
             g_free (tmp);
+            g_free (frag);     
         }
         else {
             gtk_list_store_set (priv->history, &first,
                                 HISTORY_COL_TITLE, title,
                                 -1);
         }
+        g_free (title);
     }
-
-    g_free (frag);     
-    g_free (title);
-    g_object_unref (uri);
 }
 
 static void
diff --git a/libyelp/yelp-view.c b/libyelp/yelp-view.c
index 381a60c..3462dfa 100644
--- a/libyelp/yelp-view.c
+++ b/libyelp/yelp-view.c
@@ -1669,6 +1669,7 @@ view_show_error_page (YelpView *view,
                             titlecolor, linkcolor, title_m, content_beg,
                             (content_end != NULL) ? content_end : "");
 
+    g_object_set (view, "state", YELP_VIEW_STATE_ERROR, NULL);
 
     if (doc404) {
         g_free (priv->root_title);
@@ -1703,7 +1704,6 @@ view_show_error_page (YelpView *view,
                                          "page-icon");
     g_signal_emit_by_name (view, "notify::page-icon", spec);
 
-    g_object_set (view, "state", YELP_VIEW_STATE_ERROR, NULL);
     g_signal_emit (view, signals[LOADED], 0);
     g_signal_handler_block (view, priv->navigation_requested);
     webkit_web_view_load_string (WEBKIT_WEB_VIEW (view),



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