Index: shell/e-shell-window-commands.c
===================================================================
--- shell/e-shell-window-commands.c	(revision 33467)
+++ shell/e-shell-window-commands.c	(working copy)
@@ -757,7 +757,7 @@
 static EPixmap pixmaps [] = {
 	E_PIXMAP ("/commands/SendReceive", "stock_mail-send-receive", E_ICON_SIZE_MENU),
 	E_PIXMAP ("/Toolbar/SendReceive", "stock_mail-send-receive", E_ICON_SIZE_LARGE_TOOLBAR),
-	E_PIXMAP ("/menu/File/OpenNewWindow", "stock_new-window", E_ICON_SIZE_MENU),
+	E_PIXMAP ("/menu/File/OpenNewWindow", "window-new", E_ICON_SIZE_MENU),
 	E_PIXMAP ("/menu/File/FileImporter", "stock_mail-import", E_ICON_SIZE_MENU),
 	E_PIXMAP ("/menu/File/ToggleOffline", "stock_disconnect", E_ICON_SIZE_MENU),
 	E_PIXMAP ("/menu/Edit/Settings", "gnome-settings", E_ICON_SIZE_MENU),
Index: mail/message-list.h
===================================================================
--- mail/message-list.h	(revision 33467)
+++ mail/message-list.h	(working copy)
@@ -102,11 +102,12 @@
 	GHashTable *uid_nodemap; /* uid (from info) -> tree node mapping */
 	
 	GHashTable *normalised_hash;
+	GStringChunk *string_chunk;
 	
 	/* UID's to hide.  Keys in the mempool */
 	/* IMPORTANT: You MUST have obtained the hide lock, to operate on this data */
 	GHashTable	 *hidden;
-	struct _EMemPool *hidden_pool;
+	GStringChunk	 *hidden_string_chunk;
 	int hide_unhidden;           /* total length, before hiding */
 	int hide_before, hide_after; /* hide ranges of messages */
 	
Index: mail/message-list.c
===================================================================
--- mail/message-list.c	(revision 33467)
+++ mail/message-list.c	(working copy)
@@ -414,70 +414,28 @@
 	return info;
 }
 
-static const char *
-get_normalised_string (MessageList *message_list, CamelMessageInfo *info, int col)
+static const gchar *
+get_normalised_string (MessageList *message_list, const gchar *string)
 {
-	const char *string, *str;
-	char *normalised;
-	EPoolv *poolv;
-	int index;
-	
-	switch (col) {
-	case COL_SUBJECT_NORM:
-		string = camel_message_info_subject (info);
-		index = NORMALISED_SUBJECT;
-		break;
-	case COL_FROM_NORM:
-		string = camel_message_info_from (info);
-		index = NORMALISED_FROM;
-		break;
-	case COL_TO_NORM:
-		string = camel_message_info_to (info);
-		index = NORMALISED_TO;
-		break;
-	default:
-		string = NULL;
-		index = NORMALISED_LAST;
-		g_assert_not_reached ();
-	}
-	
-	/* slight optimisation */
-	if (string == NULL || string[0] == '\0')
+	GHashTable *hash_table = message_list->normalised_hash;
+	GStringChunk *string_chunk = message_list->string_chunk;
+	gchar *collation_key, *temp;
+
+	if (string == NULL || *string == '\0')
 		return "";
-	
-	poolv = g_hash_table_lookup (message_list->normalised_hash, camel_message_info_uid (info));
-	if (poolv == NULL) {
-		poolv = e_poolv_new (NORMALISED_LAST);
-		g_hash_table_insert (message_list->normalised_hash, (char *) camel_message_info_uid (info), poolv);
-	} else {
-		str = e_poolv_get (poolv, index);
-		if (*str)
-			return str;
-	}
-	
-	if (col == COL_SUBJECT_NORM) {
-		const unsigned char *subject;
-		
-		subject = (const unsigned char *) string;
-		while (!g_ascii_strncasecmp (subject, "Re:", 3)) {
-			subject += 3;
-			
-			/* jump over any spaces */
-			while (*subject && isspace ((int) *subject))
-				subject++;
-		}
-		
-		/* jump over any spaces */
-		while (*subject && isspace ((int) *subject))
-			subject++;
-		
-		string = (const char *) subject;
-	}
-	
-	normalised = g_utf8_collate_key (string, -1);
-	e_poolv_set (poolv, index, normalised, TRUE);
-	
-	return e_poolv_get (poolv, index);
+
+	collation_key = g_hash_table_lookup (hash_table, string);
+	if (collation_key != NULL)
+		return collation_key;
+
+	temp = g_utf8_collate_key (string, -1);
+	collation_key = g_string_chunk_insert_const (string_chunk, temp);
+	g_free (temp);
+
+	temp = g_string_chunk_insert_const (string_chunk, string);
+	g_hash_table_insert (hash_table, temp, collation_key);
+
+	return collation_key;
 }
 
 static void
@@ -1285,12 +1243,23 @@
 		str = camel_message_info_from (msg_info);
 		return (void *)(str ? str : "");
 	case COL_FROM_NORM:
-		return (void *) get_normalised_string (message_list, msg_info, col);
+		str = camel_message_info_from (msg_info);
+		return (void *) get_normalised_string (message_list, str);
 	case COL_SUBJECT:
 		str = camel_message_info_subject (msg_info);
 		return (void *)(str ? str : "");
 	case COL_SUBJECT_NORM:
-		return (void *) get_normalised_string (message_list, msg_info, col);
+		str = camel_message_info_subject (msg_info);
+		while (str != NULL && *str != '\0') {
+			/* skip over spaces and reply prefixes */
+			if (g_ascii_strncasecmp (str, "Re:", 3) == 0)
+				str += 3;
+			else if (g_ascii_isspace (*str))
+				str++;
+			else
+				break;
+		}
+		return (void *) get_normalised_string (message_list, str);
 	case COL_SENT: {
 		ETreePath child;
 
@@ -1314,7 +1283,8 @@
 		str = camel_message_info_to (msg_info);
 		return (void *)(str ? str : "");
 	case COL_TO_NORM:
-		return (void *) get_normalised_string (message_list, msg_info, col);
+		str = camel_message_info_to (msg_info);
+		return (void *) get_normalised_string (message_list, str);
 	case COL_SIZE:
 		return GINT_TO_POINTER (camel_message_info_size(msg_info));
 	case COL_DELETED:
@@ -2026,9 +1996,10 @@
 	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (message_list), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
 	
 	message_list->normalised_hash = g_hash_table_new (g_str_hash, g_str_equal);
+	message_list->string_chunk = g_string_chunk_new (1024);
 	
 	message_list->hidden = NULL;
-	message_list->hidden_pool = NULL;
+	message_list->hidden_string_chunk = NULL;
 	message_list->hide_before = ML_HIDE_NONE_START;
 	message_list->hide_after = ML_HIDE_NONE_END;
 	
@@ -2056,14 +2027,6 @@
 	g_signal_connect (((GtkScrolledWindow *) message_list)->vscrollbar, "value-changed", G_CALLBACK (ml_scrolled), message_list);
 }
 
-static gboolean
-normalised_free (gpointer key, gpointer value, gpointer user_data)
-{
-	e_poolv_destroy (value);
-	
-	return TRUE;
-}
-
 static void
 message_list_destroy(GtkObject *object)
 {
@@ -2129,17 +2092,17 @@
 	MessageList *message_list = MESSAGE_LIST (object);
 	struct _MessageListPrivate *p = message_list->priv;
 	
-	g_hash_table_foreach (message_list->normalised_hash, (GHFunc) normalised_free, NULL);
 	g_hash_table_destroy (message_list->normalised_hash);
+	g_string_chunk_free (message_list->string_chunk);
 	
 	if (message_list->thread_tree)
 		camel_folder_thread_messages_unref(message_list->thread_tree);
 
 	if (message_list->hidden) {
 		g_hash_table_destroy(message_list->hidden);
-		e_mempool_destroy(message_list->hidden_pool);
+		g_string_chunk_free(message_list->hidden_string_chunk);
 		message_list->hidden = NULL;
-		message_list->hidden_pool = NULL;
+		message_list->hidden_string_chunk = NULL;
 	}
 
 	g_free(message_list->search);
@@ -2997,17 +2960,6 @@
 		d(printf("changed = %d added = %d removed = %d\n",
 			 changes->uid_changed->len, changes->uid_added->len, changes->uid_removed->len));
 		
-		for (i = 0; i < changes->uid_removed->len; i++) {
-			/* uncache the normalised strings for these uids */
-			EPoolv *poolv;
-			
-			poolv = g_hash_table_lookup (ml->normalised_hash, changes->uid_removed->pdata[i]);
-			if (poolv != NULL) {
-				g_hash_table_remove (ml->normalised_hash, changes->uid_removed->pdata[i]);
-				e_poolv_destroy (poolv);
-			}
-		}
-		
 		/* check if the hidden state has changed, if so modify accordingly, then regenerate */
 		if (ml->hidejunk || ml->hidedeleted)
 			mail_folder_hide_by_flag (folder, ml, &changes, (ml->hidejunk ? CAMEL_MESSAGE_JUNK : 0) | (ml->hidedeleted ? CAMEL_MESSAGE_DELETED : 0));
@@ -3085,7 +3037,11 @@
 	}
 	
 	/* reset the normalised sort performance hack */
-	g_hash_table_foreach_remove (message_list->normalised_hash, normalised_free, NULL);
+	/* XXX GLib 2.12 added g_hash_table_remove_all() */
+	g_hash_table_destroy (message_list->normalised_hash);
+	message_list->normalised_hash = g_hash_table_new (g_str_hash, g_str_equal);
+	g_string_chunk_free (message_list->string_chunk);
+	message_list->string_chunk = g_string_chunk_new (1024);
 	
 	mail_regen_cancel(message_list);
 	
@@ -3536,14 +3492,14 @@
 			MESSAGE_LIST_LOCK (ml, hide_lock);
 			if (ml->hidden == NULL) {
 				ml->hidden = g_hash_table_new (g_str_hash, g_str_equal);
-				ml->hidden_pool = e_mempool_new (512, 256, E_MEMPOOL_ALIGN_BYTE);
+				ml->hidden_string_chunk = g_string_chunk_new (512);
 			}
 			
-			uid =  e_mempool_strdup (ml->hidden_pool, uids->pdata[i]);
+			uid = g_string_chunk_insert (ml->hidden_string_chunk, uids->pdata[i]);
 			g_hash_table_insert (ml->hidden, uid, uid);
 			for ( ; i < uids->len; i++) {
 				if (g_hash_table_lookup (ml->uid_nodemap, uids->pdata[i])) {
-					uid =  e_mempool_strdup (ml->hidden_pool, uids->pdata[i]);
+					uid = g_string_chunk_insert (ml->hidden_string_chunk, uids->pdata[i]);
 					g_hash_table_insert (ml->hidden, uid, uid);
 				}
 			}
@@ -3564,9 +3520,9 @@
 	MESSAGE_LIST_LOCK (ml, hide_lock);
 	if (ml->hidden) {
 		g_hash_table_destroy (ml->hidden);
-		e_mempool_destroy (ml->hidden_pool);
+		g_string_chunk_free (ml->hidden_string_chunk);
 		ml->hidden = NULL;
-		ml->hidden_pool = NULL;
+		ml->hidden_string_chunk = NULL;
 	}
 	ml->hide_before = ML_HIDE_NONE_START;
 	ml->hide_after = ML_HIDE_NONE_END;
@@ -3602,9 +3558,9 @@
 	MESSAGE_LIST_LOCK(ml, hide_lock);
 	if (ml->hidden) {
 		g_hash_table_destroy (ml->hidden);
-		e_mempool_destroy (ml->hidden_pool);
+		g_string_chunk_free (ml->hidden_string_chunk);
 		ml->hidden = NULL;
-		ml->hidden_pool = NULL;
+		ml->hidden_string_chunk = NULL;
 	}
 	ml->hide_before = ML_HIDE_NONE_START;
 	ml->hide_after = ML_HIDE_NONE_END;
@@ -3615,7 +3571,7 @@
 		camel_file_util_decode_fixed_int32 (in, &version);
 		if (version == HIDE_STATE_VERSION) {
 			ml->hidden = g_hash_table_new(g_str_hash, g_str_equal);
-			ml->hidden_pool = e_mempool_new(512, 256, E_MEMPOOL_ALIGN_BYTE);
+			ml->hidden_string_chunk = g_string_chunk_new(512);
 			camel_file_util_decode_fixed_int32 (in, &lower);
 			ml->hide_before = lower;
 			camel_file_util_decode_fixed_int32 (in, &upper);
@@ -3624,7 +3580,7 @@
 				char *olduid, *uid;
 				
 				if (camel_file_util_decode_string (in, &olduid) != -1) {
-					uid =  e_mempool_strdup(ml->hidden_pool, olduid);
+					uid = g_string_chunk_insert(ml->hidden_string_chunk, olduid);
 					g_free (olduid);
 					g_hash_table_insert(ml->hidden, uid, uid);
 				}
@@ -3774,12 +3730,12 @@
 			
 			if (m->ml->hidden == NULL) {
 				m->ml->hidden = g_hash_table_new (g_str_hash, g_str_equal);
-				m->ml->hidden_pool = e_mempool_new (512, 256, E_MEMPOOL_ALIGN_BYTE);
+				m->ml->hidden_string_chunk = g_string_chunk_new (512);
 			}
 			
 			for (i = 0; i < uidnew->len; i++) {
 				if (g_hash_table_lookup (m->ml->hidden, uidnew->pdata[i]) == 0) {
-					char *uid = e_mempool_strdup (m->ml->hidden_pool, uidnew->pdata[i]);
+					char *uid = g_string_chunk_insert (m->ml->hidden_string_chunk, uidnew->pdata[i]);
 					g_hash_table_insert (m->ml->hidden, uid, uid);
 				}
 			}
