summaryrefslogtreecommitdiff
path: root/libyelp/yelp-document.c
diff options
context:
space:
mode:
authorShaun McCance <shaunm@gnome.org>2010-03-31 20:31:10 -0500
committerShaun McCance <shaunm@gnome.org>2010-03-31 20:32:15 -0500
commit90c0b590f3ba056c043fc572334d9ffaccf5f462 (patch)
tree3c32fa29a2326da8a3848997e7aa8015605262f7 /libyelp/yelp-document.c
parent6dbb2d3b0d2c911953c4f17fc5bb50edca2ed895 (diff)
downloadyelp-90c0b590f3ba056c043fc572334d9ffaccf5f462.tar.gz
Adding icons for page styles
Diffstat (limited to 'libyelp/yelp-document.c')
-rw-r--r--libyelp/yelp-document.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/libyelp/yelp-document.c b/libyelp/yelp-document.c
index 7914b3bb..d30e4027 100644
--- a/libyelp/yelp-document.c
+++ b/libyelp/yelp-document.c
@@ -67,6 +67,7 @@ struct _YelpDocumentPriv {
Hash *page_ids; /* Mapping of fragment IDs to real page IDs */
Hash *titles; /* Mapping of page IDs to titles */
Hash *descs; /* Mapping of page IDs to descs */
+ Hash *icons; /* Mapping of page IDs to icons */
Hash *mime_types; /* Mapping of page IDs to mime types */
Hash *contents; /* Mapping of page IDs to string content */
@@ -227,6 +228,7 @@ yelp_document_init (YelpDocument *document)
priv->page_ids = hash_new (g_free );
priv->titles = hash_new (g_free);
priv->descs = hash_new (g_free);
+ priv->icons = hash_new (g_free);
priv->mime_types = hash_new (g_free);
priv->contents = hash_new ((GDestroyNotify) str_unref);
@@ -263,6 +265,7 @@ yelp_document_finalize (GObject *object)
hash_free (document->priv->page_ids);
hash_free (document->priv->titles);
hash_free (document->priv->descs);
+ hash_free (document->priv->icons);
hash_free (document->priv->mime_types);
hash_free (document->priv->contents);
@@ -575,6 +578,38 @@ yelp_document_set_page_desc (YelpDocument *document,
g_mutex_unlock (document->priv->mutex);
}
+gchar *
+yelp_document_get_page_icon (YelpDocument *document,
+ const gchar *page_id)
+{
+ gchar *real, *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) {
+ ret = hash_lookup (document->priv->icons, real);
+ if (ret)
+ ret = g_strdup (ret);
+ }
+ g_mutex_unlock (document->priv->mutex);
+
+ return ret;
+}
+
+gchar *
+yelp_document_set_page_icon (YelpDocument *document,
+ const gchar *page_id,
+ const gchar *icon)
+{
+ g_assert (document != NULL && YELP_IS_DOCUMENT (document));
+
+ g_mutex_lock (document->priv->mutex);
+ hash_replace (document->priv->icons, page_id, g_strdup (icon));
+ g_mutex_unlock (document->priv->mutex);
+}
+
/******************************************************************************/
gboolean