diff options
author | Shaun McCance <shaunm@gnome.org> | 2010-05-10 13:59:58 -0500 |
---|---|---|
committer | Shaun McCance <shaunm@gnome.org> | 2010-05-10 14:00:32 -0500 |
commit | 27959c3d15e7dfa19612a4501fb73d88d4dcdc04 (patch) | |
tree | c6f47e57162c6860e3778cb936471281953c52f5 | |
parent | 46d5d135ff03253221172eecb57d3aa38298f803 (diff) | |
download | yelp-27959c3d15e7dfa19612a4501fb73d88d4dcdc04.tar.gz |
[yelp-view.c] Give WebKit real URIs when real URIs are file: URIs
-rw-r--r-- | libyelp/yelp-view.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/libyelp/yelp-view.c b/libyelp/yelp-view.c index 6ef75139..40437271 100644 --- a/libyelp/yelp-view.c +++ b/libyelp/yelp-view.c @@ -1084,7 +1084,7 @@ document_callback (YelpDocument *document, } else if (signal == YELP_DOCUMENT_SIGNAL_CONTENTS) { const gchar *contents; - gchar *mime_type, *page_id, *frag_id; + gchar *mime_type, *page_id, *frag_id, *full_uri; page_id = yelp_uri_get_page_id (priv->uri); debug_print (DB_ARG, " document.uri.page_id=\"%s\"\n", page_id); mime_type = yelp_document_get_mime_type (document, page_id); @@ -1114,10 +1114,17 @@ document_callback (YelpDocument *document, based on actual file locations, but in fact it doesn't matter. So we just make a bogus URI that's easy to process later. */ - if (frag_id != NULL) - priv->bogus_uri = g_strdup_printf ("%s%p#%s", BOGUS_URI, priv->uri, frag_id); - else - priv->bogus_uri = g_strdup_printf ("%s%p", BOGUS_URI, priv->uri); + full_uri = yelp_uri_get_canonical_uri (priv->uri); + if (g_str_has_prefix (full_uri, "file:/")) { + priv->bogus_uri = full_uri; + } + else { + g_free (full_uri); + if (frag_id != NULL) + priv->bogus_uri = g_strdup_printf ("%s%p#%s", BOGUS_URI, priv->uri, frag_id); + else + priv->bogus_uri = g_strdup_printf ("%s%p", BOGUS_URI, priv->uri); + } g_signal_handler_block (view, priv->navigation_requested); webkit_web_view_load_string (WEBKIT_WEB_VIEW (view), contents, |