summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Hallendal <micke@codefactory.se>2002-03-03 14:46:22 +0000
committerMikael Hallendal <hallski@src.gnome.org>2002-03-03 14:46:22 +0000
commit180a51bcb17698bf33134adea35b6d7e8bcb8bb7 (patch)
treeed2f9458f398b44a5e2efac98dfa634a081573e3
parent34f4e6ef7fc9ae28b9ca67fedd1180a044760fc9 (diff)
downloadyelp-180a51bcb17698bf33134adea35b6d7e8bcb8bb7.tar.gz
- Fixes #73270 (yelp_info_read_info_dir): renamed from
2002-03-03 Mikael Hallendal <micke@codefactory.se> * src/yelp-info.c: - Fixes #73270 (yelp_info_read_info_dir): renamed from yelp_info_populate_tree_for_subdir. It not takes a list instead. (yelp_info_init): First read the sections into a list, sort it and append it to the GNode.
-rw-r--r--ChangeLog8
-rw-r--r--src/yelp-info.c28
2 files changed, 27 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 72740366..4e3aca9c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,13 @@
2002-03-03 Mikael Hallendal <micke@codefactory.se>
- * src/yelp-info.c: conform with the Yelp coding style.
+ * src/yelp-info.c:
+ - Fixes #73270
+ (yelp_info_read_info_dir): renamed from
+ yelp_info_populate_tree_for_subdir. It not takes a list instead.
+ (yelp_info_init): First read the sections into a list, sort it and
+ append it to the GNode.
+ * src/yelp-info.c: conform with the Yelp coding style.
* src/yelp-man.c: same
* configure.in (GNOMELOCALEDIR): depend on a certain number of
diff --git a/src/yelp-info.c b/src/yelp-info.c
index 991b2007..f1dcfbbd 100644
--- a/src/yelp-info.c
+++ b/src/yelp-info.c
@@ -43,10 +43,11 @@
static void
-yelp_info_populate_tree_for_subdir (const char *basedir, GNode *parent)
+yelp_info_read_info_dir (const char *basedir, GSList **info_list)
{
DIR *dirh;
struct dirent *dent;
+ YelpSection *section;
dirh = opendir (basedir);
if (!dirh) {
@@ -83,10 +84,12 @@ yelp_info_populate_tree_for_subdir (const char *basedir, GNode *parent)
g_snprintf (uribuf, sizeof (uribuf), "info:%s", dent->d_name);
- g_node_append_data (parent,
- yelp_section_new (YELP_SECTION_DOCUMENT,
- titlebuf, uribuf,
- NULL, NULL));
+ section = yelp_section_new (YELP_SECTION_DOCUMENT,
+ titlebuf, uribuf,
+ NULL, NULL);
+
+ *info_list = g_slist_prepend (*info_list, section);
+
}
closedir (dirh);
@@ -98,6 +101,8 @@ yelp_info_init (GNode *tree)
GNode *root;
struct stat stat_dir1;
struct stat stat_dir2;
+ GSList *info_list = NULL;
+ GSList *node;
root = g_node_append_data (tree,
yelp_section_new (YELP_SECTION_CATEGORY,
@@ -107,12 +112,19 @@ yelp_info_init (GNode *tree)
stat ("/usr/info", &stat_dir1);
stat ("/usr/share/info", &stat_dir2);
- yelp_info_populate_tree_for_subdir ("/usr/info", root);
+ yelp_info_read_info_dir ("/usr/info", &info_list);
if (stat_dir1.st_ino != stat_dir2.st_ino) {
- yelp_info_populate_tree_for_subdir ("/usr/share/info",
- root);
+ yelp_info_read_info_dir ("/usr/share/info", &info_list);
}
+ info_list = g_slist_sort (info_list, yelp_section_compare);
+
+ for (node = info_list; node; node = node->next) {
+ g_node_append_data (root, node->data);
+ }
+
+ g_slist_free (info_list);
+
return TRUE;
}