diff options
author | Shaun McCance <shaunm@gnome.org> | 2011-01-17 16:33:13 -0500 |
---|---|---|
committer | Shaun McCance <shaunm@gnome.org> | 2011-01-17 16:35:56 -0500 |
commit | 3b0c1358cfac5dda0ee24c92f3ed6f971a57a35b (patch) | |
tree | d72424251bea57d8c3d4f16e1463b5f938dbf647 /libyelp/yelp-document.c | |
parent | 52a31b8820107f67b334246f5a3498b5f1117669 (diff) | |
download | yelp-3b0c1358cfac5dda0ee24c92f3ed6f971a57a35b.tar.gz |
Mangling man URIs so that bookmarks are somewhat sensible
Diffstat (limited to 'libyelp/yelp-document.c')
-rw-r--r-- | libyelp/yelp-document.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/libyelp/yelp-document.c b/libyelp/yelp-document.c index 215586e6..b1d17b8d 100644 --- a/libyelp/yelp-document.c +++ b/libyelp/yelp-document.c @@ -139,7 +139,7 @@ YelpDocument * yelp_document_get_for_uri (YelpUri *uri) { static GHashTable *documents = NULL; - gchar *docuri; + gchar *docuri = NULL; gchar *page_id, *tmp; YelpDocument *document = NULL; @@ -149,10 +149,6 @@ yelp_document_get_for_uri (YelpUri *uri) g_return_val_if_fail (yelp_uri_is_resolved (uri), NULL); - docuri = yelp_uri_get_document_uri (uri); - if (docuri == NULL) - return NULL; - switch (yelp_uri_get_document_type (uri)) { case YELP_URI_DOCUMENT_TYPE_TEXT: case YELP_URI_DOCUMENT_TYPE_HTML: @@ -165,12 +161,21 @@ yelp_document_get_for_uri (YelpUri *uri) page_id = yelp_uri_get_page_id (uri); tmp = g_strconcat (docuri, "/", page_id, NULL); g_free (page_id); - g_free (docuri); docuri = tmp; break; + case YELP_URI_DOCUMENT_TYPE_MAN: + /* The document URI for man pages is just man:, so we use the + * full canonical URI to look these up. + */ + docuri = yelp_uri_get_canonical_uri (uri); + break; default: + docuri = yelp_uri_get_document_uri (uri); break; } + + if (docuri == NULL) + return NULL; document = g_hash_table_lookup (documents, docuri); if (document != NULL) { |