diff options
author | Shaun McCance <shaunm@src.gnome.org> | 2004-12-31 10:04:15 +0000 |
---|---|---|
committer | Shaun McCance <shaunm@src.gnome.org> | 2004-12-31 10:04:15 +0000 |
commit | 2402f576cb48ba1e0bac801c203f16beff2ee9aa (patch) | |
tree | f7349444196bfd57b547fb0280bed58f4b8a98f5 /src | |
parent | 9406f4b86c14030626187c1f3d5d3613643ec1e4 (diff) | |
download | yelp-2402f576cb48ba1e0bac801c203f16beff2ee9aa.tar.gz |
- Adding yelp-info-pager.[ch]
* src/Makefile.am:
* src/yelp-info-pager.c:
* src/yelp-info-pager.h:
* src/yelp-window.c:
- Adding yelp-info-pager.[ch]
* src/yelp-man-pager.c:
- Some cleanups
* stylesheets/Makefile.am:
* stylesheets/info2html.xsl:
- Adding info2html.xsl
* stylesheets/db2html.xsl.in:
* stylesheets/man2html.xsl:
- Minor stylistic stuff
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 7 | ||||
-rw-r--r-- | src/yelp-info-pager.c | 192 | ||||
-rw-r--r-- | src/yelp-info-pager.h | 55 | ||||
-rw-r--r-- | src/yelp-man-pager.c | 7 | ||||
-rw-r--r-- | src/yelp-window.c | 5 |
5 files changed, 258 insertions, 8 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 0cbd70ee..67126fca 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -7,6 +7,12 @@ else man_sources = endif +if ENABLE_INFO +info_sources = yelp-info-pager.c yelp-info-pager.h +else +info_sources = +endif + INCLUDES = \ -I$(top_srcdir) \ $(YELP_CFLAGS) \ @@ -70,6 +76,7 @@ test_uri_LDADD = @YELP_LIBS@ yelp_SOURCES = \ $(gnome_yelp_idl_sources) \ + $(info_sources) \ $(man_sources) \ yelp-base.c yelp-base.h \ yelp-bookmarks.c yelp-bookmarks.h \ diff --git a/src/yelp-info-pager.c b/src/yelp-info-pager.c new file mode 100644 index 00000000..fcce2202 --- /dev/null +++ b/src/yelp-info-pager.c @@ -0,0 +1,192 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* + * Copyright (C) 2003 Shaun McCance <shaunm@gnome.org> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: Shaun McCance <shaunm@gnome.org> + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <glib.h> +#include <libgnome/gnome-i18n.h> +#include <libxml/parser.h> +#include <libxml/parserInternals.h> +#include <libxslt/xslt.h> +#include <libxslt/templates.h> +#include <libxslt/transform.h> +#include <libxslt/extensions.h> +#include <libxslt/xsltInternals.h> +#include <libxslt/xsltutils.h> + +#include "yelp-error.h" +#include "yelp-info-pager.h" +#include "yelp-settings.h" + +#define INFO_STYLESHEET_PATH DATADIR"/sgml/docbook/yelp/" +#define INFO_STYLESHEET INFO_STYLESHEET_PATH"info2html.xsl" + +struct _YelpInfoPagerPriv { + gpointer unused; +}; + +static void info_pager_class_init (YelpInfoPagerClass *klass); +static void info_pager_init (YelpInfoPager *pager); +static void info_pager_dispose (GObject *gobject); + +static xmlDocPtr info_pager_parse (YelpPager *pager); +static gchar ** info_pager_params (YelpPager *pager); + +static const gchar * info_pager_resolve_frag (YelpPager *pager, + const gchar *frag_id); +static GtkTreeModel * info_pager_get_sections (YelpPager *pager); + +static YelpPagerClass *parent_class; + +GType +yelp_info_pager_get_type (void) +{ + static GType type = 0; + + if (!type) { + static const GTypeInfo info = { + sizeof (YelpInfoPagerClass), + NULL, + NULL, + (GClassInitFunc) info_pager_class_init, + NULL, + NULL, + sizeof (YelpInfoPager), + 0, + (GInstanceInitFunc) info_pager_init, + }; + type = g_type_register_static (YELP_TYPE_XSLT_PAGER, + "YelpInfoPager", + &info, 0); + } + return type; +} + +static void +info_pager_class_init (YelpInfoPagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + YelpPagerClass *pager_class = YELP_PAGER_CLASS (klass); + YelpXsltPagerClass *xslt_class = YELP_XSLT_PAGER_CLASS (klass); + + parent_class = g_type_class_peek_parent (klass); + + object_class->dispose = info_pager_dispose; + + pager_class->resolve_frag = info_pager_resolve_frag; + pager_class->get_sections = info_pager_get_sections; + + xslt_class->parse = info_pager_parse; + xslt_class->params = info_pager_params; + + xslt_class->stylesheet = INFO_STYLESHEET; +} + +static void +info_pager_init (YelpInfoPager *pager) +{ + YelpInfoPagerPriv *priv; + + priv = g_new0 (YelpInfoPagerPriv, 1); + pager->priv = priv; +} + +static void +info_pager_dispose (GObject *object) +{ + YelpInfoPager *pager = YELP_INFO_PAGER (object); + + g_free (pager->priv); + + G_OBJECT_CLASS (parent_class)->dispose (object); +} + +/******************************************************************************/ + +YelpPager * +yelp_info_pager_new (YelpDocInfo *doc_info) +{ + YelpInfoPager *pager; + + g_return_val_if_fail (doc_info != NULL, NULL); + + pager = (YelpInfoPager *) g_object_new (YELP_TYPE_INFO_PAGER, + "document-info", doc_info, + NULL); + + return (YelpPager *) pager; +} + +static xmlDocPtr +info_pager_parse (YelpPager *pager) +{ + YelpDocInfo *doc_info; + gchar *filename; + xmlDocPtr doc; + GError *error; + + g_return_val_if_fail (YELP_IS_INFO_PAGER (pager), FALSE); + + doc_info = yelp_pager_get_doc_info (pager); + filename = yelp_doc_info_get_filename (doc_info); + + g_object_ref (pager); + + /* DO STUFF HERE */ + + g_object_unref (pager); + + return doc; +} + +static gchar ** +info_pager_params (YelpPager *pager) +{ + gchar **params; + gint params_i = 0; + gint params_max = 10; + + params = g_new0 (gchar *, params_max); + + params[params_i++] = "stylesheet_path"; + params[params_i++] = g_strdup_printf ("\"file://%s\"", INFO_STYLESHEET_PATH); + + params[params_i] = NULL; + + return params; +} + +static const gchar * +info_pager_resolve_frag (YelpPager *pager, const gchar *frag_id) +{ + /* DO SOMETHING ELSE HERE */ + return NULL; +} + +static GtkTreeModel * +info_pager_get_sections (YelpPager *pager) +{ + /* RETURN THE TREE STORE HERE */ + return NULL; +} diff --git a/src/yelp-info-pager.h b/src/yelp-info-pager.h new file mode 100644 index 00000000..227d1f92 --- /dev/null +++ b/src/yelp-info-pager.h @@ -0,0 +1,55 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* + * Copyright (C) 2003 Shaun McCance <shaunm@gnome.org> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: Shaun McCance <shaunm@gnome.org> + */ + +#ifndef __YELP_INFO_PAGER_H__ +#define __YELP_INFO_PAGER_H__ + +#include <glib-object.h> + +#include "yelp-pager.h" +#include "yelp-xslt-pager.h" + +#define YELP_TYPE_INFO_PAGER (yelp_info_pager_get_type ()) +#define YELP_INFO_PAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), YELP_TYPE_INFO_PAGER, YelpInfoPager)) +#define YELP_INFO_PAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), YELP_TYPE_INFO_PAGER, YelpInfoPagerClass)) +#define YELP_IS_INFO_PAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), YELP_TYPE_INFO_PAGER)) +#define YELP_IS_INFO_PAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), YELP_TYPE_INFO_PAGER)) +#define YELP_INFO_PAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), YELP_TYPE_INFO_PAGER, YelpInfoPagerClass)) + +typedef struct _YelpInfoPager YelpInfoPager; +typedef struct _YelpInfoPagerClass YelpInfoPagerClass; +typedef struct _YelpInfoPagerPriv YelpInfoPagerPriv; + +struct _YelpInfoPager { + YelpXsltPager parent; + + YelpInfoPagerPriv *priv; +}; + +struct _YelpInfoPagerClass { + YelpXsltPagerClass parent_class; +}; + +GType yelp_info_pager_get_type (void); +YelpPager * yelp_info_pager_new (YelpDocInfo *doc_info); + +#endif /* __YELP_INFO_PAGER_H__ */ diff --git a/src/yelp-man-pager.c b/src/yelp-man-pager.c index 0563a2ce..21dfaff0 100644 --- a/src/yelp-man-pager.c +++ b/src/yelp-man-pager.c @@ -39,17 +39,10 @@ #include "yelp-man-pager.h" #include "yelp-man-parser.h" #include "yelp-settings.h" -#include "yelp-toc-pager.h" - -#define YELP_NAMESPACE "http://www.gnome.org/yelp/ns" #define MAN_STYLESHEET_PATH DATADIR"/sgml/docbook/yelp/" #define MAN_STYLESHEET MAN_STYLESHEET_PATH"man2html.xsl" -#define MAX_CHUNK_DEPTH 2 - -#define d(x) - struct _YelpManPagerPriv { gpointer unused; }; diff --git a/src/yelp-window.c b/src/yelp-window.c index 9cafe12c..4a0fdbb5 100644 --- a/src/yelp-window.c +++ b/src/yelp-window.c @@ -51,6 +51,9 @@ #ifdef ENABLE_MAN #include "yelp-man-pager.h" #endif +#ifdef ENABLE_INFO +#include "yelp-info-pager.h" +#endif #ifdef YELP_DEBUG #define d(x) x @@ -1061,7 +1064,7 @@ window_do_load_pager (YelpWindow *window, break; #ifdef ENABLE_INFO case YELP_DOC_TYPE_INFO: - // FIXME: yelp_info_pager_new (doc_info); + pager = yelp_info_pager_new (doc_info); break; #endif #ifdef ENABLE_MAN |