diff options
author | Alex Larsson <alexl@redhat.com> | 2002-01-25 21:56:52 +0000 |
---|---|---|
committer | Alexander Larsson <alexl@src.gnome.org> | 2002-01-25 21:56:52 +0000 |
commit | fe02758aee9349518cd774a312c5bc2ce730a4c9 (patch) | |
tree | f62d4412ce90b89a5ca4310c13a70ea42c801980 | |
parent | 09932aa2d236f5fd8853582d2c1e0e7941b82ff2 (diff) | |
download | yelp-fe02758aee9349518cd774a312c5bc2ce730a4c9.tar.gz |
New file.
2002-01-25 Alex Larsson <alexl@redhat.com>
* important_docs.xml:
New file.
* Makefile.am:
Install important_docs.xml
* src/yelp-view-toc.c:
Parse important_docs.xml instead of hardcoding them
* configure.in:
Remove "hu" from ALL_LINGUAS, as it breaks the build.
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | Makefile.am | 5 | ||||
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | important_docs.xml | 5 | ||||
-rw-r--r-- | src/yelp-view-toc.c | 76 |
5 files changed, 81 insertions, 21 deletions
@@ -1,3 +1,17 @@ +2002-01-25 Alex Larsson <alexl@redhat.com> + + * important_docs.xml: + New file. + + * Makefile.am: + Install important_docs.xml + + * src/yelp-view-toc.c: + Parse important_docs.xml instead of hardcoding them + + * configure.in: + Remove "hu" from ALL_LINGUAS, as it breaks the build. + 2002-01-25 Ole Laursen <olau@hardworking.dk> * configure.in: Added "da" to ALL_LINGUAS. diff --git a/Makefile.am b/Makefile.am index 4c5df1ed..f6564f55 100644 --- a/Makefile.am +++ b/Makefile.am @@ -8,11 +8,16 @@ DESKTOP_FILES=$(DESKTOP_IN_FILES:.desktop.in=.desktop) Applicationsdir = $(datadir)/applications Applications_DATA = $(DESKTOP_FILES) +yelpdatadir = $(datadir)/yelp +yelpdata_DATA = important_docs.xml + + EXTRA_DIST = \ intltool-extract.in \ intltool-merge.in \ intltool-update.in \ idl/GNOME_Yelp.idl \ + important_docs.xml \ $(DESKTOP_IN_FILES) \ $(DESKTOP_FILES) diff --git a/configure.in b/configure.in index e2d5b344..a5e51b6b 100644 --- a/configure.in +++ b/configure.in @@ -28,7 +28,7 @@ GETTEXT_PACKAGE=yelp AC_SUBST(GETTEXT_PACKAGE) AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE") -ALL_LINGUAS="az bg da de es hu ms nl no lv pt sk sv tr uk wa" +ALL_LINGUAS="az bg da de es ms nl no lv pt sk sv tr uk wa" AM_GLIB_GNU_GETTEXT if test "x$prefix" = "xNONE"; then diff --git a/important_docs.xml b/important_docs.xml new file mode 100644 index 00000000..a8b014d9 --- /dev/null +++ b/important_docs.xml @@ -0,0 +1,5 @@ +<docs> + <document seriesid="01ddeea4-0a42-11d6-9cf9-ee43c422358d"/> + <document seriesid="01ddeea4-0a42-11d6-9cf9-ee43c422358e"/> + <document seriesid="2d0b7a0c-11d0-11d6-8146-ca25164c0f62"/> +</docs> diff --git a/src/yelp-view-toc.c b/src/yelp-view-toc.c index 16a6765a..cb927505 100644 --- a/src/yelp-view-toc.c +++ b/src/yelp-view-toc.c @@ -39,14 +39,15 @@ #define d(x) x #undef DEBUG_OUTPUT -static void yvh_init (YelpViewTOC *html); -static void yvh_class_init (YelpViewTOCClass *klass); -static void yvh_link_clicked_cb (HtmlDocument *doc, - const gchar *url, - YelpViewTOC *view); -static void yelp_view_toc_man_1 (YelpViewTOC *view); -static void yelp_view_toc_man_2 (YelpViewTOC *view, - GNode *root); +static void yvh_init (YelpViewTOC *html); +static void yvh_class_init (YelpViewTOCClass *klass); +static void yvh_link_clicked_cb (HtmlDocument *doc, + const gchar *url, + YelpViewTOC *view); +static void yelp_view_toc_man_1 (YelpViewTOC *view); +static void yelp_view_toc_man_2 (YelpViewTOC *view, + GNode *root); +static void yelp_view_read_important_docs (YelpViewTOC *view); enum { URL_SELECTED, @@ -59,6 +60,7 @@ struct _YelpViewTOCPriv { GtkWidget *html_view; HtmlDocument *doc; GNode *doc_tree; + GList *important_docs; }; GType @@ -97,6 +99,8 @@ yvh_init (YelpViewTOC *view) priv = g_new0 (YelpViewTOCPriv, 1); view->priv = priv; + yelp_view_read_important_docs (view); + priv->doc = html_document_new (); html_view_set_document (HTML_VIEW (view), priv->doc); @@ -229,16 +233,10 @@ yelp_view_toc_start (YelpViewTOC *view) </table> </center> "; - /* FIXME: Hardcoded crap: */ - char *seriesids[] = { - "01ddeea4-0a42-11d6-9cf9-ee43c422358d", - "01ddeea4-0a42-11d6-9cf9-ee43c422358e", - NULL - }; char *seriesid; - char **p; GNode *root; char *path; + GList *list; priv = view->priv; @@ -257,10 +255,9 @@ yelp_view_toc_start (YelpViewTOC *view) "<h2>Important documents</h2>\n" "<ul>\n", -1); - p = &seriesids[0]; - while (*p != NULL) { - seriesid = *p; - p++; + list = priv->important_docs; + while (list != NULL) { + seriesid = list->data; node = yelp_scrollkeeper_lookup_seriesid (seriesid); if (node) { @@ -270,6 +267,7 @@ yelp_view_toc_start (YelpViewTOC *view) section->uri, section->name); } + list = list->next; } @@ -516,6 +514,44 @@ yelp_view_toc_info (YelpViewTOC *view) yelp_view_toc_close (view); } +static void +yelp_view_read_important_docs (YelpViewTOC *view) +{ + xmlDocPtr doc; + xmlNodePtr node; + xmlNodePtr child; + xmlChar *prop; + + doc = xmlParseFile (DATADIR "/yelp/important_docs.xml"); + if (doc == NULL) + return; + + node = xmlDocGetRootElement (doc); + if (node == NULL) { + xmlFreeDoc(doc); + return; + } + + if (strcmp (node->name, "docs") != 0) { + xmlFreeDoc(doc); + return; + } + + child = node->children; + while (child) { + if (strcmp (child->name, "document") == 0) { + + prop = xmlGetProp (child, "seriesid"); + if (prop) { + view->priv->important_docs = g_list_append (view->priv->important_docs, g_strdup (prop)); + xmlFree (prop); + } + } + child = child->next; + } + + xmlFreeDoc(doc); +} GtkWidget * yelp_view_toc_new (GNode *doc_tree) @@ -530,7 +566,7 @@ yelp_view_toc_new (GNode *doc_tree) priv->doc_tree = doc_tree; yelp_view_toc_open_url (view, "toc:"); - + return GTK_WIDGET (view); } |