diff options
author | Shaun McCance <shaunm@gnome.org> | 2012-01-19 14:49:19 -0500 |
---|---|---|
committer | Shaun McCance <shaunm@gnome.org> | 2012-01-19 14:50:25 -0500 |
commit | f755aaf23e92a7211c50b8881b648c6f8b97939b (patch) | |
tree | 2ea1568563300601e9b24f4481ac9d4f93ab98de /libyelp/yelp-document.c | |
parent | 03477805280c66834926a942f41c8f586472d58b (diff) | |
download | yelp-f755aaf23e92a7211c50b8881b648c6f8b97939b.tar.gz |
libyelp: Auto-reload Mallard documents
Diffstat (limited to 'libyelp/yelp-document.c')
-rw-r--r-- | libyelp/yelp-document.c | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/libyelp/yelp-document.c b/libyelp/yelp-document.c index d6c0ff7b..83605ddf 100644 --- a/libyelp/yelp-document.c +++ b/libyelp/yelp-document.c @@ -479,8 +479,9 @@ yelp_document_set_page_id (YelpDocument *document, request->page_id = g_strdup (page_id); hash_slist_insert (document->priv->reqs_by_page_id, page_id, request); } - if (reqs) + if (reqs) { hash_remove (document->priv->reqs_by_page_id, id); + } } if (page_id != NULL) { @@ -863,6 +864,41 @@ document_request_page (YelpDocument *document, return ret; } +void +yelp_document_clear_contents (YelpDocument *document) +{ + g_mutex_lock (document->priv->mutex); + + if (document->priv->contents->null) { + str_unref (document->priv->contents->null); + document->priv->contents->null = NULL; + } + g_hash_table_remove_all (document->priv->contents->hash); + + g_mutex_unlock (document->priv->mutex); +} + +gchar ** +yelp_document_get_requests (YelpDocument *document) +{ + GList *reqs, *cur; + gchar **ret; + gint i; + + g_mutex_lock (document->priv->mutex); + + reqs = g_hash_table_get_keys (document->priv->reqs_by_page_id->hash); + ret = g_new0 (gchar*, g_list_length (reqs) + 1); + for (cur = reqs, i = 0; cur; cur = cur->next, i++) { + ret[i] = g_strdup ((gchar *) cur->data); + } + g_list_free (reqs); + + g_mutex_unlock (document->priv->mutex); + + return ret; +} + /******************************************************************************/ const gchar * |