We need to recursively copy the dragged folder tree over to the drop
2004-04-08 Jeffrey Stedfast <fejj@ximian.com> * em-folder-tree.c (emft_drop_folder): We need to recursively copy the dragged folder tree over to the drop location, not just the parent folder. We also need to subscribe to the newly created folder in some cases. svn path=/trunk/; revision=25375
This commit is contained in:
committed by
Jeffrey Stedfast
parent
0fa18252ba
commit
7fecce2d23
@ -1,3 +1,10 @@
|
||||
2004-04-08 Jeffrey Stedfast <fejj@ximian.com>
|
||||
|
||||
* em-folder-tree.c (emft_drop_folder): We need to recursively copy
|
||||
the dragged folder tree over to the drop location, not just the
|
||||
parent folder. We also need to subscribe to the newly created
|
||||
folder in some cases.
|
||||
|
||||
2004-04-08 Not Zed <NotZed@Ximian.com>
|
||||
|
||||
* em-format-html.c (efh_format_headers): add the monkey button if
|
||||
|
||||
@ -744,6 +744,51 @@ emft_drop_uid_list(struct _DragDataReceivedAsync *m, CamelFolder *dest)
|
||||
m->moved = m->move && !camel_exception_is_set(&m->msg.ex);
|
||||
}
|
||||
|
||||
static void
|
||||
emft_drop_folder_rec (CamelStore *store, CamelFolderInfo *fi, const char *parent_name, CamelException *ex)
|
||||
{
|
||||
CamelFolder *src, *dest;
|
||||
CamelFolderInfo *nfi;
|
||||
char *new_name;
|
||||
|
||||
while (fi != NULL) {
|
||||
if (!(src = mail_tool_uri_to_folder (fi->uri, 0, ex)))
|
||||
break;
|
||||
|
||||
/* handles dropping to the root properly */
|
||||
if (parent_name[0])
|
||||
new_name = g_strdup_printf ("%s/%s", parent_name, src->name);
|
||||
else
|
||||
new_name = g_strdup (src->name);
|
||||
|
||||
if ((nfi = camel_store_create_folder (store, parent_name, src->name, ex))) {
|
||||
camel_store_free_folder_info (store, nfi);
|
||||
|
||||
if (camel_store_supports_subscriptions (store))
|
||||
camel_store_subscribe_folder (store, new_name, ex);
|
||||
|
||||
/* copy the folder to the new location */
|
||||
if ((dest = camel_store_get_folder (store, new_name, 0, ex))) {
|
||||
GPtrArray *uids;
|
||||
|
||||
uids = camel_folder_get_uids (src);
|
||||
camel_folder_transfer_messages_to (src, uids, dest, NULL, FALSE, ex);
|
||||
camel_folder_free_uids (src, uids);
|
||||
|
||||
camel_object_unref (dest);
|
||||
}
|
||||
}
|
||||
|
||||
camel_object_unref (src);
|
||||
|
||||
if (fi->child)
|
||||
emft_drop_folder_rec (store, fi->child, new_name, ex);
|
||||
|
||||
g_free (new_name);
|
||||
fi = fi->next;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
emft_drop_folder(struct _DragDataReceivedAsync *m)
|
||||
{
|
||||
@ -766,19 +811,19 @@ emft_drop_folder(struct _DragDataReceivedAsync *m)
|
||||
camel_store_rename_folder(m->store, src->full_name, new_name, &m->msg.ex);
|
||||
m->moved = !camel_exception_is_set (&m->msg.ex);
|
||||
} else {
|
||||
CamelFolder *dest;
|
||||
CamelFolderInfo *fi, *nfi;
|
||||
|
||||
/* FIXME: should check we're not coming from a vfolder, otherwise bad stuff could happen */
|
||||
|
||||
/* copy the folder to the new location */
|
||||
if ((dest = camel_store_get_folder(m->store, new_name, CAMEL_STORE_FOLDER_CREATE_EXCL, &m->msg.ex))) {
|
||||
GPtrArray *uids;
|
||||
if ((fi = camel_store_get_folder_info (src->parent_store, src->full_name, CAMEL_STORE_FOLDER_INFO_FAST |
|
||||
CAMEL_STORE_FOLDER_INFO_RECURSIVE, &m->msg.ex))) {
|
||||
if (!(nfi = camel_store_get_folder_info (m->store, new_name, CAMEL_STORE_FOLDER_INFO_FAST, &m->msg.ex))) {
|
||||
/* Good. The folder doesn't already exist... */
|
||||
camel_exception_clear (&m->msg.ex);
|
||||
emft_drop_folder_rec (m->store, fi, m->full_name, &m->msg.ex);
|
||||
}
|
||||
|
||||
uids = camel_folder_get_uids (src);
|
||||
camel_folder_transfer_messages_to (src, uids, dest, NULL, FALSE, &m->msg.ex);
|
||||
camel_folder_free_uids (src, uids);
|
||||
|
||||
camel_object_unref (dest);
|
||||
camel_store_free_folder_info (src->parent_store, fi);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user