--- evolution-2.28.0/mail/em-migrate.c.orig	2009-10-13 17:26:42.075924746 +0800
+++ evolution-2.28.0/mail/em-migrate.c	2009-10-13 17:26:44.883805163 +0800
@@ -75,6 +75,8 @@
 
 #define d(x)
 
+static gboolean update_label_in_main_thread (const gchar *folder_name);
+
 #ifndef G_OS_WIN32
 /* No versions previous to 2.8 or thereabouts have been available on
  * Windows, so don't bother with upgrade support from earlier versions
@@ -1170,8 +1172,6 @@
 	g_free (text);
 
 	gtk_progress_bar_set_fraction (progress, 0.0);
-	while (gtk_events_pending ())
-		gtk_main_iteration ();
 }
 
 static void
@@ -1535,6 +1535,7 @@
 	gint index, i;
 	GString *src, *dest;
 	gint res = -1;
+	gchar *tmp;
 
 	src = g_string_new("");
 
@@ -1549,7 +1550,11 @@
 
 	dest = g_string_new("");
 	uri = get_local_store_uri(dirname, &name, &index);
-	em_migrate_set_folder_name (full_name);
+	tmp = g_strdup (full_name);
+	g_idle_add ((GSourceFunc) update_label_in_main_thread, tmp);
+	while (gtk_events_pending ())
+		gtk_main_iteration ();
+
 	thread_list = get_local_et_expanded (dirname);
 
 	/* Manually copy local mbox files, its much faster */
@@ -2767,26 +2772,37 @@
 update_progress_in_main_thread (double *progress)
 {
 		em_migrate_set_progress (*progress);
+		g_free (progress);
 		return FALSE;
 }
 
+static gboolean
+update_label_in_main_thread (const gchar *folder_name)
+{
+	em_migrate_set_folder_name (folder_name);
+	g_free (folder_name);
+	return FALSE;
+}
+
 static void
 migrate_folders(CamelStore *store, gboolean is_local, CamelFolderInfo *fi, const gchar *acc, CamelException *ex, gboolean *done, gint *nth_folder, gint total_folders)
 {
 	CamelFolder *folder;
 
 	while (fi) {
-		double progress;
+		double * progress = (double *)g_malloc(sizeof(double));
 		gchar *tmp;
 
 		*nth_folder = *nth_folder + 1;
 
 		tmp = g_strdup_printf ("%s/%s", acc, fi->full_name);
-		em_migrate_set_folder_name (tmp);
-		g_free (tmp);
+		g_idle_add ((GSourceFunc) update_label_in_main_thread, tmp);
+
+		while (gtk_events_pending ())
+			gtk_main_iteration ();
 
-		progress = (double) (*nth_folder) / total_folders;
-		g_idle_add ((GSourceFunc) update_progress_in_main_thread, &progress);
+		*progress = (double) (*nth_folder) / total_folders;
+		g_idle_add ((GSourceFunc) update_progress_in_main_thread, progress);
 
 		if (is_local)
 				folder = camel_store_get_folder (store, fi->full_name, CAMEL_STORE_IS_MIGRATING, ex);
