From 21743ac2cfa2d2ddcd539e9b7695cc8dd720ef36 Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Tue, 21 Oct 2003 18:51:30 +0000 Subject: Merge new-ui-branch into the trunk. svn path=/trunk/; revision=22966 --- camel/camel-store.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'camel/camel-store.c') diff --git a/camel/camel-store.c b/camel/camel-store.c index eedc9dfa2a..3c49f312ec 100644 --- a/camel/camel-store.c +++ b/camel/camel-store.c @@ -776,7 +776,7 @@ CamelFolderInfo * camel_folder_info_build (GPtrArray *folders, const char *namespace, char separator, gboolean short_names) { - CamelFolderInfo *fi, *pfi, *top = NULL; + CamelFolderInfo *fi, *pfi, *top = NULL, *tail = NULL; GHashTable *hash; char *name, *p, *pname; int i, nlen; @@ -854,9 +854,15 @@ camel_folder_info_build (GPtrArray *folders, const char *namespace, g_hash_table_insert (hash, pname, pfi); g_ptr_array_add (folders, pfi); } - fi->sibling = pfi->child; + tail = pfi->child; + if (tail == NULL) { + pfi->child = fi; + } else { + while (tail->sibling) + tail = tail->sibling; + tail->sibling = fi; + } fi->parent = pfi; - pfi->child = fi; } else if (!top) top = fi; } @@ -864,13 +870,18 @@ camel_folder_info_build (GPtrArray *folders, const char *namespace, g_hash_table_destroy (hash); /* Link together the top-level folders */ + tail = top; for (i = 0; i < folders->len; i++) { fi = folders->pdata[i]; if (fi->parent || fi == top) continue; - if (top) - fi->sibling = top; - top = fi; + if (tail == NULL) { + tail = fi; + top = fi; + } else { + tail->sibling = fi; + tail = fi; + } } return top; -- cgit v1.2.3