aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-store.c
diff options
context:
space:
mode:
author7 <NotZed@Ximian.com>2001-10-18 06:44:27 +0800
committerMichael Zucci <zucchi@src.gnome.org>2001-10-18 06:44:27 +0800
commit4b9dbd4269daf414066e5c7a15b992e3efedbfb2 (patch)
tree6176ad74e5d5629df80eb7acca2b9f6065a28b4a /camel/camel-store.c
parent460c0c33231fddbbfac5ed56c58f3a06332d0040 (diff)
downloadgsoc2013-evolution-4b9dbd4269daf414066e5c7a15b992e3efedbfb2.tar
gsoc2013-evolution-4b9dbd4269daf414066e5c7a15b992e3efedbfb2.tar.gz
gsoc2013-evolution-4b9dbd4269daf414066e5c7a15b992e3efedbfb2.tar.bz2
gsoc2013-evolution-4b9dbd4269daf414066e5c7a15b992e3efedbfb2.tar.lz
gsoc2013-evolution-4b9dbd4269daf414066e5c7a15b992e3efedbfb2.tar.xz
gsoc2013-evolution-4b9dbd4269daf414066e5c7a15b992e3efedbfb2.tar.zst
gsoc2013-evolution-4b9dbd4269daf414066e5c7a15b992e3efedbfb2.zip
New function to clone a folderinfo tree.
2001-10-17 <NotZed@Ximian.com> * camel-store.c (camel_folder_info_clone): New function to clone a folderinfo tree. svn path=/trunk/; revision=13740
Diffstat (limited to 'camel/camel-store.c')
-rw-r--r--camel/camel-store.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/camel/camel-store.c b/camel/camel-store.c
index 4bc5de3f83..3cd695f1bc 100644
--- a/camel/camel-store.c
+++ b/camel/camel-store.c
@@ -838,7 +838,41 @@ camel_folder_info_build (GPtrArray *folders, const char *namespace,
top = fi;
}
- return top;
+ return top;
+}
+
+static CamelFolderInfo *folder_info_clone_rec(CamelFolderInfo *fi, CamelFolderInfo *parent)
+{
+ CamelFolderInfo *info;
+
+ info = g_malloc(sizeof(*info));
+ info->parent = parent;
+ info->url = g_strdup(fi->url);
+ info->name = g_strdup(fi->name);
+ info->full_name = g_strdup(fi->full_name);
+ info->path = g_strdup(fi->path);
+ info->unread_message_count = fi->unread_message_count;
+
+ if (fi->sibling)
+ info->sibling = folder_info_clone_rec(fi->sibling, parent);
+ else
+ info->sibling = NULL;
+
+ if (fi->child)
+ info->child = folder_info_clone_rec(fi->child, info);
+ else
+ info->child = NULL;
+
+ return info;
+}
+
+CamelFolderInfo *
+camel_folder_info_clone(CamelFolderInfo *fi)
+{
+ if (fi == NULL)
+ return NULL;
+
+ return folder_info_clone_rec(fi, NULL);
}
gboolean