summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Hallendal <micke@codefactory.se>2002-04-11 09:32:37 +0000
committerMikael Hallendal <hallski@src.gnome.org>2002-04-11 09:32:37 +0000
commit7818d90f52784b94b05728a391062f2fee58ac6c (patch)
treeccbe7032107fcc37cf62debdd074e7aaae6fe0e2
parentfa0926bc3ca9f1557337f8c47c3a85b1aaad95f9 (diff)
downloadyelp-7818d90f52784b94b05728a391062f2fee58ac6c.tar.gz
- did some cleanups - make output in first page look nicer. - Changed a
2002-04-11 Mikael Hallendal <micke@codefactory.se> * src/yelp-view-toc.c: - did some cleanups - make output in first page look nicer. - Changed a few strings, SORRY!! Fixes: #73439 * src/yelp-view-content.c (yelp_view_content_stop): added/impl. * src/yelp-util.c: (tree_find_node_uri): renamed from tree_find_node. (yelp_util_find_node_from_name): added/impl. (tree_find_node_name): added/impl. * src/yelp-html.c: (yh_init): set content-type to utf8 on the loading document. (yelp_html_cancel_loading): added, doesn't do anything yet.
-rw-r--r--ChangeLog18
-rw-r--r--src/yelp-base.c2
-rw-r--r--src/yelp-html.c31
-rw-r--r--src/yelp-html.h3
-rw-r--r--src/yelp-util.c40
-rw-r--r--src/yelp-util.h5
-rw-r--r--src/yelp-view-content.c9
-rw-r--r--src/yelp-view-content.h1
-rw-r--r--src/yelp-view-toc.c331
-rw-r--r--src/yelp-window.c5
10 files changed, 382 insertions, 63 deletions
diff --git a/ChangeLog b/ChangeLog
index 2d580328..b92d7f20 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2002-04-11 Mikael Hallendal <micke@codefactory.se>
+
+ * src/yelp-view-toc.c:
+ - did some cleanups
+ - make output in first page look nicer.
+ - Changed a few strings, SORRY!! Fixes: #73439
+
+ * src/yelp-view-content.c (yelp_view_content_stop): added/impl.
+
+ * src/yelp-util.c:
+ (tree_find_node_uri): renamed from tree_find_node.
+ (yelp_util_find_node_from_name): added/impl.
+ (tree_find_node_name): added/impl.
+
+ * src/yelp-html.c:
+ (yh_init): set content-type to utf8 on the loading document.
+ (yelp_html_cancel_loading): added, doesn't do anything yet.
+
2002-04-10 Richard Hult <rhult@codefactory.se>
* src/yelp-view-index.c (yelp_view_index_new): Add a bit of
diff --git a/src/yelp-base.c b/src/yelp-base.c
index 11605978..bbb1e82e 100644
--- a/src/yelp-base.c
+++ b/src/yelp-base.c
@@ -34,7 +34,7 @@
#include "yelp-base.h"
typedef struct {
- YelpBase *base;
+ YelpBase *base;
GtkTreeIter *parent;
} ForeachData;
diff --git a/src/yelp-html.c b/src/yelp-html.c
index 42c861e6..682296b9 100644
--- a/src/yelp-html.c
+++ b/src/yelp-html.c
@@ -127,7 +127,6 @@ yh_init (YelpHtml *view)
priv->doc = html_document_new ();
priv->connections = NULL;
priv->base_uri = g_strdup ("");
-
priv->load_doc = html_document_new ();
html_document_open_stream (priv->load_doc, "text/html");
@@ -135,7 +134,7 @@ yh_init (YelpHtml *view)
{
gint len;
gchar *str = _("Loading...");
- gchar *text = g_strdup_printf ("<html><body bgcolor=\"white\"><center>%s</center></body></html>", str);
+ gchar *text = g_strdup_printf ("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"></head><body bgcolor=\"white\"><center>%s</center></body></html>", str);
len = strlen (text);
html_document_write_stream (priv->load_doc, text, len);
@@ -180,12 +179,14 @@ yh_async_close_cb (GnomeVFSAsyncHandle *handle,
GnomeVFSResult result,
gpointer callback_data)
{
- StreamData *sdata;
-
+ StreamData *sdata;
+ YelpHtmlPriv *priv;
+
d(puts(G_GNUC_FUNCTION));
sdata = (StreamData *) callback_data;
-
+ priv = sdata->view->priv;
+
if (sdata->anchor) {
html_view_jump_to_anchor (HTML_VIEW (sdata->view),
sdata->anchor);
@@ -202,14 +203,16 @@ yh_async_read_cb (GnomeVFSAsyncHandle *handle,
GnomeVFSFileSize bytes_read,
gpointer callback_data)
{
- StreamData *sdata;
- YelpHtml *view;
+ StreamData *sdata;
+ YelpHtml *view;
+ YelpHtmlPriv *priv;
d(puts(G_GNUC_FUNCTION));
sdata = (StreamData *) callback_data;
view = sdata->view;
-
+ priv = view->priv;
+
if (result != GNOME_VFS_OK) {
gnome_vfs_async_close (handle,
yh_async_close_cb,
@@ -234,11 +237,13 @@ yh_async_open_cb (GnomeVFSAsyncHandle *handle,
GnomeVFSResult result,
gpointer callback_data)
{
- StreamData *sdata;
+ StreamData *sdata;
+ YelpHtmlPriv *priv;
d(puts(G_GNUC_FUNCTION));
sdata = (StreamData *) callback_data;
+ priv = sdata->view->priv;
if (result != GNOME_VFS_OK) {
g_warning ("Open failed: %s.\n",
@@ -428,6 +433,7 @@ yelp_html_open_uri (YelpHtml *view,
html_view_set_document (HTML_VIEW (view), priv->load_doc);
/* New document needs to be read. */
+
g_free (priv->base_uri);
priv->base_uri = g_strdup (docpath);
@@ -441,7 +447,7 @@ yelp_html_open_uri (YelpHtml *view,
sdata->view = view;
sdata->stream = priv->doc->current_stream;
sdata->anchor = NULL;
-
+
priv->connections = g_slist_prepend (priv->connections, sdata);
uri = gnome_vfs_uri_new (docpath);
@@ -467,3 +473,8 @@ yelp_html_open_uri (YelpHtml *view,
yh_stream_cancel,
sdata);
}
+
+void
+yelp_html_cancel_loading (YelpHtml *view)
+{
+}
diff --git a/src/yelp-html.h b/src/yelp-html.h
index a68a6e10..8e18b617 100644
--- a/src/yelp-html.h
+++ b/src/yelp-html.h
@@ -40,7 +40,7 @@ typedef struct _YelpHtmlClass YelpHtmlClass;
typedef struct _YelpHtmlPriv YelpHtmlPriv;
struct _YelpHtml {
- HtmlView parent;
+ HtmlView parent;
YelpHtmlPriv *priv;
};
@@ -61,6 +61,7 @@ GtkWidget *yelp_html_new (void);
void yelp_html_open_uri (YelpHtml *view,
const gchar *uri,
const gchar *reference);
+void yelp_html_cancel_loading (YelpHtml *view);
#endif /* __YELP_HTML_H__ */
diff --git a/src/yelp-util.c b/src/yelp-util.c
index b1120057..862a66a6 100644
--- a/src/yelp-util.c
+++ b/src/yelp-util.c
@@ -416,8 +416,7 @@ yelp_util_compose_path_url (GNode *node,
GNode *
-yelp_util_find_toplevel (GNode *doc_tree,
- gchar *name)
+yelp_util_find_toplevel (GNode *doc_tree, const gchar *name)
{
GNode *node;
YelpSection *section;
@@ -439,7 +438,40 @@ yelp_util_find_toplevel (GNode *doc_tree,
static GNode *found_node;
static gboolean
-tree_find_node (GNode *node, const gchar *uri)
+tree_find_node_name (GNode *node, const gchar *name)
+{
+ YelpSection *section;
+
+ section = YELP_SECTION (node->data);
+
+ if (!section || !section->name) {
+ return FALSE;
+ }
+
+ if (!g_ascii_strcasecmp (name, section->name)) {
+ found_node = node;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+GNode *
+yelp_util_find_node_from_name (GNode *doc_tree, const gchar *name)
+{
+ found_node = NULL;
+
+ g_node_traverse (doc_tree, G_IN_ORDER,
+ G_TRAVERSE_ALL,
+ -1,
+ (GNodeTraverseFunc) tree_find_node_name,
+ (gchar *) name);
+
+ return found_node;
+}
+
+static gboolean
+tree_find_node_uri (GNode *node, const gchar *uri)
{
YelpSection *section;
@@ -465,7 +497,7 @@ yelp_util_find_node_from_uri (GNode *doc_tree, const gchar *uri)
g_node_traverse (doc_tree, G_IN_ORDER,
G_TRAVERSE_ALL,
-1,
- (GNodeTraverseFunc) tree_find_node,
+ (GNodeTraverseFunc) tree_find_node_uri,
(gchar *) uri);
return found_node;
diff --git a/src/yelp-util.h b/src/yelp-util.h
index dbce0b91..424f5af1 100644
--- a/src/yelp-util.h
+++ b/src/yelp-util.h
@@ -39,7 +39,10 @@ gchar * yelp_util_compose_path_url (GNode *node,
const gchar *embedded_url);
GNode * yelp_util_find_toplevel (GNode *doc_tree,
- gchar *name);
+ const gchar *name);
+
+GNode * yelp_util_find_node_from_name (GNode *doc_tree,
+ const gchar *name);
GNode * yelp_util_find_node_from_uri (GNode *doc_tree,
const gchar *uri);
diff --git a/src/yelp-view-content.c b/src/yelp-view-content.c
index 2a32deb1..c9edfbc4 100644
--- a/src/yelp-view-content.c
+++ b/src/yelp-view-content.c
@@ -345,3 +345,12 @@ yelp_view_content_show_uri (YelpViewContent *content,
g_free (content_url);
}
}
+
+void
+yelp_view_content_stop (YelpViewContent *content)
+{
+ g_return_if_fail (YELP_IS_VIEW_CONTENT (content));
+
+ yelp_html_cancel_loading (YELP_HTML (content->priv->html_view));
+}
+
diff --git a/src/yelp-view-content.h b/src/yelp-view-content.h
index 0284c54b..373b5068 100644
--- a/src/yelp-view-content.h
+++ b/src/yelp-view-content.h
@@ -58,5 +58,6 @@ GtkWidget *yelp_view_content_new (GNode *doc_tree);
void yelp_view_content_show_uri (YelpViewContent *content,
const gchar *uri);
+void yelp_view_content_stop (YelpViewContent *content);
#endif /* __YELP_VIEW_CONTENT__ */
diff --git a/src/yelp-view-toc.c b/src/yelp-view-toc.c
index 60096f6c..9c584beb 100644
--- a/src/yelp-view-toc.c
+++ b/src/yelp-view-toc.c
@@ -37,8 +37,7 @@
#include "yelp-util.h"
#include "yelp-scrollkeeper.h"
-#define d(x) x
-#undef DEBUG_OUTPUT
+#define d(x)
static void yvh_init (YelpViewTOC *html);
static void yvh_class_init (YelpViewTOCClass *klass);
@@ -73,6 +72,58 @@ struct _YelpViewTOCPriv {
int buffer_pos;
};
+/* HTML generation stuff */
+#define BG_COLOR "#ffffff"
+#define BLOCK_BG_COLOR "#c1c1c1"
+#define HELP_IMAGE "file:///gnome/head/INSTALL/share/pixmaps/gnome-help.png"
+
+#define COLUMN_LEFT_START "<td valign=\"top\" width=\"50%\"> \
+ <table cellpadding=\"0\" \
+ border=\"0\" \
+ align=\"left\" \
+ cellspacing=\"0\" \
+ width=\"100%\"> \
+ <tr> \
+ <td>"
+#define COLUMN_RIGHT_START "<td valign=\"top\"> \
+ <table cellpadding=\"0\" \
+ border=\"0\" \
+ align=\"right\" \
+ cellspacing=\"0\" \
+ width=\"100%\"> \
+ <tr> \
+ <td>"
+
+#define COLUMN_END " \
+ </td> \
+ </tr> \
+ </table> \
+ </td>"
+
+#define TOC_BLOCK_START " \
+ <table cellpadding=\"5\" \
+ border=\"0\" \
+ align=\"left\" \
+ cellspacing=\"0\" \
+ width=\"100%\" \
+ bgcolor=\"" BLOCK_BG_COLOR "\"> \
+ <tr> \
+ <td>"
+
+#define TOC_BLOCK_END " \
+ </td> \
+ </tr> \
+ </table> "
+
+#define TOC_BLOCK_SEPARATOR " \
+ </td> \
+ </tr> \
+ <tr>
+ <td>&nbsp;</td>
+ </tr>
+ <tr>\
+ <td>"
+
GType
yelp_view_toc_get_type (void)
{
@@ -176,9 +227,7 @@ yelp_view_toc_write (YelpViewTOC *view, char *data, int len)
len = strlen (data);
}
-#ifdef DEBUG_OUTPUT
- g_print ("%.*s", len,data);
-#endif
+ d(g_print ("%.*s", len,data));
while (len > 0) {
chunk_size = MIN (BUFFER_SIZE - priv->buffer_pos, len);
@@ -189,28 +238,29 @@ yelp_view_toc_write (YelpViewTOC *view, char *data, int len)
data += chunk_size;
if (priv->buffer_pos == BUFFER_SIZE) {
- html_document_write_stream (priv->doc, priv->buffer, BUFFER_SIZE);
+ html_document_write_stream (priv->doc,
+ priv->buffer,
+ BUFFER_SIZE);
priv->buffer_pos = 0;
}
-
}
}
static void
yelp_view_toc_printf (YelpViewTOC *view, char *format, ...)
{
- va_list args;
- gchar *string;
-
- g_return_if_fail (format != NULL);
-
- va_start (args, format);
- string = g_strdup_vprintf (format, args);
- va_end (args);
-
- yelp_view_toc_write (view, string, -1);
-
- g_free (string);
+ va_list args;
+ gchar *string;
+
+ g_return_if_fail (format != NULL);
+
+ va_start (args, format);
+ string = g_strdup_vprintf (format, args);
+ va_end (args);
+
+ yelp_view_toc_write (view, string, -1);
+
+ g_free (string);
}
static void
@@ -224,13 +274,15 @@ yelp_view_toc_write_header (YelpViewTOC *view, char *title)
" %s\n"
" </title> \n"
" <style type=\"text/css\">\n"
-" A:link { color: #00008b }\n"
-" A:visited { color: #00008b }\n"
-" A:active { color: #00008b }\n"
-" BODY { color: #00008b }\n"
+" A:link { color: #00008b; font-size: 10 }\n"
+" A:visited { color: #00008b; font-size: 10}\n"
+" A:active { color: #00008b; font-size: 10}\n"
+" h1 { font-size: 25 }\n"
+" h2 { font-size: 15 }\n"
+" BODY { color: #000000; font-size: 10 }\n"
" </style>\n"
" </head>\n"
-" <body bgcolor=\"#ffffff\">";
+" <body bgcolor=\"" BG_COLOR "\">";
char *s;
s = g_strdup_printf (header, title);
@@ -256,6 +308,199 @@ yelp_view_toc_start (YelpViewTOC *view)
YelpViewTOCPriv *priv;
GNode *node;
YelpSection *section;
+ char *seriesid;
+ GNode *root;
+ char *path;
+ GList *sections, *seriesids;
+ gchar *page_title = _("Get help on...");
+ gchar *section_gnome = _("GNOME - Desktop");
+ gchar *section_additional = _("Additional documents");
+ gchar *man_string = _("Manual pages");
+ gchar *info_string = _("Info pages");
+ YelpImportantDocsSection *important_section;
+ gboolean important_doc_installed = FALSE;
+ gboolean left_column_started = FALSE;
+
+ priv = view->priv;
+
+ if (!g_node_first_child (priv->doc_tree)) {
+ g_warning ("No nodes in tree");
+ }
+
+ yelp_view_toc_open (view);
+
+ yelp_view_toc_write_header (view, page_title);
+
+ yelp_view_toc_printf (view,
+ "<table cellpadding=\"0\""
+ "border=\"0\""
+ "align=\"center\""
+ "cellspacing=\"10\""
+ "width=\"100%\">"
+ "<tr align=\"left\""
+ " valign=\"top\""
+ " bgcolor=\"" BG_COLOR "\">"
+ "<td height=\"69\""
+ " align=\"center\""
+ " valign=\"center\""
+ " bgcolor=\"" BLOCK_BG_COLOR "\""
+ " colspan=\"2\">"
+ " <h1>"
+ " %s"
+ " </h1>"
+ "</td>"
+ "</tr>"
+ "<tr>",
+ page_title);
+
+ sections = priv->important_sections;
+
+ while (sections != NULL) {
+ important_section = sections->data;
+
+ seriesids = important_section->seriesids;
+
+ /* Check if any of the important documents are installed *
+ * before trying to write the section topic */
+
+ for (seriesids = important_section->seriesids;
+ seriesids;
+ seriesids = seriesids->next) {
+ seriesid = seriesids->data;
+
+ if (yelp_scrollkeeper_lookup_seriesid (seriesid)){
+ important_doc_installed = TRUE;
+ }
+ }
+
+ if (important_doc_installed) {
+ if (!left_column_started) {
+ yelp_view_toc_printf (view,
+ COLUMN_LEFT_START);
+ left_column_started = TRUE;
+ }
+
+ yelp_view_toc_printf (view,
+ TOC_BLOCK_SEPARATOR
+ TOC_BLOCK_START
+ "<h2>%s</h2>",
+ important_section->title);
+ }
+
+ seriesids = important_section->seriesids;
+
+ while (seriesids != NULL) {
+ seriesid = seriesids->data;
+
+ node = yelp_scrollkeeper_lookup_seriesid (seriesid);
+
+ if (node) {
+ section = node->data;
+ yelp_view_toc_printf (view,
+ "<a href=\"%s\">%s</a>\n",
+ section->uri, section->name);
+ }
+
+ seriesids = seriesids->next;
+ }
+
+ if (important_doc_installed) {
+ yelp_view_toc_printf (view,
+ TOC_BLOCK_END);
+ if (sections->next) {
+ yelp_view_toc_printf (view,
+ TOC_BLOCK_SEPARATOR);
+ }
+ }
+
+ sections = sections->next;
+ important_doc_installed = FALSE;
+ }
+
+ if (left_column_started) {
+ yelp_view_toc_printf (view, COLUMN_END);
+ }
+
+ yelp_view_toc_printf (view,
+ COLUMN_RIGHT_START);
+
+ root = yelp_util_find_toplevel (priv->doc_tree, "scrollkeeper");
+ node = g_node_first_child (root);
+
+ yelp_view_toc_printf (view,
+ TOC_BLOCK_SEPARATOR
+ TOC_BLOCK_START
+ "<h2>%s</h2>\n",
+ section_gnome);
+
+ root = yelp_util_find_node_from_name (priv->doc_tree, "GNOME");
+ node = g_node_first_child (root);
+
+ while (node) {
+ section = YELP_SECTION (node->data);
+ path = yelp_util_node_to_string_path (node);
+ yelp_view_toc_printf (view,
+ "<a href=\"toc:scrollkeeper/%s\">%s</a><br>\n",
+ path, section->name);
+ g_free (path);
+
+ node = g_node_next_sibling (node);
+ }
+
+ yelp_view_toc_printf (view,
+ TOC_BLOCK_END);
+
+ yelp_view_toc_printf (view,
+ TOC_BLOCK_SEPARATOR
+ TOC_BLOCK_START
+ "<h2>%s</h2>\n",
+ section_additional);
+
+ root = yelp_util_find_toplevel (priv->doc_tree, "scrollkeeper");
+ node = g_node_first_child (root);
+
+ while (node) {
+ section = YELP_SECTION (node->data);
+ if (strcmp (section->name, "GNOME")) {
+ path = yelp_util_node_to_string_path (node);
+ yelp_view_toc_printf (view,
+ "<a href=\"toc:scrollkeeper/%s\">%s</a><br>\n",
+ path, section->name);
+ g_free (path);
+
+ }
+ node = g_node_next_sibling (node);
+ }
+
+ if (yelp_util_find_toplevel (priv->doc_tree, "man")) {
+ yelp_view_toc_printf (view,
+ "<a href=\"toc:man\">%s</a><br>\n",
+ man_string);
+ }
+
+ if (yelp_util_find_toplevel (priv->doc_tree, "info")) {
+ yelp_view_toc_printf (view,
+ "<a href=\"toc:info\">%s</a><br>\n",
+ info_string);
+ }
+
+ yelp_view_toc_printf (view,
+ TOC_BLOCK_END);
+
+ yelp_view_toc_printf (view, COLUMN_END);
+
+ yelp_view_toc_write_footer (view);
+
+ yelp_view_toc_close (view);
+}
+
+#if 0
+static void
+yelp_view_toc_start (YelpViewTOC *view)
+{
+ YelpViewTOCPriv *priv;
+ GNode *node;
+ YelpSection *section;
gchar *table_start = "\n"
" <center>\n"
" <table cellspacing=\"20\" width=\"100%\">\n"
@@ -331,6 +576,7 @@ yelp_view_toc_start (YelpViewTOC *view)
"<li><a href=\"%s\">%s</a>\n",
section->uri, section->name);
}
+
seriesids = seriesids->next;
}
@@ -347,8 +593,9 @@ yelp_view_toc_start (YelpViewTOC *view)
yelp_view_toc_printf (view,
- "<td valign=\"top\">\n"
- "<h2>%s</h2>\n", installed_string);
+ "<td bgcolor=\"" BLOCK_BG_COLOR "\""
+ " valign=\"top\">\n"
+ "<h2>%s</h2>\n", installed_string);
root = yelp_util_find_toplevel (priv->doc_tree, "scrollkeeper");
node = g_node_first_child (root);
@@ -372,9 +619,8 @@ yelp_view_toc_start (YelpViewTOC *view)
info_installed = TRUE;
}
-
if (man_installed || info_installed) {
- yelp_view_toc_printf (view, "<h2>%s</h2>\n",
+ yelp_view_toc_printf (view, "<tr><td bgcolor=\"#c1c1c1\" valign=\"top\"><h2>%s</h2>\n",
other_docs_string);
if (man_installed) {
@@ -399,6 +645,7 @@ yelp_view_toc_start (YelpViewTOC *view)
yelp_view_toc_close (view);
}
+#endif
static char *
yelp_view_toc_full_path_name (YelpViewTOC *view, GNode *node)
@@ -449,7 +696,7 @@ yelp_view_toc_man_emit (YelpViewTOC *view, GNode *first)
section = node->data;
path = yelp_util_node_to_string_path (node);
- yelp_view_toc_printf (view, "<h2><a href=\"toc:man/%s\">%s</a></h2>\n", path, section->name);
+ yelp_view_toc_printf (view, "<h3><a href=\"toc:man/%s\">%s</a></h3>\n", path, section->name);
g_free (path);
} else {
got_a_leaf = TRUE;
@@ -500,7 +747,7 @@ yelp_view_toc_man_2 (YelpViewTOC *view,
GNode *first;
gchar *name;
gchar *string = _("Manual pages");
-
+
if (root->children == NULL) {
return;
}
@@ -512,8 +759,8 @@ yelp_view_toc_man_2 (YelpViewTOC *view,
yelp_view_toc_write_header (view, string);
name = yelp_view_toc_full_path_name (view, root);
-
- yelp_view_toc_printf (view, "<h1><a href=\"toc:man\">%s</a>: '%s'</h1>\n", string, name);
+
+ yelp_view_toc_printf (view, "<h2><a href=\"toc:man\">%s</a>: %s</h2>\n", string, name);
g_free (name);
yelp_view_toc_man_emit (view, first);
@@ -550,7 +797,7 @@ yelp_view_toc_man_1 (YelpViewTOC *view)
yelp_view_toc_write_header (view, string);
- yelp_view_toc_printf (view, "<h1>%s</h1>\n", string);
+ yelp_view_toc_printf (view, "<h2>%s</h2>\n", string);
do {
child = g_node_first_child (node);
@@ -597,7 +844,7 @@ yelp_view_toc_info (YelpViewTOC *view)
yelp_view_toc_write_header (view, _("Info pages"));
- yelp_view_toc_printf (view, "<h1>%s</h1>\n", string);
+ yelp_view_toc_printf (view, "<h2>%s</h2>\n", string);
do {
section = YELP_SECTION (node->data);
@@ -697,7 +944,6 @@ yelp_view_toc_scrollkeeper (YelpViewTOC *view,
gboolean got_a_leaf;
char *path;
gchar *name;
- gchar *string = _("Scrollkeeper docs for category");
priv = view->priv;
@@ -710,39 +956,36 @@ yelp_view_toc_scrollkeeper (YelpViewTOC *view,
yelp_view_toc_write_header (view, "Scrollkeeper");
name = yelp_view_toc_full_path_name (view, root);
- yelp_view_toc_printf (view, "<h1>%s '%s'</h1>\n", string, name);
+ yelp_view_toc_printf (view, "<h2>%s</h2>\n", name);
g_free (name);
got_a_leaf = FALSE;
node = root->children;
- while (node != NULL) {
+
+ for (node = root->children; node; node = node->next) {
if (node->children != NULL) {
child = node->children;
section = node->data;
path = yelp_util_node_to_string_path (node);
- yelp_view_toc_printf (view, "<h2><a href=\"toc:scrollkeeper/%s\">%s</a></h2>\n", path, section->name);
+ yelp_view_toc_printf (view, "<h3><a href=\"toc:scrollkeeper/%s\">%s</a></h3>\n", path, section->name);
g_free (path);
} else {
got_a_leaf = TRUE;
}
- node = node->next;
}
-
if (got_a_leaf) {
yelp_view_toc_write (view, "<ul>\n", -1);
- node = root->children;
- while (node != NULL) {
+ for (node = root->children; node; node = node->next) {
if (node->children == NULL) {
YelpSection *section;
section = node->data;
yelp_view_toc_printf (view, "<li><a href=\"%s\">%s</a>\n", section->uri, section->name);
}
- node = node->next;
}
yelp_view_toc_write (view, "</ul>\n", -1);
@@ -794,7 +1037,7 @@ yelp_view_toc_open_url (YelpViewTOC *view, const char *url)
if (path_string[0] == '/') {
/* Calculate where it should go */
path_string++;
-
+
node = yelp_util_string_path_to_node (path_string,
view->priv->doc_tree);
if (node) {
diff --git a/src/yelp-window.c b/src/yelp-window.c
index 0e490b7c..fc71f14f 100644
--- a/src/yelp-window.c
+++ b/src/yelp-window.c
@@ -317,6 +317,8 @@ yw_handle_url (YelpWindow *window, const gchar *url)
priv = window->priv;
+ yelp_view_content_stop (YELP_VIEW_CONTENT (priv->content_view));
+
if (strncmp (url, "toc:", 4) == 0) {
yelp_view_toc_open_url (YELP_VIEW_TOC (priv->toc_view),
url);
@@ -565,7 +567,6 @@ yw_create_toolbar (YelpWindow *window)
GConfClient *conf_client;
gchar *str;
GtkToolbarStyle style = GTK_TOOLBAR_BOTH;
- guint notify_id;
g_return_val_if_fail (YELP_IS_WINDOW (window), NULL);
@@ -701,7 +702,7 @@ yelp_window_new (GNode *doc_tree, GList *index)
priv->content_view = yelp_view_content_new (doc_tree);
if (priv->index) {
- priv->index_view = yelp_view_index_new (index);
+ priv->index_view = yelp_view_index_new (index);
g_signal_connect (priv->index_view, "url_selected",
G_CALLBACK (yw_url_selected_cb),