diff options
author | David Woodhouse <David.Woodhouse@intel.com> | 2011-04-15 21:57:39 +0800 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2011-04-15 22:06:38 +0800 |
commit | b63b75b111a4cf6de8c8d3406cf33509c6146d75 (patch) | |
tree | 7acaba8a78e6be486b91118acf60e6fc3168654a | |
parent | ca0d2d390d80fdc81e08ace8fba6f632d2b3a573 (diff) | |
download | gsoc2013-evolution-b63b75b111a4cf6de8c8d3406cf33509c6146d75.tar.gz gsoc2013-evolution-b63b75b111a4cf6de8c8d3406cf33509c6146d75.tar.zst gsoc2013-evolution-b63b75b111a4cf6de8c8d3406cf33509c6146d75.zip |
Bug 647816 - Moving folder hierarchy causes error
When *moving*, as opposed to copying, we only need to operate on the top-level
folder; its children will automatically follow it.
(cherry picked from commit d44fb9e2cf43ebec0ffc811d6d1f9f6e28ccefae)
-rw-r--r-- | mail/em-folder-utils.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c index c7fee4b27c..3c2ecbd263 100644 --- a/mail/em-folder-utils.c +++ b/mail/em-folder-utils.c @@ -97,13 +97,18 @@ emft_copy_folders__desc (struct _EMCopyFolders *m, gint complete) static void emft_copy_folders__exec (struct _EMCopyFolders *m) { - guint32 flags = CAMEL_STORE_FOLDER_INFO_FAST | CAMEL_STORE_FOLDER_INFO_RECURSIVE | CAMEL_STORE_FOLDER_INFO_SUBSCRIBED; + guint32 flags = CAMEL_STORE_FOLDER_INFO_FAST | CAMEL_STORE_FOLDER_INFO_SUBSCRIBED; GList *pending = NULL, *deleting = NULL, *l; GString *fromname, *toname; CamelFolderInfo *fi; const gchar *tmp; gint fromlen; + /* If we're copying, then we need to copy every subfolder. If we're + *moving*, though, then we only need to rename the top-level folder */ + if (!m->delete) + flags |= CAMEL_STORE_FOLDER_INFO_RECURSIVE; + fi = camel_store_get_folder_info ( m->fromstore, m->frombase, flags, &m->base.error); if (fi == NULL) @@ -131,7 +136,10 @@ emft_copy_folders__exec (struct _EMCopyFolders *m) GPtrArray *uids; gint deleted = 0; - if (info->child) + /* We still get immediate children even without the + CAMEL_STORE_FOLDER_INFO_RECURSIVE flag. But we only + want to process the children too if we're *copying* */ + if (info->child && !m->delete) pending = g_list_append (pending, info->child); if (m->tobase[0]) |