summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDon Scorgie <dscorgie@src.gnome.org>2007-07-07 20:43:37 +0000
committerDon Scorgie <dscorgie@src.gnome.org>2007-07-07 20:43:37 +0000
commitb05263cc79f7e27be24dc16b5fd9883529a287f4 (patch)
tree1e4fa09e50e037da69976f4406c0154e8e324f72
parent12acaca737765cb15544838c151ff97851f5c11e (diff)
downloadyelp-b05263cc79f7e27be24dc16b5fd9883529a287f4.tar.gz
Fix info page titles in TOC Fix file:// uri's when with too many /'s
* src/yelp-utils.c: * src/yelp-toc.c: Fix info page titles in TOC Fix file:// uri's when with too many /'s * src/Makefile.am: * src/yelp-info-parser.c: * src/yelp-info.c: * src/yelp-info.h: * src/yelp-window.c: Convert info pages across to new pager system Hook up info pages into yelp, new style Fix various things in the parser to cope with having less available info for resolving frags svn path=/branches/yelp-spoon/; revision=2831
-rw-r--r--ChangeLog15
-rw-r--r--src/Makefile.am10
-rw-r--r--src/yelp-info-parser.c12
-rw-r--r--src/yelp-info.c423
-rw-r--r--src/yelp-info.h53
-rw-r--r--src/yelp-toc.c2
-rw-r--r--src/yelp-utils.c11
-rw-r--r--src/yelp-window.c20
8 files changed, 528 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index 05dc4131..0feac0a0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,20 @@
2007-07-07 Don Scorgie <dscorgie@svn.gnome.org>
+ * src/yelp-utils.c:
+ * src/yelp-toc.c:
+ Fix info page titles in TOC
+ Fix file:// uri's when with too many /'s
+
+ * src/Makefile.am:
+ * src/yelp-info-parser.c:
+ * src/yelp-info.c:
+ * src/yelp-info.h:
+ * src/yelp-window.c:
+ Convert info pages across to new pager system
+ Hook up info pages into yelp, new style
+ Fix various things in the parser to cope with
+ having less available info for resolving frags
+
* src/yelp-toc.c:
Fix the most annoying error message in the world EVER
Unexpected async xlib errors generally mean threading issues
diff --git a/src/Makefile.am b/src/Makefile.am
index 639be536..16a26642 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -28,11 +28,11 @@ yelp_SOURCES += \
yelp-man.c yelp-man.h
endif
-#if ENABLE_INFO
-#yelp_SOURCES += \
-# yelp-info-pager.c yelp-info-pager.h \
-# yelp-info-parser.c yelp-info-parser.h
-#endif
+if ENABLE_INFO
+yelp_SOURCES += \
+ yelp-info.c yelp-info.h \
+ yelp-info-parser.c yelp-info-parser.h
+endif
#if ENABLE_SEARCH
#yelp_SOURCES += \
diff --git a/src/yelp-info-parser.c b/src/yelp-info-parser.c
index c462aac7..b46babc4 100644
--- a/src/yelp-info-parser.c
+++ b/src/yelp-info-parser.c
@@ -486,11 +486,14 @@ process_page (GtkTreeStore *tree, GHashTable *nodes2offsets,
}
d (if (iter) debug_print (DB_DEBUG, "Have a valid iter, storing for %s\n", node));
+
g_hash_table_insert (nodes2iters, g_strdup (node), iter);
debug_print (DB_DEBUG, "size: %i\n", g_hash_table_size (nodes2iters));
- tmp = g_strdup_printf ("%i",
- node2page (nodes2offsets, offsets2pages, node));
+ /*tmp = g_strdup_printf ("%i",
+ node2page (nodes2offsets, offsets2pages, node));*/
+ tmp = g_strdup (node);
+ tmp = g_strdelimit (tmp, " ", '_');
gtk_tree_store_set (tree, iter,
COLUMN_PAGE_NO, tmp,
COLUMN_PAGE_NAME, node,
@@ -554,6 +557,7 @@ GtkTreeStore
str = open_info_file (file);
if (!str) {
+ printf ("NULL return");
return NULL;
}
page_list = g_strsplit (str, "\n", 0);
@@ -785,7 +789,9 @@ resolve_frag_id (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter,
-1);
if (g_str_equal (page_name, *xref)) {
g_free (*xref);
- *xref = g_strdup (page_no);
+ *xref = g_strdup (page_name);
+ *xref = g_strdelimit (*xref, " ", '_');
+
g_free (page_name);
g_free (page_no);
return TRUE;
diff --git a/src/yelp-info.c b/src/yelp-info.c
new file mode 100644
index 00000000..81cb536b
--- /dev/null
+++ b/src/yelp-info.c
@@ -0,0 +1,423 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/*
+ * Copyright (C) 2007 Don Scorgie <dscorgie@svn.gnome.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Don Scorgie <dscorgie@svn.gnome.org>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+#include <libxml/tree.h>
+
+#include "yelp-error.h"
+#include "yelp-info.h"
+#include "yelp-info-parser.h"
+#include "yelp-transform.h"
+#include "yelp-debug.h"
+
+#define STYLESHEET DATADIR"/yelp/xslt/info2html.xsl"
+
+#define YELP_INFO_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), YELP_TYPE_INFO, YelpInfoPriv))
+
+typedef enum {
+ INFO_STATE_BLANK, /* Brand new, run transform as needed */
+ INFO_STATE_PARSING, /* Parsing/transforming document, please wait */
+ INFO_STATE_PARSED, /* All done, if we ain't got it, it ain't here */
+ INFO_STATE_STOP /* Stop everything now, object to be disposed */
+} InfoState;
+
+struct _YelpInfoPriv {
+ gchar *filename;
+ InfoState state;
+
+ GMutex *mutex;
+ GThread *thread;
+
+ xmlDocPtr xmldoc;
+ GtkTreeModel *sections;
+
+ gboolean process_running;
+ gboolean transform_running;
+
+ YelpTransform *transform;
+};
+
+
+static void info_class_init (YelpInfoClass *klass);
+static void info_init (YelpInfo *info);
+static void info_try_dispose (GObject *object);
+static void info_dispose (GObject *object);
+
+/* YelpDocument */
+static void info_request (YelpDocument *document,
+ gint req_id,
+ gboolean handled,
+ gchar *page_id,
+ YelpDocumentFunc func,
+ gpointer user_data);
+
+/* YelpTransform */
+static void transform_func (YelpTransform *transform,
+ YelpTransformSignal signal,
+ gpointer func_data,
+ YelpInfo *info);
+static void transform_page_func (YelpTransform *transform,
+ gchar *page_id,
+ YelpInfo *info);
+static void transform_final_func (YelpTransform *transform,
+ YelpInfo *info);
+static gpointer info_get_sections (YelpDocument *document);
+
+/* Threaded */
+static void info_process (YelpInfo *info);
+
+static YelpDocumentClass *parent_class;
+
+GType
+yelp_info_get_type (void)
+{
+ static GType type = 0;
+ if (!type) {
+ static const GTypeInfo info = {
+ sizeof (YelpInfoClass),
+ NULL, NULL,
+ (GClassInitFunc) info_class_init,
+ NULL, NULL,
+ sizeof (YelpInfo),
+ 0,
+ (GInstanceInitFunc) info_init,
+ };
+ type = g_type_register_static (YELP_TYPE_DOCUMENT,
+ "YelpInfo",
+ &info, 0);
+ }
+ return type;
+}
+
+static void
+info_class_init (YelpInfoClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ YelpDocumentClass *document_class = YELP_DOCUMENT_CLASS (klass);
+
+ parent_class = g_type_class_peek_parent (klass);
+
+ object_class->dispose = info_try_dispose;
+
+ document_class->request = info_request;
+ document_class->cancel = NULL;
+ document_class->get_sections = info_get_sections;
+
+ g_type_class_add_private (klass, sizeof (YelpInfoPriv));
+}
+
+static void
+info_init (YelpInfo *info)
+{
+ YelpInfoPriv *priv;
+
+ priv = info->priv = YELP_INFO_GET_PRIVATE (info);
+
+ priv->state = INFO_STATE_BLANK;
+
+ priv->xmldoc = NULL;
+
+ priv->mutex = g_mutex_new ();
+}
+
+static void
+info_try_dispose (GObject *object)
+{
+ YelpInfoPriv *priv;
+
+ g_assert (object != NULL && YELP_IS_INFO (object));
+ priv = YELP_INFO (object)->priv;
+
+ g_mutex_lock (priv->mutex);
+ if (priv->process_running || priv->transform_running) {
+ priv->state = INFO_STATE_STOP;
+ g_idle_add ((GSourceFunc) info_try_dispose, object);
+ g_mutex_unlock (priv->mutex);
+ } else {
+ g_mutex_unlock (priv->mutex);
+ info_dispose (object);
+ }
+}
+
+static void
+info_dispose (GObject *object)
+{
+ YelpInfo *info = YELP_INFO (object);
+
+ g_free (info->priv->filename);
+
+ if (info->priv->xmldoc)
+ xmlFreeDoc (info->priv->xmldoc);
+
+ g_mutex_free (info->priv->mutex);
+
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+/******************************************************************************/
+
+YelpDocument *
+yelp_info_new (gchar *filename)
+{
+ YelpInfo *info;
+
+ g_return_val_if_fail (filename != NULL, NULL);
+
+ info = (YelpInfo *) g_object_new (YELP_TYPE_INFO, NULL);
+ info->priv->filename = g_strdup (filename);
+
+ debug_print (DB_FUNCTION, "entering\n");
+ debug_print (DB_ARG, " filename = \"%s\"\n", filename);
+
+ yelp_document_add_page_id (YELP_DOCUMENT (info), "x-yelp-index", "index");
+
+ return (YelpDocument *) info;
+}
+
+
+/******************************************************************************/
+/** YelpDocument **************************************************************/
+
+static void
+info_request (YelpDocument *document,
+ gint req_id,
+ gboolean handled,
+ gchar *page_id,
+ YelpDocumentFunc func,
+ gpointer user_data)
+{
+ YelpInfo *info;
+ YelpInfoPriv *priv;
+ YelpError *error;
+
+ debug_print (DB_FUNCTION, "entering\n");
+ debug_print (DB_ARG, " req_id = %i\n", req_id);
+ debug_print (DB_ARG, " page_id = \"%s\"\n", page_id);
+
+ g_assert (document != NULL && YELP_IS_INFO (document));
+
+ if (handled)
+ return;
+
+ info = YELP_INFO (document);
+ priv = info->priv;
+
+ g_mutex_lock (priv->mutex);
+
+ switch (priv->state) {
+ case INFO_STATE_BLANK:
+ priv->state = INFO_STATE_PARSING;
+ priv->process_running = TRUE;
+ priv->thread = g_thread_create ((GThreadFunc) info_process, info, FALSE, NULL);
+ break;
+ case INFO_STATE_PARSING:
+ break;
+ case INFO_STATE_PARSED:
+ case INFO_STATE_STOP:
+ error = yelp_error_new (_("Page not found"),
+ _("The page %s was not found in the document %s."),
+ page_id, priv->filename);
+ yelp_document_error_request (document, req_id, error);
+ break;
+ }
+
+ g_mutex_unlock (priv->mutex);
+}
+
+
+/******************************************************************************/
+/** YelpTransform *************************************************************/
+
+static void
+transform_func (YelpTransform *transform,
+ YelpTransformSignal signal,
+ gpointer func_data,
+ YelpInfo *info)
+{
+ YelpInfoPriv *priv;
+
+ debug_print (DB_FUNCTION, "entering\n");
+
+ g_assert (info != NULL && YELP_IS_INFO (info));
+
+ priv = info->priv;
+
+ g_assert (transform == priv->transform);
+
+ if (priv->state == INFO_STATE_STOP) {
+ switch (signal) {
+ case YELP_TRANSFORM_CHUNK:
+ g_free (func_data);
+ break;
+ case YELP_TRANSFORM_ERROR:
+ yelp_error_free ((YelpError *) func_data);
+ break;
+ case YELP_TRANSFORM_FINAL:
+ break;
+ }
+ yelp_transform_release (transform);
+ priv->transform = NULL;
+ priv->transform_running = FALSE;
+ return;
+ }
+
+ switch (signal) {
+ case YELP_TRANSFORM_CHUNK:
+ transform_page_func (transform, (gchar *) func_data, info);
+ break;
+ case YELP_TRANSFORM_ERROR:
+ yelp_document_error_pending (YELP_DOCUMENT (info), (YelpError *) func_data);
+ yelp_transform_release (transform);
+ priv->transform = NULL;
+ priv->transform_running = FALSE;
+ break;
+ case YELP_TRANSFORM_FINAL:
+ transform_final_func (transform, info);
+ break;
+ }
+}
+
+static void
+transform_page_func (YelpTransform *transform,
+ gchar *page_id,
+ YelpInfo *info)
+{
+ YelpInfoPriv *priv;
+ gchar *content;
+
+ debug_print (DB_FUNCTION, "entering\n");
+
+ priv = info->priv;
+ g_mutex_lock (priv->mutex);
+
+ content = yelp_transform_eat_chunk (transform, page_id);
+
+ yelp_document_add_page (YELP_DOCUMENT (info), page_id, content);
+
+ g_free (page_id);
+
+ g_mutex_unlock (priv->mutex);
+}
+
+static void
+transform_final_func (YelpTransform *transform, YelpInfo *info)
+{
+ YelpError *error;
+ YelpInfoPriv *priv = info->priv;
+
+ debug_print (DB_FUNCTION, "entering\n");
+
+ g_mutex_lock (priv->mutex);
+
+ error = yelp_error_new (_("Page not found"),
+ _("The requested page was not found in the document %s."),
+ priv->filename);
+ yelp_document_error_pending (YELP_DOCUMENT (info), error);
+
+ yelp_transform_release (transform);
+ priv->transform = NULL;
+ priv->transform_running = FALSE;
+
+ if (priv->xmldoc)
+ xmlFreeDoc (priv->xmldoc);
+ priv->xmldoc = NULL;
+
+ g_mutex_unlock (priv->mutex);
+}
+
+
+/******************************************************************************/
+/** Threaded ******************************************************************/
+
+static void
+info_process (YelpInfo *info)
+{
+ YelpInfoPriv *priv;
+ YelpError *error = NULL;
+ YelpDocument *document;
+ GtkTreeModel *model;
+
+ debug_print (DB_FUNCTION, "entering\n");
+
+ g_assert (info != NULL && YELP_IS_INFO (info));
+ g_object_ref (info);
+ priv = info->priv;
+ document = YELP_DOCUMENT (info);
+
+ if (!g_file_test (priv->filename, G_FILE_TEST_IS_REGULAR)) {
+ error = yelp_error_new (_("File not found"),
+ _("The file ā€˜%sā€™ does not exist."),
+ priv->filename);
+ yelp_document_error_pending (document, error);
+ goto done;
+ }
+
+ priv->sections = (GtkTreeModel *) yelp_info_parser_parse_file (priv->filename);
+ if (!model) {
+ /* TODO: Handle errors - exit out somehow */
+ }
+
+ priv->xmldoc = yelp_info_parser_parse_tree ((GtkTreeStore *) priv->sections);
+
+ if (priv->xmldoc == NULL) {
+ error = yelp_error_new (_("Could not parse file"),
+ _("The file ā€˜%sā€™ could not be parsed because it is"
+ " not a well-formed info page."),
+ priv->filename);
+ yelp_document_error_pending (document, error);
+ }
+
+ g_mutex_lock (priv->mutex);
+ if (priv->state == INFO_STATE_STOP) {
+ g_mutex_unlock (priv->mutex);
+ goto done;
+ }
+
+ priv->transform = yelp_transform_new (STYLESHEET,
+ (YelpTransformFunc) transform_func,
+ info);
+ priv->transform_running = TRUE;
+ /* FIXME: we probably need to set our own params */
+
+ yelp_transform_start (priv->transform,
+ priv->xmldoc,
+ NULL);
+ g_mutex_unlock (priv->mutex);
+
+ done:
+ priv->process_running = FALSE;
+ g_object_unref (info);
+}
+
+static gpointer
+info_get_sections (YelpDocument *document)
+{
+ YelpInfo *info = (YelpInfo *) document;
+
+ return (gpointer) (info->priv->sections);
+}
diff --git a/src/yelp-info.h b/src/yelp-info.h
new file mode 100644
index 00000000..d592dd72
--- /dev/null
+++ b/src/yelp-info.h
@@ -0,0 +1,53 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/*
+ * Copyright (C) 2007 Don Scorgie <dscorgie@svn.gnome.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Don Scorgie <dscorgie@svn.gnome.org>
+ */
+
+#ifndef __YELP_INFO_H__
+#define __YELP_INFO_H__
+
+#include <glib-object.h>
+
+#include "yelp-document.h"
+
+#define YELP_TYPE_INFO (yelp_info_get_type ())
+#define YELP_INFO(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), YELP_TYPE_INFO, YelpInfo))
+#define YELP_INFO_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), YELP_TYPE_INFO, YelpInfoClass))
+#define YELP_IS_INFO(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), YELP_TYPE_INFO))
+#define YELP_IS_INFO_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), YELP_TYPE_INFO))
+#define YELP_INFO_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), YELP_TYPE_INFO, YelpInfoClass))
+
+typedef struct _YelpInfo YelpInfo;
+typedef struct _YelpInfoClass YelpInfoClass;
+typedef struct _YelpInfoPriv YelpInfoPriv;
+
+struct _YelpInfo {
+ YelpDocument parent;
+ YelpInfoPriv *priv;
+};
+
+struct _YelpInfoClass {
+ YelpDocumentClass parent_class;
+};
+
+GType yelp_info_get_type (void);
+YelpDocument * yelp_info_new (gchar *uri);
+
+#endif /* __YELP_INFO_H__ */
diff --git a/src/yelp-toc.c b/src/yelp-toc.c
index 0307ab8b..90adb61e 100644
--- a/src/yelp-toc.c
+++ b/src/yelp-toc.c
@@ -658,7 +658,7 @@ rrn_info_add_document (RrnInfoEntry *entry, void *user_data)
else
tmp = g_strdup_printf("info:%s", entry->name);
xmlNewNsProp (new, NULL, BAD_CAST "href", BAD_CAST tmp);
- xmlNewTextChild (new, NULL, BAD_CAST "title", BAD_CAST entry->name);
+ xmlNewTextChild (new, NULL, BAD_CAST "title", BAD_CAST entry->doc_name);
xmlNewTextChild (new, NULL, BAD_CAST "description", BAD_CAST entry->comment);
g_free(tmp);
return TRUE;
diff --git a/src/yelp-utils.c b/src/yelp-utils.c
index 7bf3559b..166482e3 100644
--- a/src/yelp-utils.c
+++ b/src/yelp-utils.c
@@ -1142,10 +1142,10 @@ resolve_full_file (const gchar *path)
if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
return YELP_RRN_TYPE_ERROR;
}
-
mime_type = gnome_vfs_get_mime_type (path);
- if (mime_type == NULL)
+ if (mime_type == NULL) {
return YELP_RRN_TYPE_ERROR;
+ }
if (g_str_equal (mime_type, "text/xml") || g_str_equal (mime_type, "application/docbook+xml") || g_str_equal (mime_type, "application/xml"))
type = YELP_RRN_TYPE_DOC;
@@ -1352,7 +1352,10 @@ yelp_uri_resolve (gchar *uri, gchar **result, gchar **section)
g_free (info_sect);
}
} else if (!strncmp (uri, "file:", 5)) {
- ret = resolve_full_file (&intern_uri[5]);
+ int file_cut = 5;
+ while (uri[file_cut+1] == '/')
+ file_cut++;
+ ret = resolve_full_file (&intern_uri[file_cut]);
if (ret == YELP_RRN_TYPE_EXTERNAL) {
*section = NULL;
*result = g_strdup (uri);
@@ -1361,7 +1364,7 @@ yelp_uri_resolve (gchar *uri, gchar **result, gchar **section)
*section = NULL;
*result = NULL;
} else {
- *result = g_strdup (&intern_uri[5]);
+ *result = g_strdup (&intern_uri[file_cut]);
*section = intern_section;
}
/* full file path. Ensure file exists and determine type */
diff --git a/src/yelp-window.c b/src/yelp-window.c
index 0e585b28..d4fad8ff 100644
--- a/src/yelp-window.c
+++ b/src/yelp-window.c
@@ -54,10 +54,10 @@
#ifdef ENABLE_MAN
#include "yelp-man.h"
#endif
-/*#ifdef ENABLE_INFO
-#include "yelp-info-pager.h"
+#ifdef ENABLE_INFO
+#include "yelp-info.h"
#endif
-#ifdef ENABLE_SEARCH
+/*#ifdef ENABLE_SEARCH
#include "yelp-search-pager.h"
#include "gtkentryaction.h"
#endif*/
@@ -967,7 +967,7 @@ yelp_window_load (YelpWindow *window, const gchar *uri)
}
type = yelp_uri_resolve (uri, &real_uri, &frag_id);
-
+
/* TODO: handle type errors here first */
if (priv->uri && g_str_equal (real_uri, priv->uri)) {
@@ -979,10 +979,19 @@ yelp_window_load (YelpWindow *window, const gchar *uri)
priv->base_uri = g_strdup ("file:///fakefile");
break;
case YELP_RRN_TYPE_MAN:
- priv->base_uri = g_strdup ("file:///fakefile");
+ priv->base_uri = g_strdup (real_uri);
doc = yelp_man_new (real_uri);
priv->uri = "";
break;
+ case YELP_RRN_TYPE_INFO:
+ priv->base_uri = g_strdup_printf ("file:/%s", real_uri);
+ if (!frag_id) {
+ frag_id = g_strdup ("Top");
+ } else {
+ g_strdelimit (frag_id, " ", '_');
+ }
+ doc = yelp_info_new (real_uri);
+ break;
case YELP_RRN_TYPE_DOC:
priv->base_uri = g_strdup (uri);
doc = yelp_docbook_new (real_uri);
@@ -997,6 +1006,7 @@ yelp_window_load (YelpWindow *window, const gchar *uri)
if (doc) {
if (!frag_id)
frag_id = g_strdup ("index");
+
priv->uri = real_uri;
priv->current_frag = frag_id;
priv->req_uri = g_strdup (uri);