From d3ecc826fea73ffcfe57bb30c0914616eb3fb97c Mon Sep 17 00:00:00 2001 From: Shaun McCance Date: Sun, 21 Mar 2010 14:03:12 -0500 Subject: Set the window title based on the root page title --- libyelp/yelp-document.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'libyelp/yelp-document.c') diff --git a/libyelp/yelp-document.c b/libyelp/yelp-document.c index 74275523..3c79dc92 100644 --- a/libyelp/yelp-document.c +++ b/libyelp/yelp-document.c @@ -452,6 +452,29 @@ yelp_document_set_up_id (YelpDocument *document, g_mutex_unlock (document->priv->mutex); } +gchar * +yelp_document_get_root_title (YelpDocument *document, + const gchar *page_id) +{ + gchar *real, *root, *ret = NULL; + + g_assert (document != NULL && YELP_IS_DOCUMENT (document)); + + g_mutex_lock (document->priv->mutex); + real = hash_lookup (document->priv->page_ids, page_id); + if (real) { + root = hash_lookup (document->priv->root_ids, real); + if (root) { + ret = hash_lookup (document->priv->titles, root); + if (ret) + ret = g_strdup (ret); + } + } + g_mutex_unlock (document->priv->mutex); + + return ret; +} + gchar * yelp_document_get_page_title (YelpDocument *document, const gchar *page_id) -- cgit v1.2.1