[evolution/gnome-2-32] Bug 647816 - Moving folder hierarchy causes error



commit b63b75b111a4cf6de8c8d3406cf33509c6146d75
Author: David Woodhouse <David Woodhouse intel com>
Date:   Fri Apr 15 14:57:39 2011 +0100

    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)

 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 c7fee4b..3c2ecbd 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])



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]