summaryrefslogtreecommitdiff
path: root/src/yelp-docbook.c
diff options
context:
space:
mode:
authorShaun McCance <shaunm@src.gnome.org>2007-04-12 20:48:06 +0000
committerShaun McCance <shaunm@src.gnome.org>2007-04-12 20:48:06 +0000
commitd8a524caf459b1203e6a7ea134380f5ca4af4f1a (patch)
treecb2a55b8fae2bd9d20f1b730ce36638afb2fc6fe /src/yelp-docbook.c
parent016f1e4c0a50bad7b3f814cee5e30e4984ff47db (diff)
downloadyelp-document.tar.gz
- Made man pages work with YelpDocumentyelp-document
* src/Makefile.am: * src/yelp-man.c: * src/yelp-man.h: * src/test-document.c: - Made man pages work with YelpDocument * src/yelp-docbook.c: * src/yelp-document.c: - General clean up svn path=/branches/yelp-document/; revision=2802
Diffstat (limited to 'src/yelp-docbook.c')
-rw-r--r--src/yelp-docbook.c37
1 files changed, 18 insertions, 19 deletions
diff --git a/src/yelp-docbook.c b/src/yelp-docbook.c
index c7db98dc..384c6a40 100644
--- a/src/yelp-docbook.c
+++ b/src/yelp-docbook.c
@@ -41,19 +41,6 @@
#define YELP_DOCBOOK_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), YELP_TYPE_DOCBOOK, YelpDocbookPriv))
-typedef struct _Request Request;
-struct _Request {
- YelpDocbook *document;
- YelpDocumentFunc func;
- gpointer user_data;
-
- gint req_id;
- gchar *page_id;
-
- gint idle_funcs;
- gboolean cancel;
-};
-
typedef enum {
DOCBOOK_STATE_BLANK, /* Brand new, run transform as needed */
DOCBOOK_STATE_PARSING, /* Parsing/transforming document, please wait */
@@ -348,6 +335,7 @@ transform_page_func (YelpTransform *transform,
debug_print (DB_FUNCTION, "entering\n");
priv = docbook->priv;
+ g_mutex_lock (priv->mutex);
content = yelp_transform_eat_chunk (transform, page_id);
@@ -451,26 +439,36 @@ docbook_process (YelpDocbook *docbook)
priv->xmlcur = xmlDocGetRootElement (xmldoc);
id = xmlGetProp (priv->xmlcur, BAD_CAST "id");
- if (id)
+ if (id) {
yelp_document_set_root_id (document, (gchar *) id);
+ yelp_document_add_page_id (document, "x-yelp-index", (gchar *) id);
+ yelp_document_add_prev_id (document, (gchar *) id, "x-yelp-titlepage");
+ yelp_document_add_next_id (document, "x-yelp-titlepage", (gchar *) id);
+ }
else {
- yelp_document_set_root_id (document, "index");
+ yelp_document_set_root_id (document, "x-yelp-index");
+ yelp_document_add_page_id (document, "x-yelp-index", "x-yelp-index");
+ yelp_document_add_prev_id (document, "x-yelp-index", "x-yelp-titlepage");
+ yelp_document_add_next_id (document, "x-yelp-titlepage", "x-yelp-index");
/* add the id attribute to the root element with value "index"
* so when we try to load the document later, it doesn't fail */
- xmlNewProp (priv->xmlcur, BAD_CAST "id", BAD_CAST "index");
+ xmlNewProp (priv->xmlcur, BAD_CAST "id", BAD_CAST "x-yelp-index");
}
g_mutex_unlock (priv->mutex);
g_mutex_lock (priv->mutex);
- if (priv->state == DOCBOOK_STATE_STOP)
+ if (priv->state == DOCBOOK_STATE_STOP) {
+ g_mutex_unlock (priv->mutex);
goto done;
- g_mutex_unlock (priv->mutex);
+ }
docbook_walk (docbook);
g_mutex_lock (priv->mutex);
- if (priv->state == DOCBOOK_STATE_STOP)
+ if (priv->state == DOCBOOK_STATE_STOP) {
+ g_mutex_unlock (priv->mutex);
goto done;
+ }
priv->transform = yelp_transform_new (STYLESHEET,
(YelpTransformFunc) transform_func,
@@ -489,6 +487,7 @@ docbook_process (YelpDocbook *docbook)
xmlFreeParserCtxt (parserCtxt);
priv->process_running = FALSE;
+ g_object_unref (docbook);
}