summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'gnome-extra/yelp/files')
-rw-r--r--gnome-extra/yelp/files/digest-yelp-2.2.31
-rw-r--r--gnome-extra/yelp/files/digest-yelp-2.4.21
-rw-r--r--gnome-extra/yelp/files/yelp-2-speed_fix.patch521
3 files changed, 522 insertions, 1 deletions
diff --git a/gnome-extra/yelp/files/digest-yelp-2.2.3 b/gnome-extra/yelp/files/digest-yelp-2.2.3
deleted file mode 100644
index a4baad77a910..000000000000
--- a/gnome-extra/yelp/files/digest-yelp-2.2.3
+++ /dev/null
@@ -1 +0,0 @@
-MD5 46727cccf4e8d17ec5102e8274b5145c yelp-2.2.3.tar.bz2 523136
diff --git a/gnome-extra/yelp/files/digest-yelp-2.4.2 b/gnome-extra/yelp/files/digest-yelp-2.4.2
new file mode 100644
index 000000000000..060f7a4c11fd
--- /dev/null
+++ b/gnome-extra/yelp/files/digest-yelp-2.4.2
@@ -0,0 +1 @@
+MD5 ee89f4d0886f7c3be1b9f6894a57ec1b yelp-2.4.2.tar.bz2 598274
diff --git a/gnome-extra/yelp/files/yelp-2-speed_fix.patch b/gnome-extra/yelp/files/yelp-2-speed_fix.patch
new file mode 100644
index 000000000000..4cfc284b56ff
--- /dev/null
+++ b/gnome-extra/yelp/files/yelp-2-speed_fix.patch
@@ -0,0 +1,521 @@
+? yelp-shaunm-030816-0.diff
+Index: src/yelp-cache.c
+===================================================================
+RCS file: /cvs/gnome/yelp/src/yelp-cache.c,v
+retrieving revision 1.2
+diff -u -r1.2 yelp-cache.c
+--- src/yelp-cache.c 13 Jun 2003 17:15:00 -0000 1.2
++++ src/yelp-cache.c 16 Aug 2003 22:04:15 -0000
+@@ -30,11 +30,17 @@
+ GHashTable *cache_table;
+ GMutex *cache_mutex;
+
++GHashTable *links_table;
++GMutex *links_mutex;
++
+ void
+ yelp_cache_init (void)
+ {
+ cache_mutex = g_mutex_new ();
+ cache_table = g_hash_table_new (g_str_hash, g_str_equal);
++
++ links_mutex = g_mutex_new ();
++ links_table = g_hash_table_new (g_str_hash, g_str_equal);
+ }
+
+ const gchar *
+@@ -51,6 +57,20 @@
+ return ret_val;
+ }
+
++YelpNavLinks *
++yelp_cache_lookup_links (const gchar *path)
++{
++ YelpNavLinks *ret_val;
++
++ g_mutex_lock (links_mutex);
++
++ ret_val = (YelpNavLinks *) g_hash_table_lookup (links_table, path);
++
++ g_mutex_unlock (links_mutex);
++
++ return ret_val;
++}
++
+ void
+ yelp_cache_add (const gchar *path, const gchar *html)
+ {
+@@ -59,4 +79,16 @@
+ g_hash_table_insert (cache_table, (gchar *) path, g_strdup (html));
+
+ g_mutex_unlock (cache_mutex);
++}
++
++void
++yelp_cache_add_links (const gchar *path, const YelpNavLinks *links)
++{
++ YelpNavLinks *new_links;
++
++ g_mutex_lock (links_mutex);
++
++ g_hash_table_insert (links_table, (gchar *) path, links);
++
++ g_mutex_unlock (links_mutex);
+ }
+Index: src/yelp-cache.h
+===================================================================
+RCS file: /cvs/gnome/yelp/src/yelp-cache.h,v
+retrieving revision 1.2
+diff -u -r1.2 yelp-cache.h
+--- src/yelp-cache.h 13 Jun 2003 17:15:00 -0000 1.2
++++ src/yelp-cache.h 16 Aug 2003 22:04:15 -0000
+@@ -27,10 +27,31 @@
+
+ #include "yelp-uri.h"
+
++typedef struct _YelpNavLinks YelpNavLinks;
++
++#define YELP_NAV_LINKS(x) ((YelpNavLinks *) x)
++
++struct _YelpNavLinks {
++ gchar *prev_link_uri;
++ gchar *next_link_uri;
++ gchar *prev_link_title;
++ gchar *next_link_title;
++ gchar *prev_link_text;
++ gchar *next_link_text;
++ gchar *up_link_uri;
++ gchar *up_link_title;
++};
++
+ void yelp_cache_init (void);
+
+ const gchar * yelp_cache_lookup (const gchar *path);
+
+ void yelp_cache_add (const gchar *path,
+ const gchar *html);
++
++YelpNavLinks * yelp_cache_lookup_links (const gchar *path);
++
++void yelp_cache_add_links (const gchar *path,
++ const YelpNavLinks *links);
++
+ #endif /* __YELP_CACHE_H__ */
+Index: src/yelp-db2html.c
+===================================================================
+RCS file: /cvs/gnome/yelp/src/yelp-db2html.c,v
+retrieving revision 1.27
+diff -u -r1.27 yelp-db2html.c
+--- src/yelp-db2html.c 24 Jul 2003 06:18:35 -0000 1.27
++++ src/yelp-db2html.c 16 Aug 2003 22:04:15 -0000
+@@ -66,16 +66,28 @@
+ const gchar *params[16 + 1];
+ gchar *pathname;
+ gchar *docpath;
++ gboolean gen_links;
+ db_doc = NULL;
+
+ putenv ("XML_CATALOG_FILES=" DATADIR "/yelp/catalog");
+
+ if (argc < 2) {
+- g_print ("Usage 'yelp-db2html url'\n");
++ g_print ("Usage 'yelp-db2html [-n] url'\n");
+ exit (1);
+ }
+
+- docpath = argv[1];
++ if (!strcmp (argv[1], "-n")) {
++ if (argc < 3) {
++ g_print ("Usage 'yelp-db2html [-n] url'\n");
++ exit (1);
++ }
++
++ docpath = argv[2];
++ gen_links = FALSE;
++ } else {
++ docpath = argv[1];
++ gen_links = TRUE;
++ }
+
+ if (!g_file_test (docpath, G_FILE_TEST_EXISTS)) {
+ g_warning ("'%s' doesn't exist.", docpath);
+@@ -126,7 +138,7 @@
+ params[6] = "yelp_max_chunk_depth";
+ params[7] = "2";
+ params[8] = "yelp_generate_navbar";
+- params[9] = "1";
++ params[9] = (gen_links ? "1" : "0");
+ params[10] = "yelp_chunk_method";
+ params[11] = "'yelp'";
+ params[12] = NULL;
+Index: src/yelp-reader.c
+===================================================================
+RCS file: /cvs/gnome/yelp/src/yelp-reader.c,v
+retrieving revision 1.28
+diff -u -r1.28 yelp-reader.c
+--- src/yelp-reader.c 8 Jul 2003 12:05:49 -0000 1.28
++++ src/yelp-reader.c 16 Aug 2003 22:04:17 -0000
+@@ -94,7 +94,7 @@
+ static void reader_th_data_free (ReaderThreadData *th_data);
+ #endif
+ static gchar * reader_get_chunk (const gchar *document,
+- const gchar *section);
++ YelpURI *uri);
+ static gchar *
+ reader_look_for_cached_help_file (const gchar *url);
+
+@@ -261,9 +261,15 @@
+ break;
+ case YELP_URI_TYPE_DOCBOOK_XML:
+ case YELP_URI_TYPE_DOCBOOK_SGML:
+- command_line = g_strdup_printf ("%s/yelp-db2html %s",
+- SERVERDIR,
+- yelp_uri_get_path (uri));
++ if (yelp_cache_lookup_links (yelp_uri_to_string (uri))) {
++ command_line = g_strdup_printf ("%s/yelp-db2html -n %s",
++ SERVERDIR,
++ yelp_uri_get_path (uri));
++ } else {
++ command_line = g_strdup_printf ("%s/yelp-db2html %s",
++ SERVERDIR,
++ yelp_uri_get_path (uri));
++ }
+ break;
+ default:
+ /* Set error */
+@@ -312,14 +318,7 @@
+ yelp_uri_get_type (uri) == YELP_URI_TYPE_DOCBOOK_SGML) {
+ gchar *chunk;
+
+- if (yelp_uri_get_section (uri) &&
+- strcmp (yelp_uri_get_section (uri), "")) {
+- chunk = reader_get_chunk (q_data->data,
+- yelp_uri_get_section (uri));
+- } else {
+- chunk = reader_get_chunk (q_data->data,
+- "toc");
+- }
++ chunk = reader_get_chunk (q_data->data, uri);
+
+ g_free (q_data->data);
+ q_data->data = chunk;
+@@ -634,25 +633,30 @@
+ #endif
+
+ static gchar *
+-reader_get_chunk (const gchar *document, const gchar *section)
++reader_get_chunk (const gchar *document, YelpURI *uri)
+ {
+- gchar *header;
+- gchar *chunk;
+- const gchar *footer;
+- gchar *ret_val;
+- const gchar *start;
+- const gchar *end;
+- gchar *tag;
+- GTimer *timer;
+-
+-/* g_print ("%s\n", document); */
+-
+- timer = g_timer_new ();
++ const gchar *section;
++ gchar *header;
++ gchar *chunk;
++ const gchar *footer;
++ gchar *ret_val;
++ const gchar *start;
++ const gchar *end;
++ gchar *tag;
++ GTimer *timer;
++ YelpNavLinks *links;
++ const gchar *nav_top;
++ const gchar *nav_bottom;
++
++ // timer = g_timer_new ();
++
++ section = yelp_uri_get_section (uri);
++ if (!section || !strcmp (section, ""))
++ section = "toc";
+
+ end = strstr (document, "<!-- End of header -->");
+
+ if (!end) {
+-/* g_warning ("Wrong type of document\n"); */
+ return g_strdup (document);
+ }
+
+@@ -663,7 +667,6 @@
+ g_free (tag);
+
+ if (!start) {
+-/* g_warning ("Document doesn't include section: '%s'", section); */
+ g_free (header);
+
+ return g_strdup (document);
+@@ -672,8 +675,6 @@
+ end = strstr (start, "<!-- End of chunk -->");
+
+ if (!end) {
+-/* g_warning ("Document is doesn't contain end tag for section: %s", */
+-/* section); */
+ g_free (header);
+
+ return g_strdup (document);
+@@ -684,15 +685,59 @@
+ footer = strstr (document, "<!-- Start of footer -->");
+
+ if (!footer) {
+-/* g_warning ("Couldn't find footer in document"); */
+ g_free (header);
+ g_free (chunk);
+
+ return g_strdup (document);
+ }
+-
+- ret_val = g_strconcat (header, chunk, footer, NULL);
+-
++
++ links = yelp_cache_lookup_links (yelp_uri_to_string (uri));
++
++ if (!links) {
++ nav_top = "";
++ nav_bottom = "";
++ } else {
++ nav_top = g_strconcat ("<table width='100%'><tr>",
++ "<td width='40%' align='left'>",
++ "<a accesskey='p' href='",
++ links->prev_link_uri, "'>",
++ links->prev_link_title,
++ "</a></td>",
++ "<td width='40%' align='right'>",
++ "<a accesskey='n' href='",
++ links->next_link_uri, "'>",
++ links->next_link_title,
++ "</a></td>",
++ "</tr></table>",
++ "<hr>",
++ NULL);
++ nav_bottom = g_strconcat ("<hr class='bottom'>",
++ "<table width='100%'><tr>",
++ "<td width='40%' align='left'>",
++ "<a accesskey='p' href='",
++ links->prev_link_uri, "'>",
++ links->prev_link_title,
++ "</a><br>",
++ links->prev_link_text,
++ "</td>",
++ "<td width='20%' align='center'>",
++ "<a accesskey='u' href='",
++ links->up_link_uri, "'>",
++ links->up_link_title,
++ "</a></td>",
++ "<td width='40%' align='right'>",
++ "<a accesskey='n' href='",
++ links->next_link_uri, "'>",
++ links->next_link_title,
++ "</a><br>",
++ links->next_link_text,
++ "</td>",
++ "</tr></table>",
++ NULL);
++ }
++
++ ret_val = g_strconcat (header, nav_top, chunk, nav_bottom, footer, NULL);
++
+ g_free (header);
+ g_free (chunk);
+
+@@ -902,14 +947,8 @@
+ } else {
+ document = read_document;
+ }
+-
+- if (yelp_uri_get_section (new_uri) &&
+- strcmp (yelp_uri_get_section (new_uri), "")) {
+- chunk = reader_get_chunk (document,
+- yelp_uri_get_section (new_uri));
+- } else {
+- chunk = reader_get_chunk (document, "toc");
+- }
++
++ chunk = reader_get_chunk (document, new_uri);
+
+ g_free (read_document);
+ yelp_uri_unref (new_uri);
+Index: src/yelp-scrollkeeper.c
+===================================================================
+RCS file: /cvs/gnome/yelp/src/yelp-scrollkeeper.c,v
+retrieving revision 1.34
+diff -u -r1.34 yelp-scrollkeeper.c
+--- src/yelp-scrollkeeper.c 13 Jun 2003 17:15:01 -0000 1.34
++++ src/yelp-scrollkeeper.c 16 Aug 2003 22:04:18 -0000
+@@ -593,6 +593,7 @@
+ xmlNode *xml_node;
+ GNode *tree;
+ gchar *full_path;
++ gchar *title_path;
+
+ g_return_val_if_fail (docpath != NULL, NULL);
+
+@@ -619,11 +620,22 @@
+ xml_node = doc->xmlRootNode->xmlChildrenNode;
+
+ full_path = g_strconcat ("ghelp:", docpath, NULL);
++ title_path = g_strconcat (full_path, "?title-page", NULL);
++
++ g_node_append_data (tree,
++ yelp_section_new (YELP_SECTION_DOCUMENT_SECTION,
++ _("About This Document"),
++ yelp_uri_new (title_path) ));
++ g_node_append_data (tree,
++ yelp_section_new (YELP_SECTION_DOCUMENT_SECTION,
++ _("Contents"),
++ yelp_uri_new (full_path) ));
+
+ for (; xml_node != NULL; xml_node = xml_node->next) {
+ scrollkeeper_parse_toc_section (tree, xml_node, full_path);
+ }
+
++ g_free (title_path);
+ g_free (full_path);
+
+ return tree;
+Index: src/yelp-view-content.c
+===================================================================
+RCS file: /cvs/gnome/yelp/src/yelp-view-content.c,v
+retrieving revision 1.42
+diff -u -r1.42 yelp-view-content.c
+--- src/yelp-view-content.c 13 Jun 2003 17:15:01 -0000 1.42
++++ src/yelp-view-content.c 16 Aug 2003 22:04:19 -0000
+@@ -39,6 +39,7 @@
+ #include "yelp-scrollkeeper.h"
+ #include "yelp-util.h"
+ #include "yelp-uri.h"
++#include "yelp-cache.h"
+ #include "yelp-view-content.h"
+
+ #define d(x)
+@@ -73,6 +74,9 @@
+ GNode *node);
+ static void content_set_tree (YelpViewContent *content,
+ GNode *node);
++gboolean content_generate_links (GNode *node,
++ gpointer data);
++GNode * node_last_ancestor (GNode *node);
+ static void
+ content_show_uri (YelpView *view,
+ YelpURI *uri,
+@@ -420,6 +424,98 @@
+ }
+ }
+
++
++GNode *
++node_last_ancestor (GNode *node)
++{
++ if (node->children)
++ return node_last_ancestor (g_node_last_child (node));
++ else
++ return node;
++}
++
++
++gboolean
++content_generate_links (GNode *node, gpointer data)
++{
++ GNode *prev_node;
++ GNode *next_node;
++ GNode *up_node;
++ YelpURI *prev_uri;
++ YelpURI *next_uri;
++ YelpURI *up_uri;
++ YelpNavLinks *links = g_new0 (YelpNavLinks, 1);
++ YelpURI *uri;
++
++ if (!node->data)
++ return FALSE;
++
++ uri = YELP_SECTION (node->data)->uri;
++
++ if (yelp_cache_lookup_links (yelp_uri_to_string (uri)))
++ return FALSE;
++
++ if (node->prev)
++ prev_node = node_last_ancestor (node->prev);
++ else if (node->parent && node->parent->data)
++ prev_node = node->parent;
++ else
++ prev_node = NULL;
++
++ if (node->children)
++ next_node = node->children;
++ else if (node->next)
++ next_node = node->next;
++ else if (node->parent && node->parent->next)
++ next_node = node->parent->next;
++ else
++ next_node = NULL;
++
++ if (yelp_uri_get_section (uri) &&
++ strcmp (yelp_uri_get_section (uri), "") &&
++ strcmp (yelp_uri_get_section (uri), "toc") &&
++ strcmp (yelp_uri_get_section (uri), "title-page"))
++ up_node = g_node_nth_child (g_node_get_root (node), 1);
++ else
++ up_node = NULL;
++
++ if (!prev_node) {
++ links->prev_link_uri = "";
++ links->prev_link_title = "";
++ links->prev_link_text = "";
++ } else {
++ prev_uri = YELP_SECTION (prev_node->data)->uri;
++ links->prev_link_uri = yelp_uri_to_string (prev_uri);
++ links->prev_link_title = _("Previous");
++ links->prev_link_text = YELP_SECTION (prev_node->data)->name;
++ }
++
++ if (!next_node) {
++ links->next_link_uri = "";
++ links->next_link_title = "";
++ links->next_link_text = "";
++ } else {
++ next_uri = YELP_SECTION (next_node->data)->uri;
++ links->next_link_uri = yelp_uri_to_string (next_uri);
++ links->next_link_title = _("Next");
++ links->next_link_text = YELP_SECTION (next_node->data)->name;
++ }
++
++ if (!up_node) {
++ links->up_link_uri = "";
++ links->up_link_title = "";
++ } else {
++ up_uri = YELP_SECTION (up_node->data)->uri;
++ links->up_link_uri = yelp_uri_to_string (up_uri);
++ links->up_link_title = YELP_SECTION (up_node->data)->name;
++ }
++
++ yelp_cache_add_links (yelp_uri_to_string (uri), links);
++
++ return FALSE;
++}
++
++
+ static void
+ content_show_uri (YelpView *view, YelpURI *uri, GError **error)
+ {
+@@ -445,7 +541,13 @@
+ gtk_widget_show (priv->tree_sw);
+ content_set_tree (YELP_VIEW_CONTENT (view),
+ node);
+-
++
++ g_node_traverse (node,
++ G_PRE_ORDER,
++ G_TRAVERSE_ALL,
++ -1,
++ (GNodeTraverseFunc) content_generate_links,
++ NULL);
+ } else {
+ if (gtk_widget_is_focus (priv->tree_sw)) {
+ reset_focus = TRUE;