summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Hallendal <micke@codefactory.se>2002-03-03 17:39:36 +0000
committerMikael Hallendal <hallski@src.gnome.org>2002-03-03 17:39:36 +0000
commit447a70d57e0280ff39c0811a8acd379ed4032187 (patch)
treea5a6f2d01f4f82e7fd1aaa8043e0d36dad6801d5
parentbd448fd16943e324a3fa4ae9b67e18ca01b1fe31 (diff)
downloadyelp-447a70d57e0280ff39c0811a8acd379ed4032187.tar.gz
- Fixes #73292 (yelp_man_populate_tree_for_subdir): add to section index
2002-03-03 Mikael Hallendal <micke@codefactory.se> * src/yelp-man.c: - Fixes #73292 (yelp_man_populate_tree_for_subdir): add to section index list. (yelp_man_init): concat the man index list with the global. * src/yelp-info.c (yelp_info_init): call strdown on the names before adding to index. * src/yelp-index-model.c (yelp_index_model_filter): don't show all index-words by default. Only show the words matching the query. Not sure what is the best way to do this, but with all man and info pages in the index it got pretty crowded. * src/yelp-base.c (yelp_base_new): pass index to man_init.
-rw-r--r--ChangeLog15
-rw-r--r--src/yelp-base.c4
-rw-r--r--src/yelp-index-model.c12
-rw-r--r--src/yelp-info.c7
-rw-r--r--src/yelp-man.c24
-rw-r--r--src/yelp-man.h2
6 files changed, 52 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 8b178897..ed1cf3f4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,20 @@
2002-03-03 Mikael Hallendal <micke@codefactory.se>
+ * src/yelp-man.c:
+ - Fixes #73292
+ (yelp_man_populate_tree_for_subdir): add to section index list.
+ (yelp_man_init): concat the man index list with the global.
+
+ * src/yelp-info.c (yelp_info_init): call strdown on the names
+ before adding to index.
+
+ * src/yelp-index-model.c (yelp_index_model_filter): don't show all
+ index-words by default. Only show the words matching the
+ query. Not sure what is the best way to do this, but with all
+ man and info pages in the index it got pretty crowded.
+
+ * src/yelp-base.c (yelp_base_new): pass index to man_init.
+
* src/yelp-window.c (yelp_window_new): fixed an error if you don't
have an index installed (thanks rhult).
diff --git a/src/yelp-base.c b/src/yelp-base.c
index 8bcdfb0e..11605978 100644
--- a/src/yelp-base.c
+++ b/src/yelp-base.c
@@ -117,8 +117,6 @@ yelp_base_init (YelpBase *base)
priv->index = NULL;
priv->windows = NULL;
base->priv = priv;
-
-
}
static void
@@ -171,7 +169,7 @@ yelp_base_new (void)
priv = base->priv;
yelp_scrollkeeper_init (priv->toc_tree, &priv->index);
- yelp_man_init (base->priv->toc_tree);
+ yelp_man_init (base->priv->toc_tree, &priv->index);
yelp_info_init (base->priv->toc_tree, &priv->index);
return base;
diff --git a/src/yelp-index-model.c b/src/yelp-index-model.c
index 205b6664..6f06bfbe 100644
--- a/src/yelp-index-model.c
+++ b/src/yelp-index-model.c
@@ -406,18 +406,20 @@ void
yelp_index_model_set_words (YelpIndexModel *model, GList *index_words)
{
YelpIndexModelPriv *priv;
+#if 0
GList *node;
gint i = 0;
GtkTreePath *path;
GtkTreeIter iter;
-
+#endif
g_return_if_fail (YELP_IS_INDEX_MODEL (model));
priv = model->priv;
priv->original_list = g_list_sort (index_words, yelp_section_compare);
- priv->index_words = priv->original_list;
+#if 0
+ priv->index_words = priv->original_list;
for (node = priv->index_words; node; node = node->next) {
path = gtk_tree_path_new ();
@@ -431,6 +433,7 @@ yelp_index_model_set_words (YelpIndexModel *model, GList *index_words)
gtk_tree_path_free (path);
}
+#endif
}
void
@@ -457,7 +460,10 @@ yelp_index_model_filter (YelpIndexModel *model, const gchar *string)
old_length = g_list_length (priv->index_words);
if (!strcmp ("", string)) {
- new_list = priv->original_list;
+#if 0
+ new_list = priv->original_list;
+#endif
+ new_list = NULL;
} else {
for (node = priv->original_list; node; node = node->next) {
section = YELP_SECTION (node->data);
diff --git a/src/yelp-info.c b/src/yelp-info.c
index 91758aa5..57c72c0d 100644
--- a/src/yelp-info.c
+++ b/src/yelp-info.c
@@ -105,6 +105,7 @@ yelp_info_init (GNode *tree, GList **index)
GSList *node;
YelpSection *section;
YelpSection *index_section;
+ gchar *index_name;
gchar *index_uri;
stat ("/usr/info", &stat_dir1);
@@ -120,7 +121,7 @@ yelp_info_init (GNode *tree, GList **index)
return FALSE;
}
- root = g_node_append_data (tree,
+ root = g_node_append_data (tree,
yelp_section_new (YELP_SECTION_CATEGORY,
_("info"), NULL,
NULL, NULL));
@@ -131,12 +132,14 @@ yelp_info_init (GNode *tree, GList **index)
g_node_append_data (root, node->data);
section = YELP_SECTION (node->data);
+ index_name = g_ascii_strdown (section->name, -1);
index_uri = g_strconcat ("index:", section->uri, NULL);
index_section = yelp_section_new (YELP_SECTION_INDEX,
- section->name, index_uri,
+ index_name, index_uri,
section->reference,
section->scheme);
+ g_free (index_name);
g_free (index_uri);
*index = g_list_prepend (*index, index_section);
diff --git a/src/yelp-man.c b/src/yelp-man.c
index 1233ffea..fb4d5edd 100644
--- a/src/yelp-man.c
+++ b/src/yelp-man.c
@@ -55,7 +55,8 @@ struct TreeData {
char *section;
};
-static gboolean any_man_pages = FALSE;
+static gboolean any_man_pages = FALSE;
+static GList *man_index = NULL;
/* Caller must free this */
static char *
@@ -125,7 +126,10 @@ yelp_man_populate_tree_for_subdir (GHashTable *section_hash,
char uribuf[128], titlebuf[128];
struct TreeNode *node;
YelpSection *yelp_section;
-
+ YelpSection *index_section;
+ gchar *index_name;
+ gchar *index_uri;
+
dirh = opendir (basedir);
if (!dirh) {
return;
@@ -179,6 +183,18 @@ yelp_man_populate_tree_for_subdir (GHashTable *section_hash,
NULL, NULL);
node->pages = g_list_prepend (node->pages, yelp_section);
+
+ index_name = g_ascii_strdown (titlebuf, -1);
+ index_uri = g_strconcat ("index:", uribuf, NULL);
+
+ index_section = yelp_section_new (YELP_SECTION_INDEX,
+ index_name, index_uri,
+ yelp_section->reference,
+ yelp_section->scheme);
+ g_free (index_name);
+ g_free (index_uri);
+
+ man_index = g_list_prepend (man_index, index_section);
g_free (manname);
g_free (section);
@@ -557,7 +573,7 @@ yelp_man_push_initial_tree (struct TreeNode *node, GNode *parent)
}
gboolean
-yelp_man_init (GNode *tree)
+yelp_man_init (GNode *tree, GList **index)
{
gchar *manpath = NULL;
char **manpathes = NULL;
@@ -614,6 +630,8 @@ yelp_man_init (GNode *tree)
yelp_man_free_initial_tree (root);
g_hash_table_destroy (section_hash);
+
+ *index = g_list_concat (*index, man_index);
return TRUE;
}
diff --git a/src/yelp-man.h b/src/yelp-man.h
index f200ebe6..5da2de6a 100644
--- a/src/yelp-man.h
+++ b/src/yelp-man.h
@@ -25,6 +25,6 @@
#include <glib.h>
-gboolean yelp_man_init (GNode *tree);
+gboolean yelp_man_init (GNode *tree, GList **index);
#endif /* __YELP_MAN_H__ */