diff options
author | Not Zed <NotZed@Ximian.com> | 2005-08-10 10:04:31 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2005-08-10 10:04:31 +0800 |
commit | e14a0019e799ea6c91ca6320ab0ca6c3c89dc7b6 (patch) | |
tree | 11de1e177b25c26eed619ef60b187fc1835aba66 /mail/em-folder-tree.c | |
parent | 7bbb6938b70d7eef0de8e17de3541e447682d9c9 (diff) | |
download | gsoc2013-evolution-e14a0019e799ea6c91ca6320ab0ca6c3c89dc7b6.tar.gz gsoc2013-evolution-e14a0019e799ea6c91ca6320ab0ca6c3c89dc7b6.tar.zst gsoc2013-evolution-e14a0019e799ea6c91ca6320ab0ca6c3c89dc7b6.zip |
** See #312715.
2005-08-09 Not Zed <NotZed@Ximian.com>
** See #312715.
* em-folder-tree.c (emft_drop_folder_rec): removed.
(emft_drop_folder): call em_folder_utils_copy_folders to perform
the operation rather than: doing it sync when it shouldn't be, and
2; copying code redundantly.
* em-folder-utils.c (em_folder_utils_move_folder): remove this
redundant api.
(em_folder_utils_copy_folder): add delete flag.
(em_folder_utils_copy_folders): export this function. fix strange
argument order.
svn path=/trunk/; revision=30066
Diffstat (limited to 'mail/em-folder-tree.c')
-rw-r--r-- | mail/em-folder-tree.c | 89 |
1 files changed, 8 insertions, 81 deletions
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index 5546bf7748..c3da19e64f 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -822,89 +822,16 @@ struct _DragDataReceivedAsync { }; 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 && 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) { CamelFolder *src; - char *new_name; d(printf(" * Drop folder '%s' onto '%s'\n", m->selection->data, m->full_name)); if (!(src = mail_tool_uri_to_folder(m->selection->data, 0, &m->msg.ex))) return; - - /* handles dropping to the root properly */ - if (m->full_name) - new_name = g_strdup_printf("%s/%s", m->full_name, src->name); - else - new_name = g_strdup(src->name); - - if (src->parent_store == m->store && m->move) { - /* simple case, rename */ - camel_store_rename_folder(m->store, src->full_name, new_name, &m->msg.ex); - m->moved = !camel_exception_is_set (&m->msg.ex); - } else { - CamelFolderInfo *fi, *nfi; - - /* FIXME: should check we're not coming from a vfolder, otherwise bad stuff could happen */ - - 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); - } - - camel_store_free_folder_info (src->parent_store, fi); - } - } - - g_free(new_name); + + em_folder_utils_copy_folders(src->parent_store, src->full_name, m->store, m->full_name?m->full_name:"", m->move); camel_object_unref(src); } @@ -2005,9 +1932,9 @@ emft_popup_copy(EPopup *ep, EPopupItem *item, void *data) EMFolderTree *emft = data; CamelFolderInfo *fi = NULL; - if ((fi = em_folder_tree_get_selected_folder_info (emft)) != NULL) { - em_folder_utils_copy_folder (fi); - } + /* FIXME: use async apis */ + if ((fi = em_folder_tree_get_selected_folder_info (emft)) != NULL) + em_folder_utils_copy_folder(fi, FALSE); } static void @@ -2016,9 +1943,9 @@ emft_popup_move(EPopup *ep, EPopupItem *item, void *data) EMFolderTree *emft = data; CamelFolderInfo *fi = NULL; - if ((fi = em_folder_tree_get_selected_folder_info (emft)) != NULL) { - em_folder_utils_move_folder(fi); - } + /* FIXME: use async apis */ + if ((fi = em_folder_tree_get_selected_folder_info (emft)) != NULL) + em_folder_utils_copy_folder(fi, TRUE); } static void |