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
This commit is contained in:
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user