diff options
author | 7 <NotZed@Ximian.com> | 2001-10-18 06:44:27 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2001-10-18 06:44:27 +0800 |
commit | 4b9dbd4269daf414066e5c7a15b992e3efedbfb2 (patch) | |
tree | 6176ad74e5d5629df80eb7acca2b9f6065a28b4a | |
parent | 460c0c33231fddbbfac5ed56c58f3a06332d0040 (diff) | |
download | gsoc2013-evolution-4b9dbd4269daf414066e5c7a15b992e3efedbfb2.tar.gz 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
-rw-r--r-- | camel/ChangeLog | 5 | ||||
-rw-r--r-- | camel/camel-store.c | 36 | ||||
-rw-r--r-- | camel/camel-store.h | 1 |
3 files changed, 41 insertions, 1 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 8a13bcc98f..d638cf6671 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,8 @@ +2001-10-17 <NotZed@Ximian.com> + + * camel-store.c (camel_folder_info_clone): New function to clone a + folderinfo tree. + 2001-10-17 Jeffrey Stedfast <fejj@ximian.com> * providers/local/camel-mh-folder.c (mh_append_message): Same as 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 diff --git a/camel/camel-store.h b/camel/camel-store.h index 8f7f566d3a..2cb1e4c7fb 100644 --- a/camel/camel-store.h +++ b/camel/camel-store.h @@ -183,6 +183,7 @@ CamelFolderInfo *camel_folder_info_build (GPtrArray *folders, const char *namespace, char separator, gboolean short_names); +CamelFolderInfo *camel_folder_info_clone (CamelFolderInfo *fi); gboolean camel_store_supports_subscriptions (CamelStore *store); |