2011-07-03 [paul] 3.7.9cvs28
[claws.git] / src / summaryview.c
index 25116b9e233d6a2555d272240ba2edd708f3f7eb..0128ed6ca2702c076c638b941feaa005649d7b3a 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2008 Hiroyuki Yamamoto and the Claws Mail team
+ * Copyright (C) 1999-2011 Hiroyuki Yamamoto and the Claws Mail team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -22,7 +22,6 @@
 #include <glib.h>
 #include <glib/gi18n.h>
 #include <gdk/gdkkeysyms.h>
-#include <gtk/gtkscrolledwindow.h>
 #include <gtk/gtk.h>
 
 #include <stdio.h>
@@ -72,7 +71,6 @@
 #include "partial_download.h"
 #include "tags.h"
 #include "timing.h"
-#include "gedit-print.h"
 #include "log.h"
 #include "edittags.h"
 #include "manual.h"
@@ -90,77 +88,63 @@ static GtkStyle *small_style;
 static GtkStyle *small_marked_style;
 static GtkStyle *small_deleted_style;
 
-static GdkPixmap *markxpm;
-static GdkBitmap *markxpmmask;
-static GdkPixmap *deletedxpm;
-static GdkBitmap *deletedxpmmask;
-static GdkPixmap *movedxpm;
-static GdkBitmap *movedxpmmask;
-static GdkPixmap *copiedxpm;
-static GdkBitmap *copiedxpmmask;
-
-static GdkPixmap *newxpm;
-static GdkBitmap *newxpmmask;
-static GdkPixmap *unreadxpm;
-static GdkBitmap *unreadxpmmask;
-static GdkPixmap *repliedxpm;
-static GdkBitmap *repliedxpmmask;
-static GdkPixmap *forwardedxpm;
-static GdkBitmap *forwardedxpmmask;
-static GdkPixmap *ignorethreadxpm;
-static GdkBitmap *ignorethreadxpmmask;
-static GdkPixmap *watchthreadxpm;
-static GdkBitmap *watchthreadxpmmask;
-static GdkPixmap *lockedxpm;
-static GdkBitmap *lockedxpmmask;
-static GdkPixmap *spamxpm;
-static GdkBitmap *spamxpmmask;
-
-static GdkPixmap *clipxpm;
-static GdkBitmap *clipxpmmask;
-static GdkPixmap *keyxpm;
-static GdkBitmap *keyxpmmask;
-static GdkPixmap *clipkeyxpm;
-static GdkBitmap *clipkeyxpmmask;
-static GdkPixmap *gpgsignedxpm;
-static GdkBitmap *gpgsignedxpmmask;
-static GdkPixmap *clipgpgsignedxpm;
-static GdkBitmap *clipgpgsignedxpmmask;
-
-static void summary_free_msginfo_func  (GtkCTree               *ctree,
-                                        GtkCTreeNode           *node,
+static GdkPixbuf *markxpm;
+static GdkPixbuf *deletedxpm;
+static GdkPixbuf *movedxpm;
+static GdkPixbuf *copiedxpm;
+
+static GdkPixbuf *newxpm;
+static GdkPixbuf *unreadxpm;
+static GdkPixbuf *repliedxpm;
+static GdkPixbuf *forwardedxpm;
+static GdkPixbuf *ignorethreadxpm;
+static GdkPixbuf *watchthreadxpm;
+static GdkPixbuf *lockedxpm;
+static GdkPixbuf *spamxpm;
+
+static GdkPixbuf *clipxpm;
+static GdkPixbuf *keyxpm;
+static GdkPixbuf *clipkeyxpm;
+static GdkPixbuf *keysignxpm;
+static GdkPixbuf *gpgsignedxpm;
+static GdkPixbuf *clipgpgsignedxpm;
+
+static void summary_free_msginfo_func  (GtkCMCTree             *ctree,
+                                        GtkCMCTreeNode         *node,
                                         gpointer                data);
-static void summary_set_marks_func     (GtkCTree               *ctree,
-                                        GtkCTreeNode           *node,
+static void summary_set_marks_func     (GtkCMCTree             *ctree,
+                                        GtkCMCTreeNode         *node,
                                         gpointer                data);
 
 void  summary_set_menu_sensitive       (SummaryView            *summaryview);
 guint summary_get_msgnum               (SummaryView            *summaryview,
-                                        GtkCTreeNode           *node);
+                                        GtkCMCTreeNode         *node);
 
 
 static void summary_set_hide_read_msgs_menu (SummaryView *summaryview,
                                             guint action);
+static void summary_set_hide_del_msgs_menu (SummaryView *summaryview,
+                                            guint action);
 
-static GtkCTreeNode *summary_find_prev_msg
+static GtkCMCTreeNode *summary_find_prev_msg
                                        (SummaryView            *summaryview,
-                                        GtkCTreeNode           *current_node);
-static GtkCTreeNode *summary_find_next_msg
+                                        GtkCMCTreeNode         *current_node);
+static GtkCMCTreeNode *summary_find_next_msg
                                        (SummaryView            *summaryview,
-                                        GtkCTreeNode           *current_node);
+                                        GtkCMCTreeNode         *current_node);
 
-static GtkCTreeNode *summary_find_prev_flagged_msg
+static GtkCMCTreeNode *summary_find_prev_flagged_msg
                                        (SummaryView    *summaryview,
-                                        GtkCTreeNode   *current_node,
+                                        GtkCMCTreeNode *current_node,
                                         MsgPermFlags    flags,
                                         gboolean        start_from_prev);
-static GtkCTreeNode *summary_find_next_flagged_msg
+static GtkCMCTreeNode *summary_find_next_flagged_msg
                                        (SummaryView    *summaryview,
-                                        GtkCTreeNode   *current_node,
+                                        GtkCMCTreeNode *current_node,
                                         MsgPermFlags    flags,
                                         gboolean        start_from_next);
 
-static GtkCTreeNode *summary_find_msg_by_msgnum
+static GtkCMCTreeNode *summary_find_msg_by_msgnum
                                        (SummaryView            *summaryview,
                                         guint                   msgnum);
 
@@ -175,59 +159,60 @@ static inline void summary_set_header     (SummaryView            *summaryview,
                                         gchar                  *text[],
                                         MsgInfo                *msginfo);
 static void summary_display_msg                (SummaryView            *summaryview,
-                                        GtkCTreeNode           *row);
+                                        GtkCMCTreeNode         *row);
 static void summary_display_msg_full   (SummaryView            *summaryview,
-                                        GtkCTreeNode           *row,
+                                        GtkCMCTreeNode         *row,
                                         gboolean                new_window,
                                         gboolean                all_headers);
 static void summary_set_row_marks      (SummaryView            *summaryview,
-                                        GtkCTreeNode           *row);
+                                        GtkCMCTreeNode         *row);
 
 static gboolean summary_set_row_tag    (SummaryView            *summaryview, 
-                                        GtkCTreeNode           *row, 
+                                        GtkCMCTreeNode                 *row, 
                                         gboolean                refresh,
                                         gboolean                set, 
                                         gint                    id);
 /* message handling */
 static void summary_mark_row           (SummaryView            *summaryview,
-                                        GtkCTreeNode           *row);
+                                        GtkCMCTreeNode         *row);
 static void summary_lock_row           (SummaryView            *summaryview,
-                                        GtkCTreeNode           *row);
+                                        GtkCMCTreeNode         *row);
 static void summary_unlock_row         (SummaryView            *summaryview,
-                                        GtkCTreeNode           *row);
+                                        GtkCMCTreeNode         *row);
 static void summary_mark_row_as_read   (SummaryView            *summaryview,
-                                        GtkCTreeNode           *row);
+                                        GtkCMCTreeNode         *row);
 static void summary_mark_row_as_unread (SummaryView            *summaryview,
-                                        GtkCTreeNode           *row);
+                                        GtkCMCTreeNode         *row);
 static void summary_delete_row         (SummaryView            *summaryview,
-                                        GtkCTreeNode           *row);
+                                        GtkCMCTreeNode         *row);
 static void summary_unmark_row         (SummaryView            *summaryview,
-                                        GtkCTreeNode           *row);
+                                        GtkCMCTreeNode         *row);
 static void summary_move_row_to                (SummaryView            *summaryview,
-                                        GtkCTreeNode           *row,
+                                        GtkCMCTreeNode         *row,
                                         FolderItem             *to_folder);
 static void summary_copy_row_to                (SummaryView            *summaryview,
-                                        GtkCTreeNode           *row,
+                                        GtkCMCTreeNode         *row,
                                         FolderItem             *to_folder);
 
 static gint summary_execute_move       (SummaryView            *summaryview);
-static void summary_execute_move_func  (GtkCTree               *ctree,
-                                        GtkCTreeNode           *node,
+static void summary_execute_move_func  (GtkCMCTree             *ctree,
+                                        GtkCMCTreeNode         *node,
                                         gpointer                data);
 static void summary_execute_copy       (SummaryView            *summaryview);
-static void summary_execute_copy_func  (GtkCTree               *ctree,
-                                        GtkCTreeNode           *node,
+static void summary_execute_copy_func  (GtkCMCTree             *ctree,
+                                        GtkCMCTreeNode         *node,
                                         gpointer                data);
 static void summary_execute_delete     (SummaryView            *summaryview);
-static void summary_execute_delete_func        (GtkCTree               *ctree,
-                                        GtkCTreeNode           *node,
+static void summary_execute_delete_func        (GtkCMCTree             *ctree,
+                                        GtkCMCTreeNode         *node,
                                         gpointer                data);
+static void summary_execute_expunge    (SummaryView            *summaryview);
 
 static void summary_thread_init                (SummaryView            *summaryview);
 
 static void summary_unthread_for_exec          (SummaryView    *summaryview);
-static void summary_unthread_for_exec_func     (GtkCTree       *ctree,
-                                                GtkCTreeNode   *node,
+static void summary_unthread_for_exec_func     (GtkCMCTree     *ctree,
+                                                GtkCMCTreeNode *node,
                                                 gpointer        data);
 
 void summary_simplify_subject(SummaryView *summaryview, gchar * rexp,
@@ -276,44 +261,24 @@ static gboolean summary_button_released   (GtkWidget              *ctree,
 static gboolean summary_key_pressed    (GtkWidget              *ctree,
                                         GdkEventKey            *event,
                                         SummaryView            *summaryview);
-static void summary_tree_expanded      (GtkCTree               *ctree,
-                                        GtkCTreeNode           *node,
+static void summary_tree_expanded      (GtkCMCTree             *ctree,
+                                        GtkCMCTreeNode         *node,
                                         SummaryView            *summaryview);
-static void summary_tree_collapsed     (GtkCTree               *ctree,
-                                        GtkCTreeNode           *node,
+static void summary_tree_collapsed     (GtkCMCTree             *ctree,
+                                        GtkCMCTreeNode         *node,
                                         SummaryView            *summaryview);
-static void summary_selected           (GtkCTree               *ctree,
-                                        GtkCTreeNode           *row,
+static void summary_selected           (GtkCMCTree             *ctree,
+                                        GtkCMCTreeNode         *row,
                                         gint                    column,
                                         SummaryView            *summaryview);
-static void summary_unselected         (GtkCTree               *ctree,
-                                        GtkCTreeNode           *row,
+static void summary_unselected         (GtkCMCTree             *ctree,
+                                        GtkCMCTreeNode         *row,
                                         gint                    column,
                                         SummaryView            *summaryview);
-static void summary_col_resized                (GtkCList               *clist,
+static void summary_col_resized                (GtkCMCList             *clist,
                                         gint                    column,
                                         gint                    width,
                                         SummaryView            *summaryview);
-static void summary_reply_cb           (SummaryView            *summaryview,
-                                        guint                   action,
-                                        GtkWidget              *widget);
-#ifndef GENERIC_UMPC
-static void summary_show_all_header_cb (SummaryView            *summaryview,
-                                        guint                   action,
-                                        GtkWidget              *widget);
-
-static void summary_add_address_cb     (SummaryView            *summaryview,
-                                        guint                   action,
-                                        GtkWidget              *widget);
-#endif
-static void summary_create_filter_cb   (SummaryView            *summaryview,
-                                        guint                   action,
-                                        GtkWidget              *widget);
-#ifndef GENERIC_UMPC
-static void summary_create_processing_cb(SummaryView           *summaryview,
-                                        guint                   action,
-                                        GtkWidget              *widget);
-#endif
 static void summary_mark_clicked       (GtkWidget              *button,
                                         SummaryView            *summaryview);
 static void summary_status_clicked     (GtkWidget              *button,
@@ -370,50 +335,50 @@ static void summary_drag_end(GtkWidget *widget,
                                          SummaryView    *summaryview);
 /* custom compare functions for sorting */
 
-static gint summary_cmp_by_mark                (GtkCList               *clist,
+static gint summary_cmp_by_mark                (GtkCMCList             *clist,
                                         gconstpointer           ptr1,
                                         gconstpointer           ptr2);
-static gint summary_cmp_by_status      (GtkCList               *clist,
+static gint summary_cmp_by_status      (GtkCMCList             *clist,
                                         gconstpointer           ptr1,
                                         gconstpointer           ptr2);
-static gint summary_cmp_by_mime                (GtkCList               *clist,
+static gint summary_cmp_by_mime                (GtkCMCList             *clist,
                                         gconstpointer           ptr1,
                                         gconstpointer           ptr2);
-static gint summary_cmp_by_num         (GtkCList               *clist,
+static gint summary_cmp_by_num         (GtkCMCList             *clist,
                                         gconstpointer           ptr1,
                                         gconstpointer           ptr2);
-static gint summary_cmp_by_size                (GtkCList               *clist,
+static gint summary_cmp_by_size                (GtkCMCList             *clist,
                                         gconstpointer           ptr1,
                                         gconstpointer           ptr2);
-static gint summary_cmp_by_date                (GtkCList               *clist,
+static gint summary_cmp_by_date                (GtkCMCList             *clist,
                                         gconstpointer           ptr1,
                                         gconstpointer           ptr2);
-static gint summary_cmp_by_thread_date (GtkCList               *clist,
+static gint summary_cmp_by_thread_date (GtkCMCList             *clist,
                                         gconstpointer           ptr1,
                                         gconstpointer           ptr2);
-static gint summary_cmp_by_from                (GtkCList               *clist,
+static gint summary_cmp_by_from                (GtkCMCList             *clist,
                                         gconstpointer           ptr1,
                                         gconstpointer           ptr2);
 static gint summary_cmp_by_simplified_subject
-                                       (GtkCList               *clist, 
+                                       (GtkCMCList             *clist, 
                                         gconstpointer           ptr1, 
                                         gconstpointer           ptr2);
-static gint summary_cmp_by_score       (GtkCList               *clist,
+static gint summary_cmp_by_score       (GtkCMCList             *clist,
                                         gconstpointer           ptr1,
                                         gconstpointer           ptr2);
-static gint summary_cmp_by_label       (GtkCList               *clist,
+static gint summary_cmp_by_label       (GtkCMCList             *clist,
                                         gconstpointer           ptr1,
                                         gconstpointer           ptr2);
-static gint summary_cmp_by_to          (GtkCList               *clist,
+static gint summary_cmp_by_to          (GtkCMCList             *clist,
                                         gconstpointer           ptr1,
                                         gconstpointer           ptr2);
-static gint summary_cmp_by_subject     (GtkCList               *clist,
+static gint summary_cmp_by_subject     (GtkCMCList             *clist,
                                         gconstpointer           ptr1,
                                         gconstpointer           ptr2);
-static gint summary_cmp_by_locked      (GtkCList               *clist,
+static gint summary_cmp_by_locked      (GtkCMCList             *clist,
                                         gconstpointer           ptr1, 
                                         gconstpointer           ptr2);
-static gint summary_cmp_by_tags                (GtkCList               *clist,
+static gint summary_cmp_by_tags                (GtkCMCList             *clist,
                                         gconstpointer           ptr1, 
                                         gconstpointer           ptr2);
 
@@ -428,15 +393,16 @@ static void summary_find_answers  (SummaryView    *summaryview,
 static gboolean summary_update_msg     (gpointer source, gpointer data);
 static gboolean summary_update_folder_item_hook(gpointer source, gpointer data);
 static gboolean summary_update_folder_hook(gpointer source, gpointer data);
-static void summary_set_colorlabel_color (GtkCTree             *ctree,
-                                  GtkCTreeNode         *node,
+static void summary_set_colorlabel_color (GtkCMCTree           *ctree,
+                                  GtkCMCTreeNode               *node,
                                   guint                 labelcolor);
 static void summary_thread_build(SummaryView *summaryview);
 
-GtkTargetEntry summary_drag_types[2] =
+GtkTargetEntry summary_drag_types[3] =
 {
        {"text/uri-list", 0, TARGET_MAIL_URI_LIST},
-       {"claws-mail/internal", GTK_TARGET_SAME_APP, TARGET_DUMMY}
+       {"claws-mail/internal", GTK_TARGET_SAME_APP, TARGET_DUMMY},
+       {"claws-mail/msg-path-list", 0, TARGET_MAIL_CM_PATH_LIST},
 };
 
 #define DO_ACTION(name, act) {                                         \
@@ -445,149 +411,19 @@ GtkTargetEntry summary_drag_types[2] =
        }                                                               \
 }
 
-static void summary_menu_cb(GtkAction *action, gpointer data)
-{
-       SummaryView *summaryview = (SummaryView *)data;
-       const gchar *a_name = gtk_action_get_name(action);
-       
-       DO_ACTION("SummaryViewPopup/Reply", summary_reply_cb(summaryview, COMPOSE_REPLY, NULL));
-#ifndef GENERIC_UMPC
-       DO_ACTION("SummaryViewPopup/ReplyTo/All", summary_reply_cb(summaryview, COMPOSE_REPLY_TO_ALL, NULL));
-       DO_ACTION("SummaryViewPopup/ReplyTo/Sender", summary_reply_cb(summaryview, COMPOSE_REPLY_TO_SENDER, NULL));
-       DO_ACTION("SummaryViewPopup/ReplyTo/MailingList", summary_reply_cb(summaryview, COMPOSE_REPLY_TO_LIST, NULL));
-#endif
-       DO_ACTION("SummaryViewPopup/Forward", summary_reply_cb(summaryview, COMPOSE_FORWARD_INLINE, NULL));
-#ifndef GENERIC_UMPC
-       DO_ACTION("SummaryViewPopup/ForwardAsAtt", summary_reply_cb(summaryview, COMPOSE_FORWARD_AS_ATTACH, NULL));
-       DO_ACTION("SummaryViewPopup/Redirect", summary_reply_cb(summaryview, COMPOSE_REDIRECT, NULL));
-#endif
-       DO_ACTION("SummaryViewPopup/Move", summary_move_to(summaryview));
-       DO_ACTION("SummaryViewPopup/Copy", summary_copy_to(summaryview));
-       DO_ACTION("SummaryViewPopup/Trash", summary_delete_trash(summaryview));
-#ifndef GENERIC_UMPC
-       DO_ACTION("SummaryViewPopup/Delete", summary_delete(summaryview));
-#endif
-       DO_ACTION("SummaryViewPopup/Mark/Mark", summary_mark(summaryview));
-       DO_ACTION("SummaryViewPopup/Mark/Unmark", summary_unmark(summaryview));
-       DO_ACTION("SummaryViewPopup/Mark/MarkUnread", summary_mark_as_unread(summaryview));
-       DO_ACTION("SummaryViewPopup/Mark/MarkRead", summary_mark_as_read(summaryview));
-       DO_ACTION("SummaryViewPopup/Mark/MarkAllRead", summary_mark_all_read(summaryview));
-       DO_ACTION("SummaryViewPopup/Mark/IgnoreThread", summary_ignore_thread(summaryview));
-       DO_ACTION("SummaryViewPopup/Mark/UnignoreThread", summary_unignore_thread(summaryview));
-       DO_ACTION("SummaryViewPopup/Mark/WatchThread", summary_watch_thread(summaryview));
-       DO_ACTION("SummaryViewPopup/Mark/UnwatchThread", summary_unwatch_thread(summaryview));
-       DO_ACTION("SummaryViewPopup/Mark/MarkSpam", summary_mark_as_spam(summaryview, 1, NULL));
-       DO_ACTION("SummaryViewPopup/Mark/MarkHam", summary_mark_as_spam(summaryview, 0, NULL));
-       DO_ACTION("SummaryViewPopup/Mark/Lock", summary_msgs_lock(summaryview));
-       DO_ACTION("SummaryViewPopup/Mark/Unlock", summary_msgs_unlock(summaryview));
-#ifndef GENERIC_UMPC
-       DO_ACTION("SummaryViewPopup/AddSenderToAB", summary_add_address_cb(summaryview, 0, 0)); 
-#endif
-       DO_ACTION("SummaryViewPopup/CreateFilterRule/Automatically", summary_create_filter_cb(summaryview, FILTER_BY_AUTO, NULL)); 
-       DO_ACTION("SummaryViewPopup/CreateFilterRule/ByFrom", summary_create_filter_cb(summaryview, FILTER_BY_FROM, NULL)); 
-       DO_ACTION("SummaryViewPopup/CreateFilterRule/ByTo", summary_create_filter_cb(summaryview, FILTER_BY_TO, NULL)); 
-       DO_ACTION("SummaryViewPopup/CreateFilterRule/BySubject", summary_create_filter_cb(summaryview, FILTER_BY_SUBJECT, NULL)); 
-#ifndef GENERIC_UMPC
-       DO_ACTION("SummaryViewPopup/CreateProcessingRule/Automatically", summary_create_processing_cb(summaryview, FILTER_BY_AUTO, NULL)); 
-       DO_ACTION("SummaryViewPopup/CreateProcessingRule/ByFrom", summary_create_processing_cb(summaryview, FILTER_BY_FROM, NULL)); 
-       DO_ACTION("SummaryViewPopup/CreateProcessingRule/ByTo", summary_create_processing_cb(summaryview, FILTER_BY_TO, NULL)); 
-       DO_ACTION("SummaryViewPopup/CreateProcessingRule/BySubject", summary_create_processing_cb(summaryview, FILTER_BY_SUBJECT, NULL)); 
-#endif
-       DO_ACTION("SummaryViewPopup/View/OpenInNewWindow", summary_open_msg(summaryview)); 
-       DO_ACTION("SummaryViewPopup/View/MessageSource", summary_view_source(summaryview)); 
-       DO_ACTION("SummaryViewPopup/SaveAs", summary_save_as(summaryview)); 
-#ifndef GENERIC_UMPC
-       DO_ACTION("SummaryViewPopup/Print", summary_print(summaryview)); 
-#endif
-#ifndef GENERIC_UMPC
-       DO_ACTION("SummaryViewPopup/View/AllHeaders", summary_show_all_header_cb(summaryview, 0, 0)); 
-#endif
-}
-
 static GtkActionEntry summary_popup_entries[] =
 {
        {"SummaryViewPopup",                            NULL, "SummaryViewPopup" },
-       {"SummaryViewPopup/Reply",                      NULL, N_("_Reply"), "<control>R", NULL, G_CALLBACK(summary_menu_cb) },
-#ifndef GENERIC_UMPC
-       {"SummaryViewPopup/ReplyTo",                    NULL, "Repl_y to" },
-       {"SummaryViewPopup/ReplyTo/All",                NULL, N_("_all"), "<shift><control>R", NULL, G_CALLBACK(summary_menu_cb) },
-       {"SummaryViewPopup/ReplyTo/Sender",             NULL, N_("_sender"), NULL, NULL, G_CALLBACK(summary_menu_cb) },
-       {"SummaryViewPopup/ReplyTo/MailingList",        NULL, N_("_mailing list"), "<control>L", NULL, G_CALLBACK(summary_menu_cb) },
-       {"SummaryViewPopup/---",                        NULL, "---", NULL, NULL, NULL },
-#endif
-
-       {"SummaryViewPopup/Forward",                    NULL, N_("_Forward"), "<control><alt>F", NULL, G_CALLBACK(summary_menu_cb) }, /* inline */
-#ifndef GENERIC_UMPC
-       {"SummaryViewPopup/ForwardAsAtt",               NULL, N_("For_ward as attachment"), NULL, NULL, G_CALLBACK(summary_menu_cb) }, /* as attach */
-       {"SummaryViewPopup/Redirect",                   NULL, N_("Redirect"), NULL, NULL, G_CALLBACK(summary_menu_cb) }, 
-#endif
-       /* separation */
-       {"SummaryViewPopup/Move",                       NULL, N_("M_ove..."), "<control>O", NULL, G_CALLBACK(summary_menu_cb) }, 
-       {"SummaryViewPopup/Copy",                       NULL, N_("_Copy..."), "<shift><control>O", NULL, G_CALLBACK(summary_menu_cb) }, 
-       {"SummaryViewPopup/Trash",                      NULL, N_("Move to _trash"), "<control>D", NULL, G_CALLBACK(summary_menu_cb) }, 
-#ifndef GENERIC_UMPC
-       {"SummaryViewPopup/Delete",                     NULL, N_("_Delete..."), NULL, NULL, G_CALLBACK(summary_menu_cb) },
-#endif
-       /* separation */
-       {"SummaryViewPopup/Mark",                       NULL, "_Mark" },
-       {"SummaryViewPopup/Mark/Mark",                  NULL, N_("_Mark"), NULL, NULL, G_CALLBACK(summary_menu_cb) },
-       {"SummaryViewPopup/Mark/Unmark",                NULL, N_("_Unmark"), NULL, NULL, G_CALLBACK(summary_menu_cb) },
-       {"SummaryViewPopup/Mark/---",                   NULL, "---", NULL, NULL, NULL },
-
-       {"SummaryViewPopup/Mark/MarkUnread",            NULL, N_("Mark as unr_ead"), NULL, NULL, G_CALLBACK(summary_menu_cb) },
-       {"SummaryViewPopup/Mark/MarkRead",              NULL, N_("Mark as rea_d"), NULL, NULL, G_CALLBACK(summary_menu_cb) },
-       {"SummaryViewPopup/Mark/MarkAllRead",           NULL, N_("Mark all read"), NULL, NULL, G_CALLBACK(summary_menu_cb) },
-       {"SummaryViewPopup/Mark/IgnoreThread",          NULL, N_("Ignore thread"), NULL, NULL, G_CALLBACK(summary_menu_cb) },
-       {"SummaryViewPopup/Mark/UnignoreThread",        NULL, N_("Unignore thread"), NULL, NULL, G_CALLBACK(summary_menu_cb) },
-       {"SummaryViewPopup/Mark/WatchThread",           NULL, N_("Watch thread"), NULL, NULL, G_CALLBACK(summary_menu_cb) },
-       {"SummaryViewPopup/Mark/UnwatchThread",         NULL, N_("Unwatch thread"), NULL, NULL, G_CALLBACK(summary_menu_cb) },
-       /* separation */
-
-       {"SummaryViewPopup/Mark/MarkSpam",              NULL, N_("Mark as spam"), NULL, NULL, G_CALLBACK(summary_menu_cb) },
-       {"SummaryViewPopup/Mark/MarkHam",               NULL, N_("Mark as ham"), NULL, NULL, G_CALLBACK(summary_menu_cb) },
-       /* separation */
-
-       {"SummaryViewPopup/Mark/Lock",                  NULL, N_("Lock"), NULL, NULL, G_CALLBACK(summary_menu_cb) },
-       {"SummaryViewPopup/Mark/Unlock",                NULL, N_("Unlock"), NULL, NULL, G_CALLBACK(summary_menu_cb) },
-
-       {"SummaryViewPopup/ColorLabel",                 NULL, "Color la_bel" },
-       {"SummaryViewPopup/Tags",                       NULL, "Ta_gs" },
-
-       /* separation */
-#ifndef GENERIC_UMPC
-       {"SummaryViewPopup/AddSenderToAB",                      NULL, N_("Add sender to address boo_k"), NULL, NULL, G_CALLBACK(summary_menu_cb) }, 
-#endif
-       {"SummaryViewPopup/CreateFilterRule",                   NULL, "Create f_ilter rule" },
-       {"SummaryViewPopup/CreateFilterRule/Automatically",     NULL, N_("_Automatically"), NULL, NULL, G_CALLBACK(summary_menu_cb) }, 
-       {"SummaryViewPopup/CreateFilterRule/ByFrom",            NULL, N_("By _From"), NULL, NULL, G_CALLBACK(summary_menu_cb) }, 
-       {"SummaryViewPopup/CreateFilterRule/ByTo",              NULL, N_("By _To"), NULL, NULL, G_CALLBACK(summary_menu_cb) }, 
-       {"SummaryViewPopup/CreateFilterRule/BySubject",         NULL, N_("By _Subject"), NULL, NULL, G_CALLBACK(summary_menu_cb) }, 
-
-#ifndef GENERIC_UMPC
-       {"SummaryViewPopup/CreateProcessingRule",                       NULL, "Create processing rule" },
-       {"SummaryViewPopup/CreateProcessingRule/Automatically", NULL, N_("_Automatically"), NULL, NULL, G_CALLBACK(summary_menu_cb) }, 
-       {"SummaryViewPopup/CreateProcessingRule/ByFrom",                NULL, N_("By _From"), NULL, NULL, G_CALLBACK(summary_menu_cb) }, 
-       {"SummaryViewPopup/CreateProcessingRule/ByTo",          NULL, N_("By _To"), NULL, NULL, G_CALLBACK(summary_menu_cb) }, 
-       {"SummaryViewPopup/CreateProcessingRule/BySubject",             NULL, N_("By _Subject"), NULL, NULL, G_CALLBACK(summary_menu_cb) }, 
-
-#endif
-       /* separation */
-       {"SummaryViewPopup/View",                       NULL, "_View" },
-       {"SummaryViewPopup/View/OpenInNewWindow",       NULL, N_("Open in new _window"), "<control><alt>N", NULL, G_CALLBACK(summary_menu_cb) }, 
-       {"SummaryViewPopup/View/MessageSource",         NULL, N_("Message _source"), "<control>U", NULL, G_CALLBACK(summary_menu_cb) }, 
-       /* separation */
-       {"SummaryViewPopup/SaveAs",                     NULL, N_("_Save as..."), "<control>S", NULL, G_CALLBACK(summary_menu_cb) }, 
+       {"SummaryViewPopup/ReplyTo",                    NULL, N_("Repl_y to") },
+       {"SummaryViewPopup/Mark",                       NULL, N_("_Mark") },
+       {"SummaryViewPopup/ColorLabel",                 NULL, N_("Color la_bel") },
+       {"SummaryViewPopup/Tags",                       NULL, N_("Ta_gs") },
+       {"SummaryViewPopup/CreateFilterRule",           NULL, N_("Create _filter rule") },
 #ifndef GENERIC_UMPC
-       {"SummaryViewPopup/Print",                      NULL, N_("Print..."), "<control>P", NULL, G_CALLBACK(summary_menu_cb) }, 
+       {"SummaryViewPopup/CreateProcessingRule",       NULL, N_("Create processing rule") },
 #endif
-};  /* see also list in menu_connect_identical_items() in menu.c if this changes */
-
-#ifndef GENERIC_UMPC
-static GtkToggleActionEntry summary_popup_toggleentries[] =
-{
-       {"SummaryViewPopup/View/AllHeaders",            NULL, N_("All _headers"), "<control>H", NULL, G_CALLBACK(summary_menu_cb) }, 
+       {"SummaryViewPopup/View",                       NULL, N_("_View") },
 };
-#endif
 
 static const gchar *const col_label[N_SUMMARY_COLS] = {
        "",             /* S_COL_MARK    */
@@ -607,13 +443,13 @@ static const gchar *const col_label[N_SUMMARY_COLS] = {
 void summary_freeze(SummaryView *summaryview)
 {
        if (summaryview)
-               gtk_clist_freeze(GTK_CLIST(summaryview->ctree));
+               gtk_cmclist_freeze(GTK_CMCLIST(summaryview->ctree));
 }
 
 void summary_thaw(SummaryView *summaryview)
 {
        if (summaryview)
-               gtk_clist_thaw(GTK_CLIST(summaryview->ctree));
+               gtk_cmclist_thaw(GTK_CMCLIST(summaryview->ctree));
 }
 
 void summary_grab_focus(SummaryView *summaryview)
@@ -633,7 +469,7 @@ GtkWidget *summary_get_main_widget(SummaryView *summaryview)
 #define START_LONG_OPERATION(summaryview,force_freeze) {       \
        summary_lock(summaryview);                              \
        main_window_cursor_wait(summaryview->mainwin);          \
-       if (force_freeze || sc_g_list_bigger(GTK_CLIST(summaryview->ctree)->selection, 1)) {\
+       if (force_freeze || sc_g_list_bigger(GTK_CMCLIST(summaryview->ctree)->selection, 1)) {\
                froze = TRUE;                                           \
                summary_freeze(summaryview);    \
        }                                                       \
@@ -654,7 +490,7 @@ GtkWidget *summary_get_main_widget(SummaryView *summaryview)
                summary_update_msg, (gpointer) summaryview);    \
 }
 
-SummaryView *summary_create(void)
+SummaryView *summary_create(MainWindow *mainwin)
 {
        SummaryView *summaryview;
        GtkWidget *vbox;
@@ -676,14 +512,13 @@ SummaryView *summary_create(void)
        GtkWidget *toggle_arrow;
        GtkWidget *toggle_search;
        QuickSearch *quicksearch;
-       GtkUIManager *gui_manager = gtkut_ui_manager();
        CLAWS_TIP_DECL();
 
        debug_print("Creating summary view...\n");
        summaryview = g_new0(SummaryView, 1);
 
 #if !(GTK_CHECK_VERSION(2,12,0))
-       summaryview->tips = tips;
+       summaryview->tooltips = tips;
 #endif
 #define SUMMARY_VBOX_SPACING 3
        vbox = gtk_vbox_new(FALSE, SUMMARY_VBOX_SPACING);
@@ -704,6 +539,7 @@ SummaryView *summary_create(void)
        toggle_search = gtk_toggle_button_new();
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle_search),
                                     prefs_common.show_searchbar);
+       gtkut_widget_set_can_focus(toggle_search, FALSE);
        gtk_widget_show(toggle_search);
 
        CLAWS_SET_TIP(toggle_search, _("Toggle quick search bar"));
@@ -778,9 +614,9 @@ SummaryView *summary_create(void)
        gtk_widget_show(ctree);
 
        gtk_scrolled_window_set_hadjustment(GTK_SCROLLED_WINDOW(scrolledwin),
-                                           GTK_CLIST(ctree)->hadjustment);
+                                           GTK_CMCLIST(ctree)->hadjustment);
        gtk_scrolled_window_set_vadjustment(GTK_SCROLLED_WINDOW(scrolledwin),
-                                           GTK_CLIST(ctree)->vadjustment);
+                                           GTK_CMCLIST(ctree)->vadjustment);
        gtk_container_add(GTK_CONTAINER(scrolledwin), ctree);
 
        /* status label */
@@ -802,97 +638,97 @@ SummaryView *summary_create(void)
                          G_CALLBACK(tog_searchbar_cb), summaryview);
 
        /* create popup menu */
-       summaryview->action_group = cm_menu_create_action_group("SummaryViewPopup", summary_popup_entries,
+       
+       gtk_action_group_add_actions(mainwin->action_group, summary_popup_entries,
                        G_N_ELEMENTS(summary_popup_entries), (gpointer)summaryview);
+
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/", "Menus", "Menus", GTK_UI_MANAGER_MENUBAR)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus", "SummaryViewPopup", "SummaryViewPopup", GTK_UI_MANAGER_MENU)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup", "Reply", "Message/Reply", GTK_UI_MANAGER_MENUITEM)
 #ifndef GENERIC_UMPC
-       gtk_action_group_add_toggle_actions(summaryview->action_group, summary_popup_toggleentries,
-                       G_N_ELEMENTS(summary_popup_toggleentries), (gpointer)summaryview);
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup", "ReplyTo", "SummaryViewPopup/ReplyTo", GTK_UI_MANAGER_MENU)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup", "Separator1", "Message/---", GTK_UI_MANAGER_SEPARATOR)
 #endif
-
-       MENUITEM_ADDUI("/Menus", "SummaryViewPopup", "SummaryViewPopup", GTK_UI_MANAGER_MENU)
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup", "Reply", "SummaryViewPopup/Reply", GTK_UI_MANAGER_MENUITEM)
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup", "ReplyTo", "SummaryViewPopup/ReplyTo", GTK_UI_MANAGER_MENU)
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup", "Separator1", "SummaryViewPopup/---", GTK_UI_MANAGER_SEPARATOR)
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup", "Forward", "SummaryViewPopup/Forward", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup", "Forward", "Message/Forward", GTK_UI_MANAGER_MENUITEM)
 #ifndef GENERIC_UMPC
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup", "ForwardAsAtt", "SummaryViewPopup/ForwardAsAtt", GTK_UI_MANAGER_MENUITEM)
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup", "Redirect", "SummaryViewPopup/Redirect", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup", "ForwardAtt", "Message/ForwardAtt", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup", "Redirect", "Message/Redirect", GTK_UI_MANAGER_MENUITEM)
 #endif
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup", "Separator2", "SummaryViewPopup/---", GTK_UI_MANAGER_SEPARATOR)
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup", "Move", "SummaryViewPopup/Move", GTK_UI_MANAGER_MENUITEM)
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup", "Copy", "SummaryViewPopup/Copy", GTK_UI_MANAGER_MENUITEM)
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup", "Trash", "SummaryViewPopup/Trash", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup", "Separator2", "Message/---", GTK_UI_MANAGER_SEPARATOR)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup", "Move", "Message/Move", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup", "Copy", "Message/Copy", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup", "Trash", "Message/Trash", GTK_UI_MANAGER_MENUITEM)
 #ifndef GENERIC_UMPC
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup", "Delete", "SummaryViewPopup/Delete", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup", "Delete", "Message/Delete", GTK_UI_MANAGER_MENUITEM)
 #endif
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup", "Separator3", "SummaryViewPopup/---", GTK_UI_MANAGER_SEPARATOR)
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup", "Mark", "SummaryViewPopup/Mark", GTK_UI_MANAGER_MENU)
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup", "ColorLabel", "SummaryViewPopup/ColorLabel", GTK_UI_MANAGER_MENU)
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup", "Tags", "SummaryViewPopup/Tags", GTK_UI_MANAGER_MENU)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup", "Separator3", "Message/---", GTK_UI_MANAGER_SEPARATOR)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup", "Mark", "SummaryViewPopup/Mark", GTK_UI_MANAGER_MENU)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup", "ColorLabel", "SummaryViewPopup/ColorLabel", GTK_UI_MANAGER_MENU)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup", "Tags", "SummaryViewPopup/Tags", GTK_UI_MANAGER_MENU)
 
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup", "Separator4", "SummaryViewPopup/---", GTK_UI_MANAGER_SEPARATOR)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup", "Separator4", "Message/---", GTK_UI_MANAGER_SEPARATOR)
 #ifndef GENERIC_UMPC
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup", "AddSenderToAB", "SummaryViewPopup/AddSenderToAB", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup", "AddSenderToAB", "Tools/AddSenderToAB", GTK_UI_MANAGER_MENUITEM)
 #endif
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup", "CreateFilterRule", "SummaryViewPopup/CreateFilterRule", GTK_UI_MANAGER_MENU)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup", "CreateFilterRule", "SummaryViewPopup/CreateFilterRule", GTK_UI_MANAGER_MENU)
 #ifndef GENERIC_UMPC
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup", "CreateProcessingRule", "SummaryViewPopup/CreateProcessingRule", GTK_UI_MANAGER_MENU)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup", "CreateProcessingRule", "SummaryViewPopup/CreateProcessingRule", GTK_UI_MANAGER_MENU)
 #endif
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup", "Separator5", "SummaryViewPopup/---", GTK_UI_MANAGER_SEPARATOR)
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup", "View", "SummaryViewPopup/View", GTK_UI_MANAGER_MENU)
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup", "SaveAs", "SummaryViewPopup/SaveAs", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup", "Separator5", "Tools/---", GTK_UI_MANAGER_SEPARATOR)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup", "View", "SummaryViewPopup/View", GTK_UI_MANAGER_MENU)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup", "SaveAs", "File/SaveAs", GTK_UI_MANAGER_MENUITEM)
 #ifndef GENERIC_UMPC
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup", "Print", "SummaryViewPopup/Print", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup", "Print", "File/Print", GTK_UI_MANAGER_MENUITEM)
 #endif
        /* last separator, for plugins */
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup", "Separator6", "SummaryViewPopup/---", GTK_UI_MANAGER_SEPARATOR)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup", "Separator6", "File/---", GTK_UI_MANAGER_SEPARATOR)
 
        /* submenus - replyto */
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup/ReplyTo", "All", "SummaryViewPopup/ReplyTo/All", GTK_UI_MANAGER_MENUITEM)
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup/ReplyTo", "Sender", "SummaryViewPopup/ReplyTo/Sender", GTK_UI_MANAGER_MENUITEM)
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup/ReplyTo", "MailingList", "SummaryViewPopup/ReplyTo/MailingList", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/ReplyTo", "All", "Message/ReplyTo/All", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/ReplyTo", "Sender", "Message/ReplyTo/Sender", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/ReplyTo", "MailingList", "Message/ReplyTo/List", GTK_UI_MANAGER_MENUITEM)
 
        /* submenus - mark */
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup/Mark", "Mark", "SummaryViewPopup/Mark/Mark", GTK_UI_MANAGER_MENUITEM)
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup/Mark", "Unmark", "SummaryViewPopup/Mark/Unmark", GTK_UI_MANAGER_MENUITEM)
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup/Mark", "Separator1", "SummaryViewPopup/Mark/---", GTK_UI_MANAGER_SEPARATOR)
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup/Mark", "MarkUnread", "SummaryViewPopup/Mark/MarkUnread", GTK_UI_MANAGER_MENUITEM)
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup/Mark", "MarkRead", "SummaryViewPopup/Mark/MarkRead", GTK_UI_MANAGER_MENUITEM)
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup/Mark", "MarkAllRead", "SummaryViewPopup/Mark/MarkAllRead", GTK_UI_MANAGER_MENUITEM)
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup/Mark", "IgnoreThread", "SummaryViewPopup/Mark/IgnoreThread", GTK_UI_MANAGER_MENUITEM)
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup/Mark", "UnignoreThread", "SummaryViewPopup/Mark/UnignoreThread", GTK_UI_MANAGER_MENUITEM)
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup/Mark", "WatchThread", "SummaryViewPopup/Mark/WatchThread", GTK_UI_MANAGER_MENUITEM)
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup/Mark", "UnwatchThread", "SummaryViewPopup/Mark/UnwatchThread", GTK_UI_MANAGER_MENUITEM)
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup/Mark", "Separator2", "SummaryViewPopup/Mark/---", GTK_UI_MANAGER_SEPARATOR)
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup/Mark", "MarkSpam", "SummaryViewPopup/Mark/MarkSpam", GTK_UI_MANAGER_MENUITEM)
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup/Mark", "MarkHam", "SummaryViewPopup/Mark/MarkHam", GTK_UI_MANAGER_MENUITEM)
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup/Mark", "Separator3", "SummaryViewPopup/Mark/---", GTK_UI_MANAGER_SEPARATOR)
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup/Mark", "Lock", "SummaryViewPopup/Mark/Lock", GTK_UI_MANAGER_MENUITEM)
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup/Mark", "Unlock", "SummaryViewPopup/Mark/Unlock", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/Mark", "Mark", "Message/Mark/Mark", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/Mark", "Unmark", "Message/Mark/Unmark", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/Mark", "Separator1", "Message/Mark/---", GTK_UI_MANAGER_SEPARATOR)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/Mark", "MarkUnread", "Message/Mark/MarkUnread", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/Mark", "MarkRead", "Message/Mark/MarkRead", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/Mark", "MarkAllRead", "Message/Mark/MarkAllRead", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/Mark", "IgnoreThread", "Message/Mark/IgnoreThread", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/Mark", "UnignoreThread", "Message/Mark/UnignoreThread", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/Mark", "WatchThread", "Message/Mark/WatchThread", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/Mark", "UnwatchThread", "Message/Mark/UnwatchThread", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/Mark", "Separator2", "Message/Mark/---", GTK_UI_MANAGER_SEPARATOR)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/Mark", "MarkSpam", "Message/Mark/MarkSpam", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/Mark", "MarkHam", "Message/Mark/MarkHam", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/Mark", "Separator3", "Message/Mark/---", GTK_UI_MANAGER_SEPARATOR)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/Mark", "Lock", "Message/Mark/Lock", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/Mark", "Unlock", "Message/Mark/Unlock", GTK_UI_MANAGER_MENUITEM)
 
        /* submenus - colorlabel and tags are dynamic */
        /* submenus - createfilterrule */
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup/CreateFilterRule", "Automatically", "SummaryViewPopup/CreateFilterRule/Automatically", GTK_UI_MANAGER_MENUITEM)
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup/CreateFilterRule", "ByFrom", "SummaryViewPopup/CreateFilterRule/ByFrom", GTK_UI_MANAGER_MENUITEM)
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup/CreateFilterRule", "ByTo", "SummaryViewPopup/CreateFilterRule/ByTo", GTK_UI_MANAGER_MENUITEM)
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup/CreateFilterRule", "BySubject", "SummaryViewPopup/CreateFilterRule/BySubject", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/CreateFilterRule", "Automatically", "Tools/CreateFilterRule/Automatically", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/CreateFilterRule", "ByFrom", "Tools/CreateFilterRule/ByFrom", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/CreateFilterRule", "ByTo", "Tools/CreateFilterRule/ByTo", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/CreateFilterRule", "BySubject", "Tools/CreateFilterRule/BySubject", GTK_UI_MANAGER_MENUITEM)
                
 #ifndef GENERIC_UMPC
        /* submenus - createprocessingrule */
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup/CreateProcessingRule", "Automatically", "SummaryViewPopup/CreateProcessingRule/Automatically", GTK_UI_MANAGER_MENUITEM)
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup/CreateProcessingRule", "ByFrom", "SummaryViewPopup/CreateProcessingRule/ByFrom", GTK_UI_MANAGER_MENUITEM)
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup/CreateProcessingRule", "ByTo", "SummaryViewPopup/CreateProcessingRule/ByTo", GTK_UI_MANAGER_MENUITEM)
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup/CreateProcessingRule", "BySubject", "SummaryViewPopup/CreateProcessingRule/BySubject", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/CreateProcessingRule", "Automatically", "Tools/CreateProcessingRule/Automatically", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/CreateProcessingRule", "ByFrom", "Tools/CreateProcessingRule/ByFrom", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/CreateProcessingRule", "ByTo", "Tools/CreateProcessingRule/ByTo", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/CreateProcessingRule", "BySubject", "Tools/CreateProcessingRule/BySubject", GTK_UI_MANAGER_MENUITEM)
 #endif
                
        /* submenus - view */
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup/View", "OpenInNewWindow", "SummaryViewPopup/View/OpenInNewWindow", GTK_UI_MANAGER_MENUITEM)
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup/View", "MessageSource", "SummaryViewPopup/View/MessageSource", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/View", "OpenNewWindow", "View/OpenNewWindow", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/View", "MessageSource", "View/MessageSource", GTK_UI_MANAGER_MENUITEM)
 #ifndef GENERIC_UMPC
-       MENUITEM_ADDUI("/Menus/SummaryViewPopup/View", "AllHeaders", "SummaryViewPopup/View/AllHeaders", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/View", "AllHeaders", "View/AllHeaders", GTK_UI_MANAGER_MENUITEM)
 #endif         
        summaryview->popupmenu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(
-                               gtk_ui_manager_get_widget(gtkut_ui_manager(), "/Menus/SummaryViewPopup")) );
+                               gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menus/SummaryViewPopup")) );
 
 
        summaryview->vbox = vbox;
@@ -924,7 +760,7 @@ SummaryView *summary_create(void)
                                summary_update_folder_hook,
                                (gpointer) summaryview);
 
-       summaryview->target_list = gtk_target_list_new(summary_drag_types, 2);
+       summaryview->target_list = gtk_target_list_new(summary_drag_types, 3);
 
        summaryview->quicksearch = quicksearch;
 
@@ -952,8 +788,8 @@ void summary_relayout(SummaryView *summaryview)
 {
        gtk_widget_realize(summaryview->stat_box);
 
-       gtk_widget_ref(summaryview->hbox_l);
-       gtk_widget_ref(summaryview->statlabel_msgs);
+       g_object_ref(summaryview->hbox_l);
+       g_object_ref(summaryview->statlabel_msgs);
        
        gtkut_container_remove(GTK_CONTAINER(summaryview->hbox_l->parent), summaryview->hbox_l);
        gtkut_container_remove(GTK_CONTAINER(summaryview->statlabel_msgs->parent), summaryview->statlabel_msgs);
@@ -990,8 +826,8 @@ void summary_relayout(SummaryView *summaryview)
        }
        summary_set_column_order(summaryview);
 
-       gtk_widget_unref(summaryview->hbox_l);
-       gtk_widget_unref(summaryview->statlabel_msgs);
+       g_object_unref(summaryview->hbox_l);
+       g_object_unref(summaryview->statlabel_msgs);
        quicksearch_relayout(summaryview->quicksearch);
        if (prefs_common.show_searchbar)
                quicksearch_show(summaryview->quicksearch);
@@ -1080,40 +916,42 @@ void summary_init(SummaryView *summaryview)
        GtkWidget *pixmap;
 
        gtk_widget_realize(summaryview->ctree);
-       stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_MARK,
-                        &markxpm, &markxpmmask);
-       stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_DELETED,
-                        &deletedxpm, &deletedxpmmask);
-       stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_NEW,
-                        &newxpm, &newxpmmask);
-       stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_UNREAD,
-                        &unreadxpm, &unreadxpmmask);
-       stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_REPLIED,
-                        &repliedxpm, &repliedxpmmask);
-       stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_FORWARDED,
-                        &forwardedxpm, &forwardedxpmmask);
-       stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_CLIP,
-                        &clipxpm, &clipxpmmask);
-       stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_LOCKED,
-                        &lockedxpm, &lockedxpmmask);
-       stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_IGNORETHREAD,
-                        &ignorethreadxpm, &ignorethreadxpmmask);
-       stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_WATCHTHREAD,
-                        &watchthreadxpm, &watchthreadxpmmask);
-       stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_CLIP_KEY,
-                        &clipkeyxpm, &clipkeyxpmmask);
-       stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_KEY,
-                        &keyxpm, &keyxpmmask);
-       stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_GPG_SIGNED,
-                        &gpgsignedxpm, &gpgsignedxpmmask);
-       stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_CLIP_GPG_SIGNED,
-                        &clipgpgsignedxpm, &clipgpgsignedxpmmask);
-       stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_SPAM,
-                        &spamxpm, &spamxpmmask);
-       stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_MOVED,
-                        &movedxpm, &movedxpmmask);
-       stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_COPIED,
-                        &copiedxpm, &copiedxpmmask);
+       stock_pixbuf_gdk(summaryview->ctree, STOCK_PIXMAP_MARK,
+                        &markxpm);
+       stock_pixbuf_gdk(summaryview->ctree, STOCK_PIXMAP_DELETED,
+                        &deletedxpm);
+       stock_pixbuf_gdk(summaryview->ctree, STOCK_PIXMAP_NEW,
+                        &newxpm);
+       stock_pixbuf_gdk(summaryview->ctree, STOCK_PIXMAP_UNREAD,
+                        &unreadxpm);
+       stock_pixbuf_gdk(summaryview->ctree, STOCK_PIXMAP_REPLIED,
+                        &repliedxpm);
+       stock_pixbuf_gdk(summaryview->ctree, STOCK_PIXMAP_FORWARDED,
+                        &forwardedxpm);
+       stock_pixbuf_gdk(summaryview->ctree, STOCK_PIXMAP_CLIP,
+                        &clipxpm);
+       stock_pixbuf_gdk(summaryview->ctree, STOCK_PIXMAP_LOCKED,
+                        &lockedxpm);
+       stock_pixbuf_gdk(summaryview->ctree, STOCK_PIXMAP_IGNORETHREAD,
+                        &ignorethreadxpm);
+       stock_pixbuf_gdk(summaryview->ctree, STOCK_PIXMAP_WATCHTHREAD,
+                        &watchthreadxpm);
+       stock_pixbuf_gdk(summaryview->ctree, STOCK_PIXMAP_CLIP_KEY,
+                        &clipkeyxpm);
+       stock_pixbuf_gdk(summaryview->ctree, STOCK_PIXMAP_KEY_SIGN,
+                        &keysignxpm);
+       stock_pixbuf_gdk(summaryview->ctree, STOCK_PIXMAP_KEY,
+                        &keyxpm);
+       stock_pixbuf_gdk(summaryview->ctree, STOCK_PIXMAP_GPG_SIGNED,
+                        &gpgsignedxpm);
+       stock_pixbuf_gdk(summaryview->ctree, STOCK_PIXMAP_CLIP_GPG_SIGNED,
+                        &clipgpgsignedxpm);
+       stock_pixbuf_gdk(summaryview->ctree, STOCK_PIXMAP_SPAM,
+                        &spamxpm);
+       stock_pixbuf_gdk(summaryview->ctree, STOCK_PIXMAP_MOVED,
+                        &movedxpm);
+       stock_pixbuf_gdk(summaryview->ctree, STOCK_PIXMAP_COPIED,
+                        &copiedxpm);
 
        summary_set_fonts(summaryview);
 
@@ -1136,8 +974,9 @@ void summary_init(SummaryView *summaryview)
        summaryview->sort_type = SORT_ASCENDING;
 
        /* Init summaryview extra data */
+#ifndef G_OS_WIN32
        summaryview->simplify_subject_preg = NULL;
-
+#endif
        summary_clear_list(summaryview);
        summary_set_column_titles(summaryview);
        summary_colorlabel_menu_create(summaryview, FALSE);
@@ -1162,7 +1001,7 @@ static void summary_switch_from_to(SummaryView *summaryview, FolderItem *item)
        gboolean showing_from = FALSE, showing_to = FALSE;
        gint from_pos = 0, to_pos = 0;
        SummaryColumnState *col_state = summaryview->col_state;
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
        
        if (!item || (prefs_common.layout_mode == VERTICAL_LAYOUT && prefs_common.two_line_vert) )
                return;
@@ -1206,10 +1045,10 @@ static void summary_switch_from_to(SummaryView *summaryview, FolderItem *item)
        summaryview->col_pos[S_COL_TO] = from_pos;
        summaryview->col_pos[S_COL_FROM] = to_pos;
 
-       gtk_clist_set_column_visibility
-               (GTK_CLIST(ctree), from_pos, col_state[from_pos].visible);
-       gtk_clist_set_column_visibility
-               (GTK_CLIST(ctree), to_pos, col_state[to_pos].visible);
+       gtk_cmclist_set_column_visibility
+               (GTK_CMCLIST(ctree), from_pos, col_state[from_pos].visible);
+       gtk_cmclist_set_column_visibility
+               (GTK_CMCLIST(ctree), to_pos, col_state[to_pos].visible);
 
        summary_set_column_titles(summaryview);
 }
@@ -1273,8 +1112,8 @@ static gboolean summary_check_consistency(FolderItem *item, GSList *mlist)
 
 gboolean summary_show(SummaryView *summaryview, FolderItem *item)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
-       GtkCTreeNode *node = NULL;
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
+       GtkCMCTreeNode *node = NULL;
        GSList *mlist = NULL;
        gchar *buf;
        gboolean is_refresh;
@@ -1294,7 +1133,9 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item)
 
        inc_lock();
        summary_lock(summaryview);
-
+       
+       menu_set_sensitive_all(GTK_MENU_SHELL(summaryview->popupmenu), TRUE);
+       
        utils_free_regex();
 
        is_refresh = (item == summaryview->folder_item) ? TRUE : FALSE;
@@ -1369,6 +1210,7 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item)
                                item?folder_item_parent(item):0x0,
                                item?item->no_select:FALSE);
                summary_set_hide_read_msgs_menu(summaryview, FALSE);
+               summary_set_hide_del_msgs_menu(summaryview, FALSE);
                summary_clear_all(summaryview);
                summaryview->folder_item = item;
                summary_thaw(summaryview);
@@ -1409,28 +1251,37 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item)
                mlist = folder_item_get_msg_list(item);
        }
 
-       if (summaryview->folder_item->hide_read_msgs &&
+       if ((summaryview->folder_item->hide_read_msgs || summaryview->folder_item->hide_del_msgs) &&
            quicksearch_is_active(summaryview->quicksearch) == FALSE) {
                GSList *not_killed;
                
-               summary_set_hide_read_msgs_menu(summaryview, TRUE);
+               summary_set_hide_read_msgs_menu(summaryview, summaryview->folder_item->hide_read_msgs);
+               summary_set_hide_del_msgs_menu(summaryview, summaryview->folder_item->hide_del_msgs);
                not_killed = NULL;
                for(cur = mlist ; cur != NULL && cur->data != NULL ; cur = g_slist_next(cur)) {
                        MsgInfo * msginfo = (MsgInfo *) cur->data;
                        
                        if (!msginfo->hidden) {
-                               if (MSG_IS_UNREAD(msginfo->flags) &&
-                                   !MSG_IS_IGNORE_THREAD(msginfo->flags))
-                                       not_killed = g_slist_prepend(not_killed, msginfo);
-                               else if (MSG_IS_MARKED(msginfo->flags) ||
-                                        MSG_IS_LOCKED(msginfo->flags))
-                                       not_killed = g_slist_prepend(not_killed, msginfo);
-                               else if (is_refresh &&
-                                       (msginfo->msgnum == selected_msgnum ||
-                                        msginfo->msgnum == displayed_msgnum))
-                                       not_killed = g_slist_prepend(not_killed, msginfo);
-                               else
+                               if (MSG_IS_DELETED(msginfo->flags) && summaryview->folder_item->hide_del_msgs) {
                                        procmsg_msginfo_free(msginfo);
+                                       continue;
+                               }
+                               if (summaryview->folder_item->hide_read_msgs) {
+                                       if (MSG_IS_UNREAD(msginfo->flags) &&
+                                           !MSG_IS_IGNORE_THREAD(msginfo->flags))
+                                               not_killed = g_slist_prepend(not_killed, msginfo);
+                                       else if (MSG_IS_MARKED(msginfo->flags) ||
+                                                MSG_IS_LOCKED(msginfo->flags))
+                                               not_killed = g_slist_prepend(not_killed, msginfo);
+                                       else if (is_refresh &&
+                                               (msginfo->msgnum == selected_msgnum ||
+                                                msginfo->msgnum == displayed_msgnum))
+                                               not_killed = g_slist_prepend(not_killed, msginfo);
+                                       else
+                                               procmsg_msginfo_free(msginfo);
+                               } else {
+                                       not_killed = g_slist_prepend(not_killed, msginfo);
+                               }
                         } else
                                procmsg_msginfo_free(msginfo);
                }
@@ -1439,6 +1290,7 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item)
                mlist = not_killed;
        } else {
                summary_set_hide_read_msgs_menu(summaryview, FALSE);
+               summary_set_hide_del_msgs_menu(summaryview, FALSE);
        }
 
        if (quicksearch_is_active(summaryview->quicksearch)) {
@@ -1534,25 +1386,25 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item)
                                   message, but do not display it */
                                node = summary_find_next_flagged_msg(summaryview, NULL,
                                                                     MSG_UNREAD, FALSE);
-                               if (node == NULL && GTK_CLIST(ctree)->row_list != NULL)
-                                       node = gtk_ctree_node_nth
+                               if (node == NULL && GTK_CMCLIST(ctree)->row_list != NULL)
+                                       node = gtk_cmctree_node_nth
                                                (ctree,
                                                 item->sort_type == SORT_DESCENDING
-                                                ? 0 : GTK_CLIST(ctree)->rows - 1);
+                                                ? 0 : GTK_CMCLIST(ctree)->rows - 1);
                                summary_unlock(summaryview);
                                summary_select_node(summaryview, node, FALSE, TRUE);
                                summary_lock(summaryview);
                        }
                } else {
                        /* just select first/last */
-                       if (GTK_CLIST(ctree)->row_list != NULL)
-                               node = gtk_ctree_node_nth
+                       if (GTK_CMCLIST(ctree)->row_list != NULL)
+                               node = gtk_cmctree_node_nth
                                        (ctree,
                                         item->sort_type == SORT_DESCENDING
-                                        ? 0 : GTK_CLIST(ctree)->rows - 1);
+                                        ? 0 : GTK_CMCLIST(ctree)->rows - 1);
                        gtk_sctree_select(GTK_SCTREE(ctree), node);
                        summaryview->selected = node;
-                       gtk_ctree_node_moveto(ctree, node, 0, 0.5, 0);
+                       gtk_cmctree_node_moveto(ctree, node, 0, 0.5, 0);
                }
        } else {
                /* backward compat */
@@ -1592,19 +1444,19 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item)
                                }
                                break;
                        case ACTION_LAST_LIST:
-                               if (GTK_CLIST(ctree)->row_list != NULL) {
-                                       node = gtk_ctree_node_nth
+                               if (GTK_CMCLIST(ctree)->row_list != NULL) {
+                                       node = gtk_cmctree_node_nth
                                                (ctree,
                                                 item->sort_type == SORT_DESCENDING
-                                                ? 0 : GTK_CLIST(ctree)->rows - 1);
+                                                ? 0 : GTK_CMCLIST(ctree)->rows - 1);
                                }
                                break;
                        case ACTION_FIRST_LIST:
-                               if (GTK_CLIST(ctree)->row_list != NULL) {
-                                       node = gtk_ctree_node_nth
+                               if (GTK_CMCLIST(ctree)->row_list != NULL) {
+                                       node = gtk_cmctree_node_nth
                                                (ctree,
                                                 item->sort_type == SORT_ASCENDING
-                                                ? 0 : GTK_CLIST(ctree)->rows - 1);
+                                                ? 0 : GTK_CMCLIST(ctree)->rows - 1);
                                }
                                break;
                        case ACTION_NOTHING:
@@ -1648,12 +1500,12 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item)
 
 void summary_clear_list(SummaryView *summaryview)
 {
-       GtkCList *clist = GTK_CLIST(summaryview->ctree);
+       GtkCMCList *clist = GTK_CMCLIST(summaryview->ctree);
        gint optimal_width;
 
        summary_freeze(summaryview);
 
-       gtk_ctree_pre_recursive(GTK_CTREE(summaryview->ctree),
+       gtk_cmctree_pre_recursive(GTK_CMCTREE(summaryview->ctree),
                                NULL, summary_free_msginfo_func, NULL);
 
        if (summaryview->folder_item) {
@@ -1678,11 +1530,11 @@ void summary_clear_list(SummaryView *summaryview)
        }
        summaryview->mlist = NULL;
 
-       gtk_clist_clear(clist);
+       gtk_cmclist_clear(clist);
        if (summaryview->col_pos[S_COL_SUBJECT] == N_SUMMARY_COLS - 1) {
-               optimal_width = gtk_clist_optimal_column_width
+               optimal_width = gtk_cmclist_optimal_column_width
                        (clist, summaryview->col_pos[S_COL_SUBJECT]);
-               gtk_clist_set_column_width
+               gtk_cmclist_set_column_width
                        (clist, summaryview->col_pos[S_COL_SUBJECT],
                         optimal_width);
        }
@@ -1717,7 +1569,7 @@ gboolean summary_is_locked(SummaryView *summaryview)
 
 SummarySelection summary_get_selection_type(SummaryView *summaryview)
 {
-       GtkCList *clist = GTK_CLIST(summaryview->ctree);
+       GtkCMCList *clist = GTK_CMCLIST(summaryview->ctree);
        SummarySelection selection;
 
        if (!clist->row_list)
@@ -1740,7 +1592,7 @@ MsgInfo *summary_get_selected_msg(SummaryView *summaryview)
 {
        /* summaryview->selected may be valid when multiple 
         * messages were selected */
-       GList *sellist = GTK_CLIST(summaryview->ctree)->selection;
+       GList *sellist = GTK_CMCLIST(summaryview->ctree)->selection;
 
        if (sellist == NULL || sellist->next) 
                return NULL;
@@ -1754,7 +1606,7 @@ GSList *summary_get_selected_msg_list(SummaryView *summaryview)
        GList *cur;
        MsgInfo *msginfo;
 
-       for (cur = GTK_CLIST(summaryview->ctree)->selection; cur != NULL && cur->data != NULL;
+       for (cur = GTK_CMCLIST(summaryview->ctree)->selection; cur != NULL && cur->data != NULL;
             cur = cur->next) {
                msginfo = GTKUT_CTREE_NODE_GET_ROW_DATA(cur->data);
                mlist = g_slist_prepend(mlist, msginfo);
@@ -1775,61 +1627,61 @@ void summary_set_menu_sensitive(SummaryView *summaryview)
                gchar *const entry;
                SensitiveCond cond;
        } entry[] = {
-               {"SummaryViewPopup/Reply"                       , M_HAVE_ACCOUNT|M_TARGET_EXIST},
+               {"Menus/SummaryViewPopup/Reply"                 , M_HAVE_ACCOUNT|M_TARGET_EXIST},
 #ifndef GENERIC_UMPC
-               {"SummaryViewPopup/ReplyTo"                     , M_HAVE_ACCOUNT|M_TARGET_EXIST},
-               {"SummaryViewPopup/ReplyTo/All"         , M_HAVE_ACCOUNT|M_TARGET_EXIST},
-               {"SummaryViewPopup/ReplyTo/Sender"             , M_HAVE_ACCOUNT|M_TARGET_EXIST},
-               {"SummaryViewPopup/ReplyTo/MailingList"       , M_HAVE_ACCOUNT|M_TARGET_EXIST},
+               {"Menus/SummaryViewPopup/ReplyTo"                       , M_HAVE_ACCOUNT|M_TARGET_EXIST},
+               {"Menus/SummaryViewPopup/ReplyTo/All"           , M_HAVE_ACCOUNT|M_TARGET_EXIST},
+               {"Menus/SummaryViewPopup/ReplyTo/Sender"             , M_HAVE_ACCOUNT|M_TARGET_EXIST},
+               {"Menus/SummaryViewPopup/ReplyTo/MailingList"       , M_HAVE_ACCOUNT|M_TARGET_EXIST},
 #endif
 
-               {"SummaryViewPopup/Forward"                     , M_HAVE_ACCOUNT|M_TARGET_EXIST},
+               {"Menus/SummaryViewPopup/Forward"                       , M_HAVE_ACCOUNT|M_TARGET_EXIST},
 #ifndef GENERIC_UMPC
-               {"SummaryViewPopup/ForwardAsAtt"        , M_HAVE_ACCOUNT|M_TARGET_EXIST},
-               {"SummaryViewPopup/Redirect"                    , M_HAVE_ACCOUNT|M_TARGET_EXIST},
+               {"Menus/SummaryViewPopup/ForwardAtt"    , M_HAVE_ACCOUNT|M_TARGET_EXIST},
+               {"Menus/SummaryViewPopup/Redirect"                      , M_HAVE_ACCOUNT|M_TARGET_EXIST},
 #endif
 
-               {"SummaryViewPopup/Move"                        , M_TARGET_EXIST|M_ALLOW_DELETE|M_NOT_NEWS},
-               {"SummaryViewPopup/Copy"                        , M_TARGET_EXIST|M_EXEC},
-               {"SummaryViewPopup/Trash"               , M_TARGET_EXIST|M_ALLOW_DELETE|M_NOT_NEWS},
+               {"Menus/SummaryViewPopup/Move"                  , M_TARGET_EXIST|M_ALLOW_DELETE|M_NOT_NEWS},
+               {"Menus/SummaryViewPopup/Copy"                  , M_TARGET_EXIST|M_EXEC},
+               {"Menus/SummaryViewPopup/Trash"         , M_TARGET_EXIST|M_ALLOW_DELETE|M_NOT_NEWS|M_NOT_TRASH},
 #ifndef GENERIC_UMPC
-               {"SummaryViewPopup/Delete"                      , M_TARGET_EXIST|M_ALLOW_DELETE},
+               {"Menus/SummaryViewPopup/Delete"                        , M_TARGET_EXIST|M_ALLOW_DELETE},
 #endif
 
-               {"SummaryViewPopup/Mark"                        , M_TARGET_EXIST},
-               {"SummaryViewPopup/Mark/Mark"                   , M_TARGET_EXIST},
-               {"SummaryViewPopup/Mark/Unmark"                 , M_TARGET_EXIST},
-               {"SummaryViewPopup/Mark/MarkUnread"     , M_TARGET_EXIST},
-               {"SummaryViewPopup/Mark/MarkRead"       , M_TARGET_EXIST},
-               {"SummaryViewPopup/Mark/MarkAllRead"    , M_TARGET_EXIST},
-               {"SummaryViewPopup/Mark/IgnoreThread"           , M_TARGET_EXIST},
-               {"SummaryViewPopup/Mark/UnignoreThread"         , M_TARGET_EXIST},
-               {"SummaryViewPopup/Mark/WatchThread"            , M_TARGET_EXIST},
-               {"SummaryViewPopup/Mark/UnwatchThread"          , M_TARGET_EXIST},
-               {"SummaryViewPopup/Mark/Unlock"                 , M_TARGET_EXIST},
-               {"SummaryViewPopup/Mark/Lock"                   , M_TARGET_EXIST},
-               {"SummaryViewPopup/Mark/MarkSpam"               , M_TARGET_EXIST|M_CAN_LEARN_SPAM},
-               {"SummaryViewPopup/Mark/MarkHam"                , M_TARGET_EXIST|M_CAN_LEARN_SPAM},
-               {"SummaryViewPopup/ColorLabel"                  , M_TARGET_EXIST},
-               {"SummaryViewPopup/Tags"                        , M_TARGET_EXIST},
+               {"Menus/SummaryViewPopup/Mark"                  , M_TARGET_EXIST},
+               {"Menus/SummaryViewPopup/Mark/Mark"             , M_TARGET_EXIST},
+               {"Menus/SummaryViewPopup/Mark/Unmark"                   , M_TARGET_EXIST},
+               {"Menus/SummaryViewPopup/Mark/MarkUnread"       , M_TARGET_EXIST},
+               {"Menus/SummaryViewPopup/Mark/MarkRead"         , M_TARGET_EXIST},
+               {"Menus/SummaryViewPopup/Mark/MarkAllRead"      , M_TARGET_EXIST},
+               {"Menus/SummaryViewPopup/Mark/IgnoreThread"     , M_TARGET_EXIST},
+               {"Menus/SummaryViewPopup/Mark/UnignoreThread"           , M_TARGET_EXIST},
+               {"Menus/SummaryViewPopup/Mark/WatchThread"              , M_TARGET_EXIST},
+               {"Menus/SummaryViewPopup/Mark/UnwatchThread"    , M_TARGET_EXIST},
+               {"Menus/SummaryViewPopup/Mark/Unlock"                   , M_TARGET_EXIST},
+               {"Menus/SummaryViewPopup/Mark/Lock"             , M_TARGET_EXIST},
+               {"Menus/SummaryViewPopup/Mark/MarkSpam"         , M_TARGET_EXIST|M_CAN_LEARN_SPAM},
+               {"Menus/SummaryViewPopup/Mark/MarkHam"          , M_TARGET_EXIST|M_CAN_LEARN_SPAM},
+               {"Menus/SummaryViewPopup/ColorLabel"                    , M_TARGET_EXIST},
+               {"Menus/SummaryViewPopup/Tags"                  , M_TARGET_EXIST},
 
 #ifndef GENERIC_UMPC
-               {"SummaryViewPopup/AddSenderToAB"       , M_SINGLE_TARGET_EXIST},
+               {"Menus/SummaryViewPopup/AddSenderToAB" , M_SINGLE_TARGET_EXIST},
 #endif
-               {"SummaryViewPopup/CreateFilterRule"            , M_SINGLE_TARGET_EXIST|M_UNLOCKED},
+               {"Menus/SummaryViewPopup/CreateFilterRule"              , M_SINGLE_TARGET_EXIST|M_UNLOCKED},
 #ifndef GENERIC_UMPC
-               {"SummaryViewPopup/CreateProcessingRule"        , M_SINGLE_TARGET_EXIST|M_UNLOCKED},
+               {"Menus/SummaryViewPopup/CreateProcessingRule"  , M_SINGLE_TARGET_EXIST|M_UNLOCKED},
 #endif
 
-               {"SummaryViewPopup/View"                        , M_SINGLE_TARGET_EXIST},
-               {"SummaryViewPopup/View/OpenInNewWindow"     , M_SINGLE_TARGET_EXIST},
-               {"SummaryViewPopup/View/MessageSource"          , M_SINGLE_TARGET_EXIST},
+               {"Menus/SummaryViewPopup/View"                  , M_SINGLE_TARGET_EXIST},
+               {"Menus/SummaryViewPopup/View/OpenNewWindow"     , M_SINGLE_TARGET_EXIST},
+               {"Menus/SummaryViewPopup/View/MessageSource"            , M_SINGLE_TARGET_EXIST},
 #ifndef GENERIC_UMPC
-               {"SummaryViewPopup/View/AllHeaders"             , M_SINGLE_TARGET_EXIST},
+               {"Menus/SummaryViewPopup/View/AllHeaders"               , M_SINGLE_TARGET_EXIST},
 #endif
-               {"SummaryViewPopup/SaveAs"                      , M_TARGET_EXIST},
+               {"Menus/SummaryViewPopup/SaveAs"                        , M_TARGET_EXIST},
 #ifndef GENERIC_UMPC
-               {"SummaryViewPopup/Print"                       , M_TARGET_EXIST},
+               {"Menus/SummaryViewPopup/Print"                 , M_TARGET_EXIST},
 #endif
                {NULL, 0}
        };
@@ -1840,7 +1692,7 @@ void summary_set_menu_sensitive(SummaryView *summaryview)
 
        for (i = 0; entry[i].entry != NULL; i++) {
                sensitive = ((entry[i].cond & state) == entry[i].cond);
-               cm_menu_set_sensitive(entry[i].entry, sensitive);
+               cm_menu_set_sensitive_full(summaryview->mainwin->ui_manager, entry[i].entry, sensitive);
        }
 
        summary_lock(summaryview);
@@ -1848,7 +1700,7 @@ void summary_set_menu_sensitive(SummaryView *summaryview)
        if (summaryview->messageview 
        &&  summaryview->messageview->mimeview
        &&  summaryview->messageview->mimeview->textview)
-               cm_toggle_menu_set_active("SummaryViewPopup/View/AllHeaders",
+               cm_toggle_menu_set_active_full(summaryview->mainwin->ui_manager, "Menus/SummaryViewPopup/View/AllHeaders",
                        summaryview->messageview->mimeview->textview->show_all_headers);
 #endif
        summary_unlock(summaryview);
@@ -1856,7 +1708,7 @@ void summary_set_menu_sensitive(SummaryView *summaryview)
 
 void summary_select_prev_unread(SummaryView *summaryview)
 {
-       GtkCTreeNode *node;
+       GtkCMCTreeNode *node;
        gboolean skip_cur = FALSE;
 
        if (summaryview->displayed 
@@ -1901,7 +1753,7 @@ void summary_select_prev_unread(SummaryView *summaryview)
 
 void summary_select_next_unread(SummaryView *summaryview)
 {
-       GtkCTreeNode *node = summaryview->selected;
+       GtkCMCTreeNode *node = summaryview->selected;
        gboolean skip_cur = FALSE;
        
        if (summaryview->displayed 
@@ -1955,7 +1807,7 @@ void summary_select_next_unread(SummaryView *summaryview)
 
 void summary_select_prev_new(SummaryView *summaryview)
 {
-       GtkCTreeNode *node;
+       GtkCMCTreeNode *node;
        gboolean skip_cur = FALSE;
 
        if (summaryview->displayed 
@@ -2000,7 +1852,7 @@ void summary_select_prev_new(SummaryView *summaryview)
 
 void summary_select_next_new(SummaryView *summaryview)
 {
-       GtkCTreeNode *node = summaryview->selected;
+       GtkCMCTreeNode *node = summaryview->selected;
        gboolean skip_cur = FALSE;
        
        if (summaryview->displayed 
@@ -2054,7 +1906,7 @@ void summary_select_next_new(SummaryView *summaryview)
 
 void summary_select_prev_marked(SummaryView *summaryview)
 {
-       GtkCTreeNode *node;
+       GtkCMCTreeNode *node;
 
        node = summary_find_prev_flagged_msg
                (summaryview, summaryview->selected, MSG_MARKED, TRUE);
@@ -2079,7 +1931,7 @@ void summary_select_prev_marked(SummaryView *summaryview)
 
 void summary_select_next_marked(SummaryView *summaryview)
 {
-       GtkCTreeNode *node = summaryview->selected;
+       GtkCMCTreeNode *node = summaryview->selected;
        gboolean skip_cur = FALSE;
        
        if (summaryview->displayed 
@@ -2133,7 +1985,7 @@ void summary_select_next_marked(SummaryView *summaryview)
 
 void summary_select_prev_labeled(SummaryView *summaryview)
 {
-       GtkCTreeNode *node;
+       GtkCMCTreeNode *node;
 
        node = summary_find_prev_flagged_msg
                (summaryview, summaryview->selected, MSG_CLABEL_FLAG_MASK, TRUE);
@@ -2158,7 +2010,7 @@ void summary_select_prev_labeled(SummaryView *summaryview)
 
 void summary_select_next_labeled(SummaryView *summaryview)
 {
-       GtkCTreeNode *node;
+       GtkCMCTreeNode *node;
 
        node = summary_find_next_flagged_msg
                (summaryview, summaryview->selected, MSG_CLABEL_FLAG_MASK, TRUE);
@@ -2189,27 +2041,51 @@ void summary_select_last_read(SummaryView *summaryview)
 
 void summary_select_parent(SummaryView *summaryview)
 {
-       GtkCTreeNode *node = NULL;
+       GtkCMCTreeNode *node = NULL;
 
        if (summaryview->selected)
-               node = GTK_CTREE_ROW(summaryview->selected)->parent;
+               node = GTK_CMCTREE_ROW(summaryview->selected)->parent;
        if (node)
                summary_select_node(summaryview, node, TRUE, FALSE);
 }
 
 void summary_select_by_msgnum(SummaryView *summaryview, guint msgnum)
 {
-       GtkCTreeNode *node;
+       GtkCMCTreeNode *node;
 
        node = summary_find_msg_by_msgnum(summaryview, msgnum);
        summary_select_node(summaryview, node, FALSE, TRUE);
 }
 
+void summary_select_by_msg_list(SummaryView    *summaryview, GSList *msginfos)
+{
+       GtkCMCTree *ctree;
+       GSList *msgnum_list, *walk;
+       gboolean froze = FALSE;
+
+       ctree = GTK_CMCTREE(summaryview->ctree);
+
+       msgnum_list = NULL;
+       for(walk = msginfos; walk; walk = walk->next) {
+               MsgInfo *msginfo;
+               msginfo = walk->data;
+               msgnum_list = g_slist_prepend(msgnum_list, GUINT_TO_POINTER(msginfo->msgnum));
+       }
+       START_LONG_OPERATION(summaryview, FALSE);
+       for(walk = msgnum_list; walk; walk = walk->next) {
+               GtkCMCTreeNode *node;
+               node = summary_find_msg_by_msgnum(summaryview, GPOINTER_TO_UINT(walk->data));
+               gtk_cmctree_select(ctree, node);
+       }
+       END_LONG_OPERATION(summaryview);
+       g_slist_free(msgnum_list);
+}
+
 typedef struct _PostponedSelectData
 {
-       GtkCTree *ctree;
-       GtkCTreeNode *row;
-       GtkCTreeNode *node;
+       GtkCMCTree *ctree;
+       GtkCMCTreeNode *row;
+       GtkCMCTreeNode *node;
        GtkScrollType type;
        gint column;
        SummaryView *summaryview;
@@ -2245,10 +2121,10 @@ static gboolean summary_select_retry(void *data)
  * TRUE, display the corresponding message in the message view.
  * If @do_refresh is TRUE, the widget is refreshed.
  **/
-void summary_select_node(SummaryView *summaryview, GtkCTreeNode *node,
+void summary_select_node(SummaryView *summaryview, GtkCMCTreeNode *node,
                         gboolean display_msg, gboolean do_refresh)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
        
        if (summary_is_locked(summaryview)
        && !GTK_SCTREE(ctree)->selecting_range
@@ -2280,7 +2156,7 @@ void summary_select_node(SummaryView *summaryview, GtkCTreeNode *node,
                        GTK_EVENTS_FLUSH();
                        summary_unlock(summaryview);
                        gtk_widget_grab_focus(GTK_WIDGET(ctree));
-                       gtk_ctree_node_moveto(ctree, node, 0, 0.5, 0);
+                       gtk_cmctree_node_moveto(ctree, node, 0, 0.5, 0);
                }
                if (display_msg && summaryview->displayed == node)
                        summaryview->displayed = NULL;
@@ -2291,57 +2167,57 @@ void summary_select_node(SummaryView *summaryview, GtkCTreeNode *node,
        }
 }
 
-guint summary_get_msgnum(SummaryView *summaryview, GtkCTreeNode *node)
+guint summary_get_msgnum(SummaryView *summaryview, GtkCMCTreeNode *node)
 {
-       GtkCTree *ctree =NULL;
+       GtkCMCTree *ctree =NULL;
        MsgInfo *msginfo;
 
        if (!summaryview)
                return 0;
-       ctree = GTK_CTREE(summaryview->ctree);
+       ctree = GTK_CMCTREE(summaryview->ctree);
        if (!node)
                return 0;
-       msginfo = gtk_ctree_node_get_row_data(ctree, node);
+       msginfo = gtk_cmctree_node_get_row_data(ctree, node);
        if (msginfo)
                return msginfo->msgnum;
        else 
                return -1;
 }
 
-static GtkCTreeNode *summary_find_prev_msg(SummaryView *summaryview,
-                                          GtkCTreeNode *current_node)
+static GtkCMCTreeNode *summary_find_prev_msg(SummaryView *summaryview,
+                                          GtkCMCTreeNode *current_node)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
-       GtkCTreeNode *node;
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
+       GtkCMCTreeNode *node;
        MsgInfo *msginfo;
 
        if (current_node)
                node = current_node;
        else
-               node = gtk_ctree_node_nth(ctree, GTK_CLIST(ctree)->rows - 1);
+               node = gtk_cmctree_node_nth(ctree, GTK_CMCLIST(ctree)->rows - 1);
 
-       for (; node != NULL; node = GTK_CTREE_NODE_PREV(node)) {
-               msginfo = gtk_ctree_node_get_row_data(ctree, node);
+       for (; node != NULL; node = GTK_CMCTREE_NODE_PREV(node)) {
+               msginfo = gtk_cmctree_node_get_row_data(ctree, node);
                if (msginfo && !MSG_IS_DELETED(msginfo->flags)) break;
        }
 
        return node;
 }
 
-static GtkCTreeNode *summary_find_next_msg(SummaryView *summaryview,
-                                          GtkCTreeNode *current_node)
+static GtkCMCTreeNode *summary_find_next_msg(SummaryView *summaryview,
+                                          GtkCMCTreeNode *current_node)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
-       GtkCTreeNode *node;
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
+       GtkCMCTreeNode *node;
        MsgInfo *msginfo;
 
        if (current_node)
                node = current_node;
        else
-               node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
+               node = GTK_CMCTREE_NODE(GTK_CMCLIST(ctree)->row_list);
 
        for (; node != NULL; node = gtkut_ctree_node_next(ctree, node)) {
-               msginfo = gtk_ctree_node_get_row_data(ctree, node);
+               msginfo = gtk_cmctree_node_get_row_data(ctree, node);
                if (msginfo && !MSG_IS_DELETED(msginfo->flags) 
                && !MSG_IS_MOVE(msginfo->flags)) break;
        }
@@ -2349,38 +2225,38 @@ static GtkCTreeNode *summary_find_next_msg(SummaryView *summaryview,
        return node;
 }
 
-static GtkCTreeNode *summary_find_prev_flagged_msg(SummaryView *summaryview,
-                                                  GtkCTreeNode *current_node,
+static GtkCMCTreeNode *summary_find_prev_flagged_msg(SummaryView *summaryview,
+                                                  GtkCMCTreeNode *current_node,
                                                   MsgPermFlags flags,
                                                   gboolean start_from_prev)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
-       GtkCTreeNode *node;
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
+       GtkCMCTreeNode *node;
        MsgInfo *msginfo;
 
        if (current_node) {
                if (start_from_prev)
-                       node = GTK_CTREE_NODE_PREV(current_node);
+                       node = GTK_CMCTREE_NODE_PREV(current_node);
                else
                        node = current_node;
        } else
-               node = gtk_ctree_node_nth(ctree, GTK_CLIST(ctree)->rows - 1);
+               node = gtk_cmctree_node_nth(ctree, GTK_CMCLIST(ctree)->rows - 1);
 
-       for (; node != NULL; node = GTK_CTREE_NODE_PREV(node)) {
-               msginfo = gtk_ctree_node_get_row_data(ctree, node);
+       for (; node != NULL; node = GTK_CMCTREE_NODE_PREV(node)) {
+               msginfo = gtk_cmctree_node_get_row_data(ctree, node);
                if (msginfo && (msginfo->flags.perm_flags & flags) != 0) break;
        }
 
        return node;
 }
 
-static GtkCTreeNode *summary_find_next_flagged_msg(SummaryView *summaryview,
-                                                  GtkCTreeNode *current_node,
+static GtkCMCTreeNode *summary_find_next_flagged_msg(SummaryView *summaryview,
+                                                  GtkCMCTreeNode *current_node,
                                                   MsgPermFlags flags,
                                                   gboolean start_from_next)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
-       GtkCTreeNode *node;
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
+       GtkCMCTreeNode *node;
        MsgInfo *msginfo;
 
        if (current_node) {
@@ -2389,10 +2265,10 @@ static GtkCTreeNode *summary_find_next_flagged_msg(SummaryView *summaryview,
                else
                        node = current_node;
        } else
-               node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
+               node = GTK_CMCTREE_NODE(GTK_CMCLIST(ctree)->row_list);
 
        for (; node != NULL; node = gtkut_ctree_node_next(ctree, node)) {
-               msginfo = gtk_ctree_node_get_row_data(ctree, node);
+               msginfo = gtk_cmctree_node_get_row_data(ctree, node);
                /* Find msg with matching flags but ignore messages with
                   ignore flags, if searching for new or unread messages */
                if ((msginfo && (msginfo->flags.perm_flags & flags) != 0) &&
@@ -2404,17 +2280,17 @@ static GtkCTreeNode *summary_find_next_flagged_msg(SummaryView *summaryview,
        return node;
 }
 
-static GtkCTreeNode *summary_find_msg_by_msgnum(SummaryView *summaryview,
+static GtkCMCTreeNode *summary_find_msg_by_msgnum(SummaryView *summaryview,
                                                guint msgnum)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
-       GtkCTreeNode *node;
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
+       GtkCMCTreeNode *node;
        MsgInfo *msginfo;
 
-       node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
+       node = GTK_CMCTREE_NODE(GTK_CMCLIST(ctree)->row_list);
 
        for (; node != NULL; node = gtkut_ctree_node_next(ctree, node)) {
-               msginfo = gtk_ctree_node_get_row_data(ctree, node);
+               msginfo = gtk_cmctree_node_get_row_data(ctree, node);
                if (msginfo && msginfo->msgnum == msgnum) break;
        }
 
@@ -2448,11 +2324,11 @@ static gint attract_compare_func(gconstpointer a, gconstpointer b)
 
 void summary_attract_by_subject(SummaryView *summaryview)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
-       GtkCList *clist = GTK_CLIST(ctree);
-       GtkCTreeNode *src_node;
-       GtkCTreeNode *dst_node, *sibling;
-       GtkCTreeNode *tmp;
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
+       GtkCMCList *clist = GTK_CMCLIST(ctree);
+       GtkCMCTreeNode *src_node;
+       GtkCMCTreeNode *dst_node, *sibling;
+       GtkCMCTreeNode *tmp;
        MsgInfo *src_msginfo, *dst_msginfo;
        GHashTable *subject_table;
 
@@ -2466,10 +2342,10 @@ void summary_attract_by_subject(SummaryView *summaryview)
        subject_table = g_hash_table_new(attract_hash_func,
                                         attract_compare_func);
 
-       for (src_node = GTK_CTREE_NODE(clist->row_list);
+       for (src_node = GTK_CMCTREE_NODE(clist->row_list);
             src_node != NULL;
             src_node = tmp) {
-               tmp = GTK_CTREE_ROW(src_node)->sibling;
+               tmp = GTK_CMCTREE_ROW(src_node)->sibling;
                src_msginfo = GTKUT_CTREE_NODE_GET_ROW_DATA(src_node);
                if (!src_msginfo) continue;
                if (!src_msginfo->subject) continue;
@@ -2487,9 +2363,9 @@ void summary_attract_by_subject(SummaryView *summaryview)
                            > 60 * 60 * 24 * 20)
                                continue;
 
-                       sibling = GTK_CTREE_ROW(dst_node)->sibling;
+                       sibling = GTK_CMCTREE_ROW(dst_node)->sibling;
                        if (src_node != sibling)
-                               gtk_ctree_move(ctree, src_node, NULL, sibling);
+                               gtk_cmctree_move(ctree, src_node, NULL, sibling);
                }
 
                g_hash_table_insert(subject_table,
@@ -2498,7 +2374,7 @@ void summary_attract_by_subject(SummaryView *summaryview)
 
        g_hash_table_destroy(subject_table);
 
-       gtk_ctree_node_moveto(ctree, summaryview->selected, 0, 0.5, 0);
+       gtk_cmctree_node_moveto(ctree, summaryview->selected, 0, 0.5, 0);
 
        summary_thaw(summaryview);
 
@@ -2508,22 +2384,22 @@ void summary_attract_by_subject(SummaryView *summaryview)
        main_window_cursor_normal(summaryview->mainwin);
 }
 
-static void summary_free_msginfo_func(GtkCTree *ctree, GtkCTreeNode *node,
+static void summary_free_msginfo_func(GtkCMCTree *ctree, GtkCMCTreeNode *node,
                                      gpointer data)
 {
-       MsgInfo *msginfo = gtk_ctree_node_get_row_data(ctree, node);
+       MsgInfo *msginfo = gtk_cmctree_node_get_row_data(ctree, node);
 
        if (msginfo)
                procmsg_msginfo_free(msginfo);
 }
 
-static void summary_set_marks_func(GtkCTree *ctree, GtkCTreeNode *node,
+static void summary_set_marks_func(GtkCMCTree *ctree, GtkCMCTreeNode *node,
                                   gpointer data)
 {
        SummaryView *summaryview = data;
        MsgInfo *msginfo;
 
-       msginfo = gtk_ctree_node_get_row_data(ctree, node);
+       msginfo = gtk_cmctree_node_get_row_data(ctree, node);
 
        if (MSG_IS_DELETED(msginfo->flags))
                summaryview->deleted++;
@@ -2535,14 +2411,14 @@ static void summary_set_marks_func(GtkCTree *ctree, GtkCTreeNode *node,
 
 static void summary_update_status(SummaryView *summaryview)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
-       GtkCTreeNode *node;
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
+       GtkCMCTreeNode *node;
        MsgInfo *msginfo;
 
        summaryview->total_size =
        summaryview->deleted = summaryview->moved = summaryview->copied = 0;
 
-       for (node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
+       for (node = GTK_CMCTREE_NODE(GTK_CMCLIST(ctree)->row_list);
             node != NULL; node = gtkut_ctree_node_next(ctree, node)) {
                msginfo = GTKUT_CTREE_NODE_GET_ROW_DATA(node);
                
@@ -2584,11 +2460,11 @@ static void summary_status_show(SummaryView *summaryview)
                return;
        }
 
-       rowlist = GTK_CLIST(summaryview->ctree)->selection;
+       rowlist = GTK_CMCLIST(summaryview->ctree)->selection;
        for (cur = rowlist; cur != NULL && cur->data != NULL; cur = cur->next) {
-               msginfo = gtk_ctree_node_get_row_data
-                       (GTK_CTREE(summaryview->ctree),
-                        GTK_CTREE_NODE(cur->data));
+               msginfo = gtk_cmctree_node_get_row_data
+                       (GTK_CMCTREE(summaryview->ctree),
+                        GTK_CMCTREE_NODE(cur->data));
                if (msginfo) {
                        sel_size += msginfo->size;
                        n_selected++;
@@ -2596,12 +2472,13 @@ static void summary_status_show(SummaryView *summaryview)
        }
        
        if (summaryview->folder_item->hide_read_msgs 
+       || summaryview->folder_item->hide_del_msgs
        || quicksearch_is_active(summaryview->quicksearch)) {
-               rowlist = GTK_CLIST(summaryview->ctree)->row_list;
+               rowlist = GTK_CMCLIST(summaryview->ctree)->row_list;
                for (cur = rowlist; cur != NULL && cur->data != NULL; cur = cur->next) {
-                       msginfo = gtk_ctree_node_get_row_data
-                               (GTK_CTREE(summaryview->ctree),
-                                GTK_CTREE_NODE(cur));
+                       msginfo = gtk_cmctree_node_get_row_data
+                               (GTK_CMCTREE(summaryview->ctree),
+                                GTK_CMCTREE_NODE(cur));
                        if (msginfo) {
                                n_size += msginfo->size;
                                n_total++;
@@ -2665,10 +2542,7 @@ static void summary_status_show(SummaryView *summaryview)
 
        if (n_selected) {
                sel = g_strdup_printf(" (%s)", to_human_readable((goffset)sel_size));
-               if (n_selected == 1)
-                       itstr = g_strdup(_(" item selected"));
-               else
-                       itstr = g_strdup(_(" items selected"));
+               itstr = g_strdup_printf(ngettext(" item selected"," items selected", n_selected));
        } else {
                sel = g_strdup("");
                itstr = g_strdup("");
@@ -2742,7 +2616,7 @@ static void summary_status_show(SummaryView *summaryview)
 
 static void summary_set_column_titles(SummaryView *summaryview)
 {
-       GtkCList *clist = GTK_CLIST(summaryview->ctree);
+       GtkCMCList *clist = GTK_CMCLIST(summaryview->ctree);
        FolderItem *item = summaryview->folder_item;
        GtkWidget *hbox;
        GtkWidget *label;
@@ -2794,25 +2668,25 @@ static void summary_set_column_titles(SummaryView *summaryview)
                }
 
                if (type == S_COL_MIME) {
-                       label = gtk_image_new_from_pixmap(clipxpm, clipxpmmask);
+                       label = gtk_image_new_from_pixbuf(clipxpm);
                        gtk_widget_show(label);
-                       gtk_clist_set_column_widget(clist, pos, label);
+                       gtk_cmclist_set_column_widget(clist, pos, label);
                        gtk_sctree_set_column_tooltip(GTK_SCTREE(clist), pos, _("Attachment"));
                        continue;
                } else if (type == S_COL_MARK) {
-                       label = gtk_image_new_from_pixmap(markxpm, markxpmmask);
+                       label = gtk_image_new_from_pixbuf(markxpm);
                        gtk_widget_show(label);
-                       gtk_clist_set_column_widget(clist, pos, label);
+                       gtk_cmclist_set_column_widget(clist, pos, label);
                        gtk_sctree_set_column_tooltip(GTK_SCTREE(clist), pos, _("Mark"));
                        continue;
                } else if (type == S_COL_LOCKED) {
-                       label = gtk_image_new_from_pixmap(lockedxpm, lockedxpmmask);
+                       label = gtk_image_new_from_pixbuf(lockedxpm);
                        gtk_widget_show(label);
-                       gtk_clist_set_column_widget(clist, pos, label);
+                       gtk_cmclist_set_column_widget(clist, pos, label);
                        gtk_sctree_set_column_tooltip(GTK_SCTREE(clist), pos, _("Locked"));
                        continue;
                } else if (type == S_COL_STATUS) {
-                       gtk_clist_set_column_title(clist, pos, title);
+                       gtk_cmclist_set_column_title(clist, pos, title);
                        gtk_sctree_set_column_tooltip(GTK_SCTREE(clist), pos, _("Status"));
                        continue;
                }
@@ -2835,6 +2709,7 @@ static void summary_set_column_titles(SummaryView *summaryview)
                                (summaryview->sort_type == SORT_ASCENDING
                                 ? GTK_ARROW_DOWN : GTK_ARROW_UP,
                                 GTK_SHADOW_IN);
+                       gtk_widget_set_size_request(GTK_WIDGET(arrow), 10, 10);
                        if (justify == GTK_JUSTIFY_RIGHT)
                                gtk_box_pack_start(GTK_BOX(hbox), arrow,
                                                   FALSE, FALSE, 0);
@@ -2844,7 +2719,7 @@ static void summary_set_column_titles(SummaryView *summaryview)
                }
 
                gtk_widget_show_all(hbox);
-               gtk_clist_set_column_widget(clist, pos, hbox);
+               gtk_cmclist_set_column_widget(clist, pos, hbox);
        }
 }
 
@@ -2852,23 +2727,23 @@ void summary_reflect_tags_changes(SummaryView *summaryview)
 {
        GtkMenuShell *menu;
        GList *cur;
-       GtkCTreeNode *node;
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCMCTreeNode *node;
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
        gboolean froze = FALSE;
        gboolean redisplay = FALSE;
 
        /* re-create colorlabel submenu */
        menu = GTK_MENU_SHELL(summaryview->tags_menu);
-       g_return_if_fail(menu != NULL);
+       cm_return_if_fail(menu != NULL);
 
        /* clear items. get item pointers. */
        for (cur = menu->children; cur != NULL && cur->data != NULL; cur = cur->next) {
-               gtk_menu_item_remove_submenu(GTK_MENU_ITEM(cur->data));
+               gtk_menu_item_set_submenu(GTK_MENU_ITEM(cur->data), NULL);
        }
        summary_tags_menu_create(summaryview, TRUE);
 
        START_LONG_OPERATION(summaryview, TRUE);
-       for (node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list); node != NULL;
+       for (node = GTK_CMCTREE_NODE(GTK_CMCLIST(ctree)->row_list); node != NULL;
             node = gtkut_ctree_node_next(ctree, node)) {
                redisplay |= summary_set_row_tag(summaryview,
                                           node, TRUE, FALSE, 0);
@@ -2884,6 +2759,7 @@ void summary_reflect_prefs(void)
        static gchar *last_smallfont = NULL;
        static gchar *last_normalfont = NULL;
        static gchar *last_boldfont = NULL;
+       static gboolean last_derive = 0;
        gboolean update_font = FALSE;
        SummaryView *summaryview = NULL;
 
@@ -2893,7 +2769,8 @@ void summary_reflect_prefs(void)
 
        if (!last_smallfont || strcmp(last_smallfont, SMALL_FONT) ||
                        !last_normalfont || strcmp(last_normalfont, NORMAL_FONT) ||
-                       !last_boldfont || strcmp(last_boldfont, BOLD_FONT))
+                       !last_boldfont || strcmp(last_boldfont, BOLD_FONT) ||
+                       last_derive != prefs_common.derive_from_normal_font)
                update_font = TRUE;
 
        g_free(last_smallfont);
@@ -2902,6 +2779,7 @@ void summary_reflect_prefs(void)
        last_normalfont = g_strdup(NORMAL_FONT);
        g_free(last_boldfont);
        last_boldfont = g_strdup(BOLD_FONT);
+       last_derive = prefs_common.derive_from_normal_font;
 
        if (update_font) {      
                bold_style = bold_marked_style = bold_deleted_style = 
@@ -2919,9 +2797,9 @@ void summary_reflect_prefs(void)
 void summary_sort(SummaryView *summaryview,
                  FolderSortKey sort_key, FolderSortType sort_type)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
-       GtkCList *clist = GTK_CLIST(summaryview->ctree);
-       GtkCListCompareFunc cmp_func = NULL;
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
+       GtkCMCList *clist = GTK_CMCLIST(summaryview->ctree);
+       GtkCMCListCompareFunc cmp_func = NULL;
        START_TIMING("");
        g_signal_handlers_block_by_func(G_OBJECT(summaryview->ctree),
                                       G_CALLBACK(summary_tree_expanded), summaryview);
@@ -2929,49 +2807,51 @@ void summary_sort(SummaryView *summaryview,
 
        switch (sort_key) {
        case SORT_BY_MARK:
-               cmp_func = (GtkCListCompareFunc)summary_cmp_by_mark;
+               cmp_func = (GtkCMCListCompareFunc)summary_cmp_by_mark;
                break;
        case SORT_BY_STATUS:
-               cmp_func = (GtkCListCompareFunc)summary_cmp_by_status;
+               cmp_func = (GtkCMCListCompareFunc)summary_cmp_by_status;
                break;
        case SORT_BY_MIME:
-               cmp_func = (GtkCListCompareFunc)summary_cmp_by_mime;
+               cmp_func = (GtkCMCListCompareFunc)summary_cmp_by_mime;
                break;
        case SORT_BY_NUMBER:
-               cmp_func = (GtkCListCompareFunc)summary_cmp_by_num;
+               cmp_func = (GtkCMCListCompareFunc)summary_cmp_by_num;
                break;
        case SORT_BY_SIZE:
-               cmp_func = (GtkCListCompareFunc)summary_cmp_by_size;
+               cmp_func = (GtkCMCListCompareFunc)summary_cmp_by_size;
                break;
        case SORT_BY_DATE:
-               cmp_func = (GtkCListCompareFunc)summary_cmp_by_date;
+               cmp_func = (GtkCMCListCompareFunc)summary_cmp_by_date;
                break;
        case SORT_BY_THREAD_DATE:
-               cmp_func = (GtkCListCompareFunc)summary_cmp_by_thread_date;
+               cmp_func = (GtkCMCListCompareFunc)summary_cmp_by_thread_date;
                break;
        case SORT_BY_FROM:
-               cmp_func = (GtkCListCompareFunc)summary_cmp_by_from;
+               cmp_func = (GtkCMCListCompareFunc)summary_cmp_by_from;
                break;
        case SORT_BY_SUBJECT:
+#ifndef G_OS_WIN32
                if (summaryview->simplify_subject_preg)
-                       cmp_func = (GtkCListCompareFunc)summary_cmp_by_simplified_subject;
+                       cmp_func = (GtkCMCListCompareFunc)summary_cmp_by_simplified_subject;
                else
-                       cmp_func = (GtkCListCompareFunc)summary_cmp_by_subject;
+#endif
+                       cmp_func = (GtkCMCListCompareFunc)summary_cmp_by_subject;
                break;
        case SORT_BY_SCORE:
-               cmp_func = (GtkCListCompareFunc)summary_cmp_by_score;
+               cmp_func = (GtkCMCListCompareFunc)summary_cmp_by_score;
                break;
        case SORT_BY_LABEL:
-               cmp_func = (GtkCListCompareFunc)summary_cmp_by_label;
+               cmp_func = (GtkCMCListCompareFunc)summary_cmp_by_label;
                break;
        case SORT_BY_TO:
-               cmp_func = (GtkCListCompareFunc)summary_cmp_by_to;
+               cmp_func = (GtkCMCListCompareFunc)summary_cmp_by_to;
                break;
        case SORT_BY_LOCKED:
-               cmp_func = (GtkCListCompareFunc)summary_cmp_by_locked;
+               cmp_func = (GtkCMCListCompareFunc)summary_cmp_by_locked;
                break;
        case SORT_BY_TAGS:
-               cmp_func = (GtkCListCompareFunc)summary_cmp_by_tags;
+               cmp_func = (GtkCMCListCompareFunc)summary_cmp_by_tags;
                break;
        case SORT_BY_NONE:
                break;
@@ -2995,12 +2875,12 @@ void summary_sort(SummaryView *summaryview,
 
                main_window_cursor_wait(summaryview->mainwin);
 
-               gtk_clist_set_compare_func(clist, cmp_func);
+               gtk_cmclist_set_compare_func(clist, cmp_func);
 
-               gtk_clist_set_sort_type(clist, (GtkSortType)sort_type);
+               gtk_cmclist_set_sort_type(clist, (GtkSortType)sort_type);
                gtk_sctree_sort_recursive(ctree, NULL);
 
-               gtk_ctree_node_moveto(ctree, summaryview->selected, 0, 0.5, 0);
+               gtk_cmctree_node_moveto(ctree, summaryview->selected, 0, 0.5, 0);
 
                main_window_cursor_normal(summaryview->mainwin);
 
@@ -3039,8 +2919,8 @@ static void summary_find_thread_age(GNode *gnode)
        msginfo->thread_date = most_recent;
 }
 
-static gboolean summary_insert_gnode_func(GtkCTree *ctree, guint depth, GNode *gnode,
-                                  GtkCTreeNode *cnode, gpointer data)
+static gboolean summary_insert_gnode_func(GtkCMCTree *ctree, guint depth, GNode *gnode,
+                                  GtkCMCTreeNode *cnode, gpointer data)
 {
        SummaryView *summaryview = (SummaryView *)data;
        MsgInfo *msginfo = (MsgInfo *)gnode->data;
@@ -3053,9 +2933,9 @@ static gboolean summary_insert_gnode_func(GtkCTree *ctree, guint depth, GNode *g
        summary_set_header(summaryview, text, msginfo);
 
        gtk_sctree_set_node_info(ctree, cnode, text[col_pos[S_COL_SUBJECT]], 2,
-                               NULL, NULL, NULL, NULL, FALSE, summaryview->threaded && !summaryview->thread_collapsed);
+                               NULL, NULL, FALSE, summaryview->threaded && !summaryview->thread_collapsed);
 #define SET_TEXT(col) {                                                \
-       gtk_ctree_node_set_text(ctree, cnode, col_pos[col],     \
+       gtk_cmctree_node_set_text(ctree, cnode, col_pos[col],   \
                                text[col_pos[col]]);            \
 }
 
@@ -3091,9 +2971,9 @@ static gboolean summary_insert_gnode_func(GtkCTree *ctree, guint depth, GNode *g
 static void summary_set_ctree_from_list(SummaryView *summaryview,
                                        GSList *mlist)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
        MsgInfo *msginfo;
-       GtkCTreeNode *node = NULL;
+       GtkCMCTreeNode *node = NULL;
        GHashTable *msgid_table;
        GHashTable *subject_table = NULL;
        GSList * cur;
@@ -3152,7 +3032,7 @@ static void summary_set_ctree_from_list(SummaryView *summaryview,
 
                        node = gtk_sctree_insert_node
                                (ctree, NULL, node, text, 2,
-                                NULL, NULL, NULL, NULL,
+                                NULL, NULL,
                                 FALSE, FALSE);
                        if (vert && prefs_common.two_line_vert)
                                g_free(text[summaryview->col_pos[S_COL_SUBJECT]]);
@@ -3177,9 +3057,9 @@ static void summary_set_ctree_from_list(SummaryView *summaryview,
            summaryview->col_pos[S_COL_SUBJECT] == N_SUMMARY_COLS - 1) {
                gint optimal_width;
 
-               optimal_width = gtk_clist_optimal_column_width
-                       (GTK_CLIST(ctree), summaryview->col_pos[S_COL_SUBJECT]);
-               gtk_clist_set_column_width(GTK_CLIST(ctree),
+               optimal_width = gtk_cmclist_optimal_column_width
+                       (GTK_CMCLIST(ctree), summaryview->col_pos[S_COL_SUBJECT]);
+               gtk_cmclist_set_column_width(GTK_CMCLIST(ctree),
                                           summaryview->col_pos[S_COL_SUBJECT],
                                           optimal_width);
        }
@@ -3199,13 +3079,13 @@ static void summary_set_ctree_from_list(SummaryView *summaryview,
 
        summary_sort(summaryview, summaryview->sort_key, summaryview->sort_type);
 
-       node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
+       node = GTK_CMCTREE_NODE(GTK_CMCLIST(ctree)->row_list);
 
        if (prefs_common.bold_unread) {
                START_TIMING("bold_unread");
                while (node) {
-                       GtkCTreeNode *next = GTK_CTREE_NODE_NEXT(node);
-                       if (GTK_CTREE_ROW(node)->children)
+                       GtkCMCTreeNode *next = GTK_CMCTREE_NODE_NEXT(node);
+                       if (GTK_CMCTREE_ROW(node)->children)
                                summary_set_row_marks(summaryview, node);
                        node = next;
                }
@@ -3301,7 +3181,7 @@ static inline void summary_set_header(SummaryView *summaryview, gchar *text[],
        /* slow! */
        if (summaryview->col_state[summaryview->col_pos[S_COL_DATE]].visible || 
            (vert && prefs_common.two_line_vert)) {
-               if (msginfo->date_t) {
+               if (msginfo->date_t && msginfo->date_t > 0) {
                        procheader_date_get_localtime(date_modified,
                                                      sizeof(date_modified),
                                                      msginfo->date_t);
@@ -3354,17 +3234,29 @@ static inline void summary_set_header(SummaryView *summaryview, gchar *text[],
        if (!should_swap) {
                text[col_pos[S_COL_FROM]] = from_text;
        } else {
+               if (prefs_common.use_addr_book) {
+                       gchar *tmp = summary_complete_address(to_text);
+                       if (tmp) {
+                               strncpy2(buf, tmp, sizeof(buf));
+                               g_free(tmp);
+                               to_text = buf;
+                       } else {
+                               to_text = to_text ? to_text : _("(No From)");
+                       }
+               }
                snprintf(tmp2, BUFFSIZE-1, "--> %s", to_text);
                tmp2[BUFFSIZE-1]='\0';
                text[col_pos[S_COL_FROM]] = tmp2;
        }
        
+#ifndef G_OS_WIN32
        if (summaryview->simplify_subject_preg != NULL)
                text[col_pos[S_COL_SUBJECT]] = msginfo->subject ? 
                        string_remove_match(tmp3, BUFFSIZE, msginfo->subject, 
                                        summaryview->simplify_subject_preg) : 
                        _("(No Subject)");
        else 
+#endif
                text[col_pos[S_COL_SUBJECT]] = msginfo->subject ? msginfo->subject :
                        _("(No Subject)");
        if (vert && prefs_common.two_line_vert) {
@@ -3386,7 +3278,7 @@ static inline void summary_set_header(SummaryView *summaryview, gchar *text[],
        }
 }
 
-static void summary_display_msg(SummaryView *summaryview, GtkCTreeNode *row)
+static void summary_display_msg(SummaryView *summaryview, GtkCMCTreeNode *row)
 {
        summary_display_msg_full(summaryview, row, FALSE, FALSE);
 }
@@ -3482,11 +3374,11 @@ gboolean defer_change(gpointer data)
 }
 
 static void msginfo_mark_as_read (SummaryView *summaryview, MsgInfo *msginfo,
-                                     GtkCTreeNode *row)
+                                     GtkCMCTreeNode *row)
 {
-       g_return_if_fail(summaryview != NULL);
-       g_return_if_fail(msginfo != NULL);
-       g_return_if_fail(row != NULL);
+       cm_return_if_fail(summaryview != NULL);
+       cm_return_if_fail(msginfo != NULL);
+       cm_return_if_fail(row != NULL);
 
        if (MSG_IS_NEW(msginfo->flags) || MSG_IS_UNREAD(msginfo->flags)) {
                summary_msginfo_unset_flags
@@ -3517,10 +3409,10 @@ static int msginfo_mark_as_read_timeout(void *data)
 }
 
 static void summary_display_msg_full(SummaryView *summaryview,
-                                    GtkCTreeNode *row,
+                                    GtkCMCTreeNode *row,
                                     gboolean new_window, gboolean all_headers)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
        MsgInfo *msginfo;
        gint val;
        START_TIMING("");
@@ -3530,7 +3422,7 @@ static void summary_display_msg_full(SummaryView *summaryview,
                else if (summaryview->messageview)
                        summaryview->messageview->filtered = FALSE;
        }                       
-       g_return_if_fail(row != NULL);
+       cm_return_if_fail(row != NULL);
 
        if (summary_is_locked(summaryview)) return;
        summary_lock(summaryview);
@@ -3538,9 +3430,14 @@ static void summary_display_msg_full(SummaryView *summaryview,
        STATUSBAR_POP(summaryview->mainwin);
        GTK_EVENTS_FLUSH();
 
-       msginfo = gtk_ctree_node_get_row_data(ctree, row);
-       
-       g_return_if_fail(msginfo);
+       msginfo = gtk_cmctree_node_get_row_data(ctree, row);
+
+       if (!msginfo) {
+               debug_print("NULL msginfo\n");
+               summary_unlock(summaryview);
+               END_TIMING();
+               return;
+       }       
 
        if (new_window && prefs_common.layout_mode != SMALL_LAYOUT) {
                MessageView *msgview;
@@ -3559,10 +3456,10 @@ static void summary_display_msg_full(SummaryView *summaryview,
                        summaryview->last_displayed = summaryview->displayed;
                        summaryview->displayed = row;
                        val = messageview_show(msgview, msginfo, all_headers);
-                       if (GTK_CLIST(msgview->mimeview->ctree)->row_list == NULL)
+                       if (GTK_CMCLIST(msgview->mimeview->ctree)->row_list == NULL)
                                gtk_widget_grab_focus(summaryview->ctree);
                        gtkut_ctree_node_move_if_on_the_edge(ctree, row,
-                               GTK_CLIST(summaryview->ctree)->focus_row);
+                               GTK_CMCLIST(summaryview->ctree)->focus_row);
                } else {
                        msgview = summaryview->messageview;
                        summaryview->last_displayed = summaryview->displayed;
@@ -3572,10 +3469,10 @@ static void summary_display_msg_full(SummaryView *summaryview,
                                GTK_EVENTS_FLUSH();
                        }
                        val = messageview_show(msgview, msginfo, all_headers);
-                       if (GTK_CLIST(msgview->mimeview->ctree)->row_list == NULL)
+                       if (GTK_CMCLIST(msgview->mimeview->ctree)->row_list == NULL)
                                gtk_widget_grab_focus(summaryview->ctree);
                        gtkut_ctree_node_move_if_on_the_edge(ctree, row,
-                               GTK_CLIST(summaryview->ctree)->focus_row);
+                               GTK_CMCLIST(summaryview->ctree)->focus_row);
                }
        }
 
@@ -3585,8 +3482,13 @@ static void summary_display_msg_full(SummaryView *summaryview,
                        MarkAsReadData *data = g_new0(MarkAsReadData, 1);
                        data->summaryview = summaryview;
                        data->msginfo = msginfo;
+#if GLIB_CHECK_VERSION(2,14,0)
+                       g_timeout_add_seconds(prefs_common.mark_as_read_delay,
+                               msginfo_mark_as_read_timeout, data);
+#else
                        g_timeout_add(prefs_common.mark_as_read_delay * 1000,
                                msginfo_mark_as_read_timeout, data);
+#endif
                } else if (new_window || !prefs_common.mark_as_read_on_new_window) {
                        msginfo_mark_as_read(summaryview, msginfo, row);
                }
@@ -3611,7 +3513,7 @@ void summary_display_msg_selected(SummaryView *summaryview,
 
 void summary_redisplay_msg(SummaryView *summaryview)
 {
-       GtkCTreeNode *node;
+       GtkCMCTreeNode *node;
 
        if (summaryview->displayed) {
                node = summaryview->displayed;
@@ -3632,14 +3534,14 @@ void summary_open_msg(SummaryView *summaryview)
 
 void summary_view_source(SummaryView * summaryview)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
        MsgInfo *msginfo;
        SourceWindow *srcwin;
 
        if (!summaryview->selected) return;
 
        srcwin = source_window_create();
-       msginfo = gtk_ctree_node_get_row_data(ctree, summaryview->selected);
+       msginfo = gtk_cmctree_node_get_row_data(ctree, summaryview->selected);
        source_window_show_msg(srcwin, msginfo);
        source_window_show(srcwin);
 #ifdef MAEMO
@@ -3657,7 +3559,7 @@ void summary_reedit(SummaryView *summaryview)
        if (!FOLDER_SHOWS_TO_HDR(summaryview->folder_item))
                return;
 
-       msginfo = gtk_ctree_node_get_row_data(GTK_CTREE(summaryview->ctree),
+       msginfo = gtk_cmctree_node_get_row_data(GTK_CMCTREE(summaryview->ctree),
                                              summaryview->selected);
        if (!msginfo) return;
 
@@ -3666,8 +3568,8 @@ void summary_reedit(SummaryView *summaryview)
 
 gboolean summary_step(SummaryView *summaryview, GtkScrollType type)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
-       GtkCTreeNode *node;
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
+       GtkCMCTreeNode *node;
 
        if (summary_is_locked(summaryview)
        && !GTK_SCTREE(ctree)->selecting_range
@@ -3696,7 +3598,7 @@ gboolean summary_step(SummaryView *summaryview, GtkScrollType type)
                        return FALSE;
        } else {
                if (summaryview->selected) {
-                       node = GTK_CTREE_NODE_PREV(summaryview->selected);
+                       node = GTK_CMCTREE_NODE_PREV(summaryview->selected);
                        if (!node) return FALSE;
                }
        }
@@ -3706,10 +3608,10 @@ gboolean summary_step(SummaryView *summaryview, GtkScrollType type)
 
        g_signal_emit_by_name(G_OBJECT(ctree), "scroll_vertical", type, 0.0);
 
-       if (GTK_CLIST(ctree)->selection)
+       if (GTK_CMCLIST(ctree)->selection)
                gtk_sctree_set_anchor_row
                        (GTK_SCTREE(ctree),
-                        GTK_CTREE_NODE(GTK_CLIST(ctree)->selection->data));
+                        GTK_CMCTREE_NODE(GTK_CMCLIST(ctree)->selection->data));
 
        return TRUE;
 }
@@ -3732,174 +3634,179 @@ void summary_toggle_view(SummaryView *summaryview)
                main_window_toggle_message_view(summaryview->mainwin);
 }
 
-static gboolean summary_search_unread_recursive(GtkCTree *ctree,
-                                               GtkCTreeNode *node)
+static gboolean summary_search_unread_recursive(GtkCMCTree *ctree,
+                                               GtkCMCTreeNode *node)
 {
        MsgInfo *msginfo;
 
        if (node) {
-               msginfo = gtk_ctree_node_get_row_data(ctree, node);
+               msginfo = gtk_cmctree_node_get_row_data(ctree, node);
                if (msginfo && MSG_IS_UNREAD(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags))
                        return TRUE;
-               node = GTK_CTREE_ROW(node)->children;
+               node = GTK_CMCTREE_ROW(node)->children;
        } else
-               node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
+               node = GTK_CMCTREE_NODE(GTK_CMCLIST(ctree)->row_list);
 
        while (node) {
                if (summary_search_unread_recursive(ctree, node) == TRUE)
                        return TRUE;
-               node = GTK_CTREE_ROW(node)->sibling;
+               node = GTK_CMCTREE_ROW(node)->sibling;
        }
 
        return FALSE;
 }
 
 static gboolean summary_have_unread_children(SummaryView *summaryview,
-                                            GtkCTreeNode *node)
+                                            GtkCMCTreeNode *node)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
 
        if (!node) return FALSE;
 
-       node = GTK_CTREE_ROW(node)->children;
+       node = GTK_CMCTREE_ROW(node)->children;
 
        while (node) {
                if (summary_search_unread_recursive(ctree, node) == TRUE)
                        return TRUE;
-               node = GTK_CTREE_ROW(node)->sibling;
+               node = GTK_CMCTREE_ROW(node)->sibling;
        }
        return FALSE;
 }
 
-static void summary_set_row_marks(SummaryView *summaryview, GtkCTreeNode *row)
+static void summary_set_row_marks(SummaryView *summaryview, GtkCMCTreeNode *row)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
        GtkStyle *style = NULL;
        MsgInfo *msginfo;
        MsgFlags flags;
        gint *col_pos = summaryview->col_pos;
 
-       msginfo = gtk_ctree_node_get_row_data(ctree, row);
+       msginfo = gtk_cmctree_node_get_row_data(ctree, row);
        if (!msginfo) return;
 
        flags = msginfo->flags;
 
-       gtk_ctree_node_set_foreground(ctree, row, NULL);
+       gtk_cmctree_node_set_foreground(ctree, row, NULL);
 
        /* set new/unread column */
        if (MSG_IS_IGNORE_THREAD(flags)) {
-               gtk_ctree_node_set_pixmap(ctree, row, col_pos[S_COL_STATUS],
-                                         ignorethreadxpm, ignorethreadxpmmask);
+               gtk_cmctree_node_set_pixbuf(ctree, row, col_pos[S_COL_STATUS],
+                                         ignorethreadxpm);
        } else if (MSG_IS_WATCH_THREAD(flags)) {
-               gtk_ctree_node_set_pixmap(ctree, row, col_pos[S_COL_STATUS],
-                                         watchthreadxpm, watchthreadxpmmask);
+               gtk_cmctree_node_set_pixbuf(ctree, row, col_pos[S_COL_STATUS],
+                                         watchthreadxpm);
        } else if (MSG_IS_SPAM(flags)) {
-               gtk_ctree_node_set_pixmap(ctree, row, col_pos[S_COL_STATUS],
-                                         spamxpm, spamxpmmask);
+               gtk_cmctree_node_set_pixbuf(ctree, row, col_pos[S_COL_STATUS],
+                                         spamxpm);
        } else if (MSG_IS_NEW(flags)) {
-               gtk_ctree_node_set_pixmap(ctree, row, col_pos[S_COL_STATUS],
-                                         newxpm, newxpmmask);
+               gtk_cmctree_node_set_pixbuf(ctree, row, col_pos[S_COL_STATUS],
+                                         newxpm);
        } else if (MSG_IS_UNREAD(flags)) {
-               gtk_ctree_node_set_pixmap(ctree, row, col_pos[S_COL_STATUS],
-                                         unreadxpm, unreadxpmmask);
+               gtk_cmctree_node_set_pixbuf(ctree, row, col_pos[S_COL_STATUS],
+                                         unreadxpm);
        } else if (MSG_IS_REPLIED(flags)) {
-               gtk_ctree_node_set_pixmap(ctree, row, col_pos[S_COL_STATUS],
-                                         repliedxpm, repliedxpmmask);
+               gtk_cmctree_node_set_pixbuf(ctree, row, col_pos[S_COL_STATUS],
+                                         repliedxpm);
        } else if (MSG_IS_FORWARDED(flags)) {
-               gtk_ctree_node_set_pixmap(ctree, row, col_pos[S_COL_STATUS],
-                                         forwardedxpm, forwardedxpmmask);
+               gtk_cmctree_node_set_pixbuf(ctree, row, col_pos[S_COL_STATUS],
+                                         forwardedxpm);
        } else {
-               gtk_ctree_node_set_text(ctree, row, col_pos[S_COL_STATUS],
+               gtk_cmctree_node_set_text(ctree, row, col_pos[S_COL_STATUS],
                                        "");
        }
 
        if (prefs_common.bold_unread &&
            ((MSG_IS_UNREAD(flags) && !MSG_IS_IGNORE_THREAD(flags)) ||
-            (!GTK_CTREE_ROW(row)->expanded &&
-             GTK_CTREE_ROW(row)->children &&
+            (!GTK_CMCTREE_ROW(row)->expanded &&
+             GTK_CMCTREE_ROW(row)->children &&
              summary_have_unread_children(summaryview, row))))
                style = bold_style;
 
        /* set mark column */
        if (MSG_IS_DELETED(flags)) {
-               gtk_ctree_node_set_pixmap(ctree, row, col_pos[S_COL_MARK],
-                                         deletedxpm, deletedxpmmask);
+               gtk_cmctree_node_set_pixbuf(ctree, row, col_pos[S_COL_MARK],
+                                         deletedxpm);
                if (style)
                        style = bold_deleted_style;
                else {
                        style = small_deleted_style;
                }
-                       gtk_ctree_node_set_foreground
+                       gtk_cmctree_node_set_foreground
                                (ctree, row, &summaryview->color_dim);
        } else if (MSG_IS_MARKED(flags)) {
-               gtk_ctree_node_set_pixmap(ctree, row, col_pos[S_COL_MARK],
-                                         markxpm, markxpmmask);
+               gtk_cmctree_node_set_pixbuf(ctree, row, col_pos[S_COL_MARK],
+                                         markxpm);
        } else if (MSG_IS_MOVE(flags)) {
-               gtk_ctree_node_set_pixmap(ctree, row, col_pos[S_COL_MARK],
-                                         movedxpm, movedxpmmask);
+               gtk_cmctree_node_set_pixbuf(ctree, row, col_pos[S_COL_MARK],
+                                         movedxpm);
                if (style)
                        style = bold_marked_style;
                else {
                        style = small_marked_style;
                }
-                       gtk_ctree_node_set_foreground
+                       gtk_cmctree_node_set_foreground
                                (ctree, row, &summaryview->color_marked);
        } else if (MSG_IS_COPY(flags)) {
-               gtk_ctree_node_set_pixmap(ctree, row, col_pos[S_COL_MARK],
-                                         copiedxpm, copiedxpmmask);
+               gtk_cmctree_node_set_pixbuf(ctree, row, col_pos[S_COL_MARK],
+                                         copiedxpm);
                if (style)
                        style = bold_marked_style;
                else {
                        style = small_marked_style;
                }
-                       gtk_ctree_node_set_foreground
+                       gtk_cmctree_node_set_foreground
                                (ctree, row, &summaryview->color_marked);
        } else {
-               gtk_ctree_node_set_text(ctree, row, col_pos[S_COL_MARK], "");
+               gtk_cmctree_node_set_text(ctree, row, col_pos[S_COL_MARK], "");
        }
 
        if (MSG_IS_LOCKED(flags)) {
-               gtk_ctree_node_set_pixmap(ctree, row, col_pos[S_COL_LOCKED],
-                                         lockedxpm, lockedxpmmask);
+               gtk_cmctree_node_set_pixbuf(ctree, row, col_pos[S_COL_LOCKED],
+                                         lockedxpm);
        }
        else {
-               gtk_ctree_node_set_text(ctree, row, col_pos[S_COL_LOCKED], "");
+               gtk_cmctree_node_set_text(ctree, row, col_pos[S_COL_LOCKED], "");
        }
 
        if (MSG_IS_WITH_ATTACHMENT(flags) && MSG_IS_SIGNED(flags)) {
-               gtk_ctree_node_set_pixmap(ctree, row, col_pos[S_COL_MIME],
-                                         clipgpgsignedxpm, clipgpgsignedxpmmask);
+               gtk_cmctree_node_set_pixbuf(ctree, row, col_pos[S_COL_MIME],
+                                         clipgpgsignedxpm);
        } else if (MSG_IS_SIGNED(flags)) {
-               gtk_ctree_node_set_pixmap(ctree, row, col_pos[S_COL_MIME],
-                                         gpgsignedxpm, gpgsignedxpmmask);
+               if (MSG_IS_ENCRYPTED(flags)) {
+                       gtk_cmctree_node_set_pixbuf(ctree, row, col_pos[S_COL_MIME],
+                                         keysignxpm);
+               } else {
+                       gtk_cmctree_node_set_pixbuf(ctree, row, col_pos[S_COL_MIME],
+                                                 gpgsignedxpm);
+               }
        } else if (MSG_IS_WITH_ATTACHMENT(flags) && MSG_IS_ENCRYPTED(flags)) {
-               gtk_ctree_node_set_pixmap(ctree, row, col_pos[S_COL_MIME],
-                                         clipkeyxpm, clipkeyxpmmask);
+               gtk_cmctree_node_set_pixbuf(ctree, row, col_pos[S_COL_MIME],
+                                         clipkeyxpm);
        } else if (MSG_IS_ENCRYPTED(flags)) {
-               gtk_ctree_node_set_pixmap(ctree, row, col_pos[S_COL_MIME],
-                                         keyxpm, keyxpmmask);
+               gtk_cmctree_node_set_pixbuf(ctree, row, col_pos[S_COL_MIME],
+                                         keyxpm);
        } else if (MSG_IS_WITH_ATTACHMENT(flags)) {
-               gtk_ctree_node_set_pixmap(ctree, row, col_pos[S_COL_MIME],
-                                         clipxpm, clipxpmmask);
+               gtk_cmctree_node_set_pixbuf(ctree, row, col_pos[S_COL_MIME],
+                                         clipxpm);
        } else {
-               gtk_ctree_node_set_text(ctree, row, col_pos[S_COL_MIME], "");
+               gtk_cmctree_node_set_text(ctree, row, col_pos[S_COL_MIME], "");
        }
        if (!style)
                style = small_style;
 
-       gtk_ctree_node_set_row_style(ctree, row, style);
+       gtk_cmctree_node_set_row_style(ctree, row, style);
 
        if (MSG_GET_COLORLABEL(flags))
                summary_set_colorlabel_color(ctree, row, MSG_GET_COLORLABEL_VALUE(flags));
 }
 
-static void summary_mark_row(SummaryView *summaryview, GtkCTreeNode *row)
+static void summary_mark_row(SummaryView *summaryview, GtkCMCTreeNode *row)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
        MsgInfo *msginfo;
 
-       msginfo = gtk_ctree_node_get_row_data(ctree, row);
-       g_return_if_fail(msginfo);
+       msginfo = gtk_cmctree_node_get_row_data(ctree, row);
+       cm_return_if_fail(msginfo);
        if (MSG_IS_DELETED(msginfo->flags))
                summaryview->deleted--;
        if (MSG_IS_MOVE(msginfo->flags))
@@ -3914,14 +3821,14 @@ static void summary_mark_row(SummaryView *summaryview, GtkCTreeNode *row)
        debug_print("Message %s/%d is marked\n", msginfo->folder->path, msginfo->msgnum);
 }
 
-static void summary_lock_row(SummaryView *summaryview, GtkCTreeNode *row)
+static void summary_lock_row(SummaryView *summaryview, GtkCMCTreeNode *row)
 {
        gboolean changed = FALSE;
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
        MsgInfo *msginfo;
 
-       msginfo = gtk_ctree_node_get_row_data(ctree, row);
-       g_return_if_fail(msginfo);
+       msginfo = gtk_cmctree_node_get_row_data(ctree, row);
+       cm_return_if_fail(msginfo);
        if (MSG_IS_DELETED(msginfo->flags))
                summaryview->deleted--;
        if (MSG_IS_MOVE(msginfo->flags)) {
@@ -3940,13 +3847,13 @@ static void summary_lock_row(SummaryView *summaryview, GtkCTreeNode *row)
        debug_print("Message %d is locked\n", msginfo->msgnum);
 }
 
-static void summary_unlock_row(SummaryView *summaryview, GtkCTreeNode *row)
+static void summary_unlock_row(SummaryView *summaryview, GtkCMCTreeNode *row)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
        MsgInfo *msginfo;
 
-       msginfo = gtk_ctree_node_get_row_data(ctree, row);
-       g_return_if_fail(msginfo);
+       msginfo = gtk_cmctree_node_get_row_data(ctree, row);
+       cm_return_if_fail(msginfo);
        if (!MSG_IS_LOCKED(msginfo->flags))
                return;
        procmsg_msginfo_set_to_folder(msginfo, NULL);
@@ -3957,7 +3864,7 @@ static void summary_unlock_row(SummaryView *summaryview, GtkCTreeNode *row)
 
 void summary_mark(SummaryView *summaryview)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
        GList *cur;
        gboolean froze = FALSE;
 
@@ -3965,8 +3872,8 @@ void summary_mark(SummaryView *summaryview)
                return;
        START_LONG_OPERATION(summaryview, FALSE);
        folder_item_set_batch(summaryview->folder_item, TRUE);
-       for (cur = GTK_CLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next)
-               summary_mark_row(summaryview, GTK_CTREE_NODE(cur->data));
+       for (cur = GTK_CMCLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next)
+               summary_mark_row(summaryview, GTK_CMCTREE_NODE(cur->data));
        folder_item_set_batch(summaryview->folder_item, FALSE);
        END_LONG_OPERATION(summaryview);
 
@@ -3974,13 +3881,13 @@ void summary_mark(SummaryView *summaryview)
 }
 
 static void summary_mark_row_as_read(SummaryView *summaryview,
-                                    GtkCTreeNode *row)
+                                    GtkCMCTreeNode *row)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
        MsgInfo *msginfo;
 
-       msginfo = gtk_ctree_node_get_row_data(ctree, row);
-       g_return_if_fail(msginfo);
+       msginfo = gtk_cmctree_node_get_row_data(ctree, row);
+       cm_return_if_fail(msginfo);
 
        if(!(MSG_IS_NEW(msginfo->flags) || MSG_IS_UNREAD(msginfo->flags)))
                return;
@@ -3993,7 +3900,7 @@ static void summary_mark_row_as_read(SummaryView *summaryview,
 
 void summary_mark_as_read(SummaryView *summaryview)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
        GList *cur;
        gboolean froze = FALSE;
 
@@ -4001,9 +3908,9 @@ void summary_mark_as_read(SummaryView *summaryview)
                return;
        START_LONG_OPERATION(summaryview, FALSE);
        folder_item_set_batch(summaryview->folder_item, TRUE);
-       for (cur = GTK_CLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next)
+       for (cur = GTK_CMCLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next)
                summary_mark_row_as_read(summaryview,
-                                        GTK_CTREE_NODE(cur->data));
+                                        GTK_CMCTREE_NODE(cur->data));
        folder_item_set_batch(summaryview->folder_item, FALSE);
        END_LONG_OPERATION(summaryview);
        
@@ -4012,16 +3919,16 @@ void summary_mark_as_read(SummaryView *summaryview)
 
 void summary_msgs_lock(SummaryView *summaryview)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
        GList *cur;
        gboolean froze = FALSE;
 
        if (summary_is_locked(summaryview))
                return;
        START_LONG_OPERATION(summaryview, FALSE);
-       for (cur = GTK_CLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next)
+       for (cur = GTK_CMCLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next)
                summary_lock_row(summaryview,
-                                        GTK_CTREE_NODE(cur->data));
+                                        GTK_CMCTREE_NODE(cur->data));
        END_LONG_OPERATION(summaryview);
        
        summary_status_show(summaryview);
@@ -4029,16 +3936,16 @@ void summary_msgs_lock(SummaryView *summaryview)
 
 void summary_msgs_unlock(SummaryView *summaryview)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
        GList *cur;
        gboolean froze = FALSE;
 
        if (summary_is_locked(summaryview))
                return;
        START_LONG_OPERATION(summaryview, FALSE);
-       for (cur = GTK_CLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next)
+       for (cur = GTK_CMCLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next)
                summary_unlock_row(summaryview,
-                                  GTK_CTREE_NODE(cur->data));
+                                  GTK_CMCTREE_NODE(cur->data));
        END_LONG_OPERATION(summaryview);
        
        summary_status_show(summaryview);
@@ -4046,8 +3953,8 @@ void summary_msgs_unlock(SummaryView *summaryview)
 
 void summary_mark_all_read(SummaryView *summaryview)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
-       GtkCTreeNode *node;
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
+       GtkCMCTreeNode *node;
        AlertValue val;
        gboolean froze = FALSE;
 
@@ -4067,13 +3974,13 @@ void summary_mark_all_read(SummaryView *summaryview)
                return;
        START_LONG_OPERATION(summaryview, TRUE);
        folder_item_set_batch(summaryview->folder_item, TRUE);
-       for (node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list); node != NULL;
+       for (node = GTK_CMCTREE_NODE(GTK_CMCLIST(ctree)->row_list); node != NULL;
             node = gtkut_ctree_node_next(ctree, node))
                summary_mark_row_as_read(summaryview, node);
        folder_item_set_batch(summaryview->folder_item, FALSE);
-       for (node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list); node != NULL;
+       for (node = GTK_CMCTREE_NODE(GTK_CMCLIST(ctree)->row_list); node != NULL;
             node = gtkut_ctree_node_next(ctree, node)) {
-               if (!GTK_CTREE_ROW(node)->expanded)
+               if (!GTK_CMCTREE_ROW(node)->expanded)
                        summary_set_row_marks(summaryview, node);
        }
        END_LONG_OPERATION(summaryview);
@@ -4083,7 +3990,7 @@ void summary_mark_all_read(SummaryView *summaryview)
 
 void summary_mark_as_spam(SummaryView *summaryview, guint action, GtkWidget *widget)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
        GList *cur;
        gboolean is_spam = action;
        GSList *msgs = NULL;
@@ -4097,17 +4004,18 @@ void summary_mark_as_spam(SummaryView *summaryview, guint action, GtkWidget *wid
 
        prefs_common.immediate_exec = FALSE;
        START_LONG_OPERATION(summaryview, FALSE);
-       for (cur = GTK_CLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next) {
-               GtkCTreeNode *row = GTK_CTREE_NODE(cur->data);
-               MsgInfo *msginfo = gtk_ctree_node_get_row_data(ctree, row);
+       folder_item_set_batch(summaryview->folder_item, TRUE);
+       for (cur = GTK_CMCLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next) {
+               GtkCMCTreeNode *row = GTK_CMCTREE_NODE(cur->data);
+               MsgInfo *msginfo = gtk_cmctree_node_get_row_data(ctree, row);
                if (msginfo)
                        msgs = g_slist_prepend(msgs, msginfo);
        }
        
        if (procmsg_spam_learner_learn(NULL, msgs, is_spam) == 0) {
-               for (cur = GTK_CLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next) {
-                       GtkCTreeNode *row = GTK_CTREE_NODE(cur->data);
-                       MsgInfo *msginfo = gtk_ctree_node_get_row_data(ctree, row);
+               for (cur = GTK_CMCLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next) {
+                       GtkCMCTreeNode *row = GTK_CMCTREE_NODE(cur->data);
+                       MsgInfo *msginfo = gtk_cmctree_node_get_row_data(ctree, row);
                        if (!msginfo)
                                continue;
                        if (is_spam) {
@@ -4129,7 +4037,7 @@ void summary_mark_as_spam(SummaryView *summaryview, guint action, GtkWidget *wid
        }
 
        prefs_common.immediate_exec = immediate_exec;
-
+       folder_item_set_batch(summaryview->folder_item, FALSE);
        END_LONG_OPERATION(summaryview);
 
        if (prefs_common.immediate_exec && moved) {
@@ -4149,13 +4057,13 @@ void summary_mark_as_spam(SummaryView *summaryview, guint action, GtkWidget *wid
 
 
 static void summary_mark_row_as_unread(SummaryView *summaryview,
-                                      GtkCTreeNode *row)
+                                      GtkCMCTreeNode *row)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
        MsgInfo *msginfo;
 
-       msginfo = gtk_ctree_node_get_row_data(ctree, row);
-       g_return_if_fail(msginfo);
+       msginfo = gtk_cmctree_node_get_row_data(ctree, row);
+       cm_return_if_fail(msginfo);
        if (MSG_IS_DELETED(msginfo->flags)) {
                procmsg_msginfo_set_to_folder(msginfo, NULL);
                summary_msginfo_unset_flags(msginfo, MSG_DELETED, 0);
@@ -4171,7 +4079,7 @@ static void summary_mark_row_as_unread(SummaryView *summaryview,
 
 void summary_mark_as_unread(SummaryView *summaryview)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
        GList *cur;
        gboolean froze = FALSE;
 
@@ -4179,10 +4087,10 @@ void summary_mark_as_unread(SummaryView *summaryview)
                return;
        START_LONG_OPERATION(summaryview, FALSE);
        folder_item_set_batch(summaryview->folder_item, TRUE);
-       for (cur = GTK_CLIST(ctree)->selection; cur != NULL && cur->data != NULL; 
+       for (cur = GTK_CMCLIST(ctree)->selection; cur != NULL && cur->data != NULL; 
                cur = cur->next)
                summary_mark_row_as_unread(summaryview,
-                                          GTK_CTREE_NODE(cur->data));
+                                          GTK_CMCTREE_NODE(cur->data));
        folder_item_set_batch(summaryview->folder_item, FALSE);
        END_LONG_OPERATION(summaryview);
        
@@ -4238,13 +4146,13 @@ static gboolean check_permission(SummaryView *summaryview, MsgInfo * msginfo)
        }
 }
 
-static void summary_delete_row(SummaryView *summaryview, GtkCTreeNode *row)
+static void summary_delete_row(SummaryView *summaryview, GtkCMCTreeNode *row)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
        MsgInfo *msginfo;
 
-       msginfo = gtk_ctree_node_get_row_data(ctree, row);
-       g_return_if_fail(msginfo);
+       msginfo = gtk_cmctree_node_get_row_data(ctree, row);
+       cm_return_if_fail(msginfo);
 
        if (MSG_IS_LOCKED(msginfo->flags)) return;
 
@@ -4261,9 +4169,11 @@ static void summary_delete_row(SummaryView *summaryview, GtkCTreeNode *row)
        summaryview->deleted++;
 
        if (!prefs_common.immediate_exec && 
-           !folder_has_parent_of_type(summaryview->folder_item, F_TRASH))
+           !folder_has_parent_of_type(summaryview->folder_item, F_TRASH)) {
                summary_set_row_marks(summaryview, row);
-
+       } else if (summaryview->folder_item->folder->account && !summaryview->folder_item->folder->account->imap_use_trash) {
+               summary_set_row_marks(summaryview, row);
+       }
        debug_print("Message %s/%d is set to delete\n",
                    msginfo->folder->path, msginfo->msgnum);
 }
@@ -4272,7 +4182,7 @@ void summary_cancel(SummaryView *summaryview)
 {
        MsgInfo * msginfo;
 
-       msginfo = gtk_ctree_node_get_row_data(GTK_CTREE(summaryview->ctree),
+       msginfo = gtk_cmctree_node_get_row_data(GTK_CMCTREE(summaryview->ctree),
                                              summaryview->selected);
        if (!msginfo) return;
 
@@ -4297,11 +4207,11 @@ void summary_cancel(SummaryView *summaryview)
 
 void summary_delete(SummaryView *summaryview)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
        FolderItem *item = summaryview->folder_item;
        GList *cur;
-       GtkCTreeNode *sel_last = NULL;
-       GtkCTreeNode *node;
+       GtkCMCTreeNode *sel_last = NULL;
+       GtkCMCTreeNode *node;
        AlertValue aval;
        MsgInfo *msginfo;
        gboolean froze = FALSE;
@@ -4312,24 +4222,26 @@ void summary_delete(SummaryView *summaryview)
 
        if (!summaryview->folder_item) return;
 
-       if (!prefs_common.live_dangerously) {
-               gchar *buf = NULL;
-               int num = g_list_length(GTK_CLIST(summaryview->ctree)->selection);
-               buf = g_strdup_printf(ngettext(
-                       "Do you really want to delete the selected message?",
-                       "Do you really want to delete the %d selected messages?", num), 
-                       num);
-               aval = alertpanel(_("Delete message(s)"),
-                                 buf,
-                                 GTK_STOCK_CANCEL, "+"GTK_STOCK_DELETE, NULL);
-               g_free(buf);
-               if (aval != G_ALERTALTERNATE) return;
+       if (!summaryview->folder_item->folder->account || summaryview->folder_item->folder->account->imap_use_trash) {
+               if (!prefs_common.live_dangerously) {
+                       gchar *buf = NULL;
+                       int num = g_list_length(GTK_CMCLIST(summaryview->ctree)->selection);
+                       buf = g_strdup_printf(ngettext(
+                               "Do you really want to delete the selected message?",
+                               "Do you really want to delete the %d selected messages?", num), 
+                               num);
+                       aval = alertpanel(_("Delete message(s)"),
+                                         buf,
+                                         GTK_STOCK_CANCEL, "+"GTK_STOCK_DELETE, NULL);
+                       g_free(buf);
+                       if (aval != G_ALERTALTERNATE) return;
+               }
        }
 
-       for (cur = GTK_CLIST(ctree)->selection; cur != NULL && cur->data != NULL; 
+       for (cur = GTK_CMCLIST(ctree)->selection; cur != NULL && cur->data != NULL; 
             cur = cur->next) {
-               GtkCTreeNode *row = GTK_CTREE_NODE(cur->data);
-               msginfo = gtk_ctree_node_get_row_data(ctree, row);
+               GtkCMCTreeNode *row = GTK_CMCTREE_NODE(cur->data);
+               msginfo = gtk_cmctree_node_get_row_data(ctree, row);
                if (msginfo && msginfo->total_size != 0 && 
                    msginfo->size != (goffset)msginfo->total_size)
                        partial_mark_for_delete(msginfo);
@@ -4341,8 +4253,8 @@ void summary_delete(SummaryView *summaryview)
         * that is not deleted. */
        START_LONG_OPERATION(summaryview, FALSE);
        folder_item_set_batch(summaryview->folder_item, TRUE);
-       for (cur = GTK_CLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next) {
-               sel_last = GTK_CTREE_NODE(cur->data);
+       for (cur = GTK_CMCLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next) {
+               sel_last = GTK_CMCTREE_NODE(cur->data);
                summary_delete_row(summaryview, sel_last);
        }
        folder_item_set_batch(summaryview->folder_item, FALSE);
@@ -4380,20 +4292,21 @@ void summary_delete_trash(SummaryView *summaryview)
                to_folder = summaryview->folder_item->folder->trash;
        
        if (to_folder == NULL || to_folder == summaryview->folder_item
-           || folder_has_parent_of_type(summaryview->folder_item, F_TRASH))
+           || folder_has_parent_of_type(summaryview->folder_item, F_TRASH)
+           || (summaryview->folder_item->folder->account && !summaryview->folder_item->folder->account->imap_use_trash))
                summary_delete(summaryview);
        else
                summary_move_selected_to(summaryview, to_folder);
 }
 
 
-static void summary_unmark_row(SummaryView *summaryview, GtkCTreeNode *row)
+static void summary_unmark_row(SummaryView *summaryview, GtkCMCTreeNode *row)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
        MsgInfo *msginfo;
 
-       msginfo = gtk_ctree_node_get_row_data(ctree, row);
-       g_return_if_fail(msginfo);
+       msginfo = gtk_cmctree_node_get_row_data(ctree, row);
+       cm_return_if_fail(msginfo);
        if (MSG_IS_DELETED(msginfo->flags))
                summaryview->deleted--;
        if (MSG_IS_MOVE(msginfo->flags))
@@ -4412,7 +4325,7 @@ static void summary_unmark_row(SummaryView *summaryview, GtkCTreeNode *row)
 
 void summary_unmark(SummaryView *summaryview)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
        GList *cur;
        gboolean froze = FALSE;
 
@@ -4420,24 +4333,24 @@ void summary_unmark(SummaryView *summaryview)
                return;
        START_LONG_OPERATION(summaryview, FALSE);
        folder_item_set_batch(summaryview->folder_item, TRUE);
-       for (cur = GTK_CLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next)
-               summary_unmark_row(summaryview, GTK_CTREE_NODE(cur->data));
+       for (cur = GTK_CMCLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next)
+               summary_unmark_row(summaryview, GTK_CMCTREE_NODE(cur->data));
        folder_item_set_batch(summaryview->folder_item, FALSE);
        END_LONG_OPERATION(summaryview);
        
        summary_status_show(summaryview);
 }
 
-static void summary_move_row_to(SummaryView *summaryview, GtkCTreeNode *row,
+static void summary_move_row_to(SummaryView *summaryview, GtkCMCTreeNode *row,
                                FolderItem *to_folder)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
        MsgInfo *msginfo;
 
-       g_return_if_fail(to_folder != NULL);
+       cm_return_if_fail(to_folder != NULL);
 
-       msginfo = gtk_ctree_node_get_row_data(ctree, row);
-       g_return_if_fail(msginfo);
+       msginfo = gtk_cmctree_node_get_row_data(ctree, row);
+       cm_return_if_fail(msginfo);
        if (MSG_IS_LOCKED(msginfo->flags))
                return;
 
@@ -4457,6 +4370,8 @@ static void summary_move_row_to(SummaryView *summaryview, GtkCTreeNode *row,
        
        if (!prefs_common.immediate_exec) {
                summary_set_row_marks(summaryview, row);
+       } else if (msginfo->folder->folder->account && !msginfo->folder->folder->account->imap_use_trash) {
+               summary_set_row_marks(summaryview, row);
        }
 
        debug_print("Message %d is set to move to %s\n",
@@ -4466,7 +4381,7 @@ static void summary_move_row_to(SummaryView *summaryview, GtkCTreeNode *row,
 void summary_move_selected_to(SummaryView *summaryview, FolderItem *to_folder)
 {
        GList *cur;
-       GtkCTreeNode *sel_last = NULL;
+       GtkCMCTreeNode *sel_last = NULL;
        gboolean froze = FALSE;
 
        if (!to_folder) return;
@@ -4488,11 +4403,11 @@ void summary_move_selected_to(SummaryView *summaryview, FolderItem *to_folder)
 
        START_LONG_OPERATION(summaryview, FALSE); 
 
-       for (cur = GTK_CLIST(summaryview->ctree)->selection;
+       for (cur = GTK_CMCLIST(summaryview->ctree)->selection;
             cur != NULL && cur->data != NULL; cur = cur->next) {
-               sel_last = GTK_CTREE_NODE(cur->data);
+               sel_last = GTK_CMCTREE_NODE(cur->data);
                summary_move_row_to
-                       (summaryview, GTK_CTREE_NODE(cur->data), to_folder);
+                       (summaryview, GTK_CMCTREE_NODE(cur->data), to_folder);
        }
        END_LONG_OPERATION(summaryview);
 
@@ -4503,7 +4418,7 @@ void summary_move_selected_to(SummaryView *summaryview, FolderItem *to_folder)
        if (prefs_common.immediate_exec) {
                summary_execute(summaryview);
        } else {
-               GtkCTreeNode *node = summary_find_next_msg(summaryview, sel_last);
+               GtkCMCTreeNode *node = summary_find_next_msg(summaryview, sel_last);
                if (!node)
                        node = summary_find_prev_msg(summaryview, sel_last);
                summary_select_node(summaryview, node, summaryview->display_msg, TRUE);
@@ -4511,8 +4426,8 @@ void summary_move_selected_to(SummaryView *summaryview, FolderItem *to_folder)
        }
        
        if (!summaryview->selected) { /* this was the last message */
-               GtkCTreeNode *node = gtk_ctree_node_nth (GTK_CTREE(summaryview->ctree), 
-                                                        GTK_CLIST(summaryview->ctree)->rows - 1);
+               GtkCMCTreeNode *node = gtk_cmctree_node_nth (GTK_CMCTREE(summaryview->ctree), 
+                                                        GTK_CMCLIST(summaryview->ctree)->rows - 1);
                if (node)
                        summary_select_node(summaryview, node, summaryview->display_msg, TRUE);
        }
@@ -4531,16 +4446,16 @@ void summary_move_to(SummaryView *summaryview)
        summary_move_selected_to(summaryview, to_folder);
 }
 
-static void summary_copy_row_to(SummaryView *summaryview, GtkCTreeNode *row,
+static void summary_copy_row_to(SummaryView *summaryview, GtkCMCTreeNode *row,
                                FolderItem *to_folder)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
        MsgInfo *msginfo;
 
-       g_return_if_fail(to_folder != NULL);
+       cm_return_if_fail(to_folder != NULL);
 
-       msginfo = gtk_ctree_node_get_row_data(ctree, row);
-       g_return_if_fail(msginfo);
+       msginfo = gtk_cmctree_node_get_row_data(ctree, row);
+       cm_return_if_fail(msginfo);
        procmsg_msginfo_set_to_folder(msginfo, to_folder);
        if (MSG_IS_DELETED(msginfo->flags))
                summaryview->deleted--;
@@ -4587,10 +4502,10 @@ void summary_copy_selected_to(SummaryView *summaryview, FolderItem *to_folder)
 
        START_LONG_OPERATION(summaryview, FALSE);
 
-       for (cur = GTK_CLIST(summaryview->ctree)->selection;
+       for (cur = GTK_CMCLIST(summaryview->ctree)->selection;
             cur != NULL && cur->data != NULL; cur = cur->next)
                summary_copy_row_to
-                       (summaryview, GTK_CTREE_NODE(cur->data), to_folder);
+                       (summaryview, GTK_CMCTREE_NODE(cur->data), to_folder);
 
        END_LONG_OPERATION(summaryview);
 
@@ -4619,7 +4534,7 @@ void summary_add_address(SummaryView *summaryview)
        GtkWidget *image = NULL;
        GdkPixbuf *picture = NULL;
 
-       msginfo = gtk_ctree_node_get_row_data(GTK_CTREE(summaryview->ctree),
+       msginfo = gtk_cmctree_node_get_row_data(GTK_CMCTREE(summaryview->ctree),
                                              summaryview->selected);
        if (!msginfo || !msginfo->from) 
                return;
@@ -4658,7 +4573,7 @@ void summary_select_all(SummaryView *summaryview)
        if (!summaryview->folder_item) return;
 
        summary_lock(summaryview);
-       gtk_clist_select_all(GTK_CLIST(summaryview->ctree));
+       gtk_cmclist_select_all(GTK_CMCLIST(summaryview->ctree));
        summary_unlock(summaryview);
        summary_status_show(summaryview);
 }
@@ -4673,26 +4588,26 @@ void summary_unselect_all(SummaryView *summaryview)
 
 void summary_select_thread(SummaryView *summaryview, gboolean delete_thread)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
-       GtkCTreeNode *node = NULL;
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
+       GtkCMCTreeNode *node = NULL;
        gboolean froze = FALSE;
        GList *cur = NULL;
        GList *copy = NULL;
-       if (!GTK_CLIST(summaryview->ctree)->selection) 
+       if (!GTK_CMCLIST(summaryview->ctree)->selection) 
                return;
 
 
        START_LONG_OPERATION(summaryview, FALSE);
-       copy = g_list_copy(GTK_CLIST(summaryview->ctree)->selection);
+       copy = g_list_copy(GTK_CMCLIST(summaryview->ctree)->selection);
        for (cur = copy; cur != NULL && cur->data != NULL;
             cur = cur->next) {
-               node = GTK_CTREE_NODE(cur->data);
+               node = GTK_CMCTREE_NODE(cur->data);
                if (!node)
                        continue;
-               while (GTK_CTREE_ROW(node)->parent != NULL)
-                       node = GTK_CTREE_ROW(node)->parent;
+               while (GTK_CMCTREE_ROW(node)->parent != NULL)
+                       node = GTK_CMCTREE_ROW(node)->parent;
 
-               gtk_ctree_select_recursive(ctree, node);
+               gtk_cmctree_select_recursive(ctree, node);
        }
        g_list_free(copy);
        END_LONG_OPERATION(summaryview);
@@ -4708,7 +4623,7 @@ void summary_select_thread(SummaryView *summaryview, gboolean delete_thread)
 
 void summary_save_as(SummaryView *summaryview)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
        MsgInfo *msginfo;
        gchar *filename = NULL;
        gchar *src, *dest;
@@ -4717,7 +4632,7 @@ void summary_save_as(SummaryView *summaryview)
        AlertValue aval = 0;
 
        if (!summaryview->selected) return;
-       msginfo = gtk_ctree_node_get_row_data(ctree, summaryview->selected);
+       msginfo = gtk_cmctree_node_get_row_data(ctree, summaryview->selected);
        if (!msginfo) return;
 
        if (msginfo->subject) {
@@ -4764,10 +4679,10 @@ void summary_save_as(SummaryView *summaryview)
         * If two or more msgs are selected,
         * append them to the output file.
         */
-       if (GTK_CLIST(ctree)->selection->next) {
+       if (GTK_CMCLIST(ctree)->selection->next) {
                GList *item;
-               for (item = GTK_CLIST(ctree)->selection->next; item != NULL; item=item->next) {
-                       msginfo = gtk_ctree_node_get_row_data(ctree, GTK_CTREE_NODE(item->data));
+               for (item = GTK_CMCLIST(ctree)->selection->next; item != NULL; item=item->next) {
+                       msginfo = gtk_cmctree_node_get_row_data(ctree, GTK_CMCTREE_NODE(item->data));
                        if (!msginfo) break;
                        src = procmsg_get_message_file(msginfo);
                        if (append_file(src, dest, TRUE) < 0)
@@ -4781,13 +4696,7 @@ void summary_save_as(SummaryView *summaryview)
 
 void summary_print(SummaryView *summaryview)
 {
-       GtkCList *clist = GTK_CLIST(summaryview->ctree);
-#if !defined(USE_GNOMEPRINT) && !GTK_CHECK_VERSION(2,10,0)
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
-       MsgInfo *msginfo;
-       gchar *cmdline = NULL;
-       gchar *p;
-#endif
+       GtkCMCList *clist = GTK_CMCLIST(summaryview->ctree);
        GList *cur;
        gchar *msg = g_strdup_printf(_("You are about to print %d "
                                       "messages, one by one. Do you "
@@ -4802,36 +4711,12 @@ void summary_print(SummaryView *summaryview)
        g_free(msg);
 
        if (clist->selection == NULL) return;
-#if !defined(USE_GNOMEPRINT) && !GTK_CHECK_VERSION(2,10,0)
-       cmdline = input_dialog(_("Print"),
-                              _("Enter the print command line:\n"
-                                "('%s' will be replaced with file name)"),
-                              prefs_common.print_cmd);
-       if (!cmdline) return;
-       if (!(p = strchr(cmdline, '%')) || *(p + 1) != 's' ||
-           strchr(p + 2, '%')) {
-               alertpanel_error(_("Print command line is invalid:\n'%s'"),
-                                cmdline);
-               g_free(cmdline);
-               return;
-       }
-       for (cur = clist->selection; 
-            cur != NULL && cur->data != NULL; 
-            cur = cur->next) {
-               msginfo = gtk_ctree_node_get_row_data
-                       (ctree, GTK_CTREE_NODE(cur->data));
-               if (msginfo) 
-                       procmsg_print_message(msginfo, cmdline);
-       }
-
-       g_free(cmdline);
-#else
        for (cur = clist->selection; 
             cur != NULL && cur->data != NULL; 
             cur = cur->next) {
-               GtkCTreeNode *node = GTK_CTREE_NODE(cur->data);
-               MsgInfo *msginfo = gtk_ctree_node_get_row_data(
-                                       GTK_CTREE(summaryview->ctree),
+               GtkCMCTreeNode *node = GTK_CMCTREE_NODE(cur->data);
+               MsgInfo *msginfo = gtk_cmctree_node_get_row_data(
+                                       GTK_CMCTREE(summaryview->ctree),
                                        node);
                gint sel_start = -1, sel_end = -1, partnum = 0;
                
@@ -4843,15 +4728,14 @@ void summary_print(SummaryView *summaryview)
                messageview_print(msginfo, summaryview->messageview->all_headers,
                        sel_start, sel_end, partnum);
        }
-#endif
 }
 
 gboolean summary_execute(SummaryView *summaryview)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
-       GtkCList *clist = GTK_CLIST(summaryview->ctree);
-       GtkCTreeNode *node, *next;
-       GtkCTreeNode *new_selected = NULL;
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
+       GtkCMCList *clist = GTK_CMCLIST(summaryview->ctree);
+       GtkCMCTreeNode *node, *next;
+       GtkCMCTreeNode *new_selected = NULL;
        gint move_val = -1;
 
        if (!summaryview->folder_item) return FALSE;
@@ -4871,25 +4755,25 @@ gboolean summary_execute(SummaryView *summaryview)
        summary_execute_copy(summaryview);
        summary_execute_delete(summaryview);
        
-       node = GTK_CTREE_NODE(clist->row_list);
+       node = GTK_CMCTREE_NODE(clist->row_list);
        for (; node != NULL; node = next) {
                next = gtkut_ctree_node_next(ctree, node);
-               if (gtk_ctree_node_get_row_data(ctree, node) != NULL) continue;
+               if (gtk_cmctree_node_get_row_data(ctree, node) != NULL) continue;
 
                if (node == summaryview->displayed) {
                        messageview_clear(summaryview->messageview);
                        summaryview->displayed = NULL;
                }
-               if (GTK_CTREE_ROW(node)->children != NULL) {
+               if (GTK_CMCTREE_ROW(node)->children != NULL) {
                        next = NULL;
-                       if (GTK_CTREE_ROW(node)->sibling) {
-                               next = GTK_CTREE_ROW(node)->sibling;
+                       if (GTK_CMCTREE_ROW(node)->sibling) {
+                               next = GTK_CMCTREE_ROW(node)->sibling;
                        } else {
-                               GtkCTreeNode *parent = NULL;
-                               for (parent = GTK_CTREE_ROW(node)->parent; parent != NULL;
-                                    parent = GTK_CTREE_ROW(parent)->parent) {
-                                       if (GTK_CTREE_ROW(parent)->sibling) {
-                                               next = GTK_CTREE_ROW(parent)->sibling;
+                               GtkCMCTreeNode *parent = NULL;
+                               for (parent = GTK_CMCTREE_ROW(node)->parent; parent != NULL;
+                                    parent = GTK_CMCTREE_ROW(parent)->parent) {
+                                       if (GTK_CMCTREE_ROW(parent)->sibling) {
+                                               next = GTK_CMCTREE_ROW(parent)->sibling;
                                        }
                                }
                        }
@@ -4924,19 +4808,20 @@ gboolean summary_execute(SummaryView *summaryview)
        summary_thaw(summaryview);
 
        summaryview->selected = clist->selection ?
-               GTK_CTREE_NODE(clist->selection->data) : NULL;
+               GTK_CMCTREE_NODE(clist->selection->data) : NULL;
 
-       if (!GTK_CLIST(summaryview->ctree)->row_list) {
+       if (!GTK_CMCLIST(summaryview->ctree)->row_list) {
                menu_set_insensitive_all
                        (GTK_MENU_SHELL(summaryview->popupmenu));
                gtk_widget_grab_focus(summaryview->folderview->ctree);
-       } else
+       } else {
+               menu_set_sensitive_all(GTK_MENU_SHELL(summaryview->popupmenu), TRUE);
                gtk_widget_grab_focus(summaryview->ctree);
-
+       }
        summary_update_status(summaryview);
        summary_status_show(summaryview);
 
-       gtk_ctree_node_moveto(ctree, summaryview->selected, 0, 0.5, 0);
+       gtk_cmctree_node_moveto(ctree, summaryview->selected, 0, 0.5, 0);
 
        summary_unlock(summaryview);
 
@@ -4947,14 +4832,131 @@ gboolean summary_execute(SummaryView *summaryview)
        return TRUE;
 }
 
+gboolean summary_expunge(SummaryView *summaryview)
+{
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
+       GtkCMCList *clist = GTK_CMCLIST(summaryview->ctree);
+       GtkCMCTreeNode *node, *next;
+       GtkCMCTreeNode *new_selected = NULL;
+
+       if (!summaryview->folder_item) return FALSE;
+
+       if (summary_is_locked(summaryview)) return FALSE;
+
+       summary_lock(summaryview);
+
+       summary_freeze(summaryview);
+
+       main_window_cursor_wait(summaryview->mainwin);
+
+       if (summaryview->threaded)
+               summary_unthread_for_exec(summaryview);
+
+       folder_item_update_freeze();
+       summary_execute_expunge(summaryview);
+       
+       node = GTK_CMCTREE_NODE(clist->row_list);
+       for (; node != NULL; node = next) {
+               next = gtkut_ctree_node_next(ctree, node);
+               if (gtk_cmctree_node_get_row_data(ctree, node) != NULL) continue;
+
+               if (node == summaryview->displayed) {
+                       messageview_clear(summaryview->messageview);
+                       summaryview->displayed = NULL;
+               }
+               if (GTK_CMCTREE_ROW(node)->children != NULL) {
+                       next = NULL;
+                       if (GTK_CMCTREE_ROW(node)->sibling) {
+                               next = GTK_CMCTREE_ROW(node)->sibling;
+                       } else {
+                               GtkCMCTreeNode *parent = NULL;
+                               for (parent = GTK_CMCTREE_ROW(node)->parent; parent != NULL;
+                                    parent = GTK_CMCTREE_ROW(parent)->parent) {
+                                       if (GTK_CMCTREE_ROW(parent)->sibling) {
+                                               next = GTK_CMCTREE_ROW(parent)->sibling;
+                                       }
+                               }
+                       }
+               }
+
+               if (!new_selected &&
+                   gtkut_ctree_node_is_selected(ctree, node)) {
+                       summary_unselect_all(summaryview);
+                       new_selected = summary_find_next_msg(summaryview, node);
+                       if (!new_selected)
+                               new_selected = summary_find_prev_msg
+                                       (summaryview, node);
+               }
+
+               gtk_sctree_remove_node((GtkSCTree *)ctree, node);
+       }
+
+       folder_item_update_thaw();
+
+       if (new_selected) {
+               summary_unlock(summaryview);
+               gtk_sctree_select
+                       (GTK_SCTREE(ctree), new_selected);
+               summary_lock(summaryview);
+       }
+
+       if (summaryview->threaded) {
+               summary_thread_build(summaryview);
+               summary_thread_init(summaryview);
+       }
+
+       summary_thaw(summaryview);
+
+       summaryview->selected = clist->selection ?
+               GTK_CMCTREE_NODE(clist->selection->data) : NULL;
+
+       if (!GTK_CMCLIST(summaryview->ctree)->row_list) {
+               menu_set_insensitive_all
+                       (GTK_MENU_SHELL(summaryview->popupmenu));
+               gtk_widget_grab_focus(summaryview->folderview->ctree);
+       } else {
+               menu_set_sensitive_all(GTK_MENU_SHELL(summaryview->popupmenu), TRUE);
+               gtk_widget_grab_focus(summaryview->ctree);
+       }
+
+       summary_update_status(summaryview);
+       summary_status_show(summaryview);
+
+       gtk_cmctree_node_moveto(ctree, summaryview->selected, 0, 0.5, 0);
+
+       summary_unlock(summaryview);
+
+       main_window_cursor_normal(summaryview->mainwin);
+
+       return TRUE;
+}
+
+static void summary_set_deleted_func(GtkCMCTree *ctree, GtkCMCTreeNode *node,
+                                     gpointer data)
+{
+       SummaryView *summaryview = data;
+       MsgInfo *msginfo;
+
+       msginfo = GTKUT_CTREE_NODE_GET_ROW_DATA(node);
+
+       if (msginfo && MSG_IS_MOVE(msginfo->flags)) {
+               msginfo->flags.tmp_flags &= ~ MSG_MOVE;
+               msginfo->flags.perm_flags |= MSG_DELETED;
+               summary_set_row_marks(summaryview, node);
+               summaryview->moved--;
+               summaryview->deleted++;
+       }
+}
+
 static gint summary_execute_move(SummaryView *summaryview)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
        GSList *cur;
        gint val = -1;
        /* search moving messages and execute */
-       gtk_ctree_pre_recursive(ctree, NULL, summary_execute_move_func,
-                               summaryview);
+       
+       gtk_cmctree_pre_recursive(ctree, NULL, summary_execute_move_func,
+                       summaryview);
 
        if (summaryview->mlist) {
                hooks_unregister_hook(MSGINFO_UPDATE_HOOKLIST,
@@ -4964,8 +4966,14 @@ static gint summary_execute_move(SummaryView *summaryview)
                hooks_register_hook(MSGINFO_UPDATE_HOOKLIST, 
                        summary_update_msg, (gpointer) summaryview);
 
-               for (cur = summaryview->mlist; cur != NULL && cur->data != NULL; cur = cur->next)
-                       procmsg_msginfo_free((MsgInfo *)cur->data);
+               if (!summaryview->folder_item->folder->account || summaryview->folder_item->folder->account->imap_use_trash) {
+                       for (cur = summaryview->mlist; cur != NULL && cur->data != NULL; cur = cur->next)
+                               procmsg_msginfo_free((MsgInfo *)cur->data);
+               } 
+               if (summaryview->folder_item->folder->account && !summaryview->folder_item->folder->account->imap_use_trash) {
+                       gtk_cmctree_pre_recursive(ctree, NULL, summary_set_deleted_func,
+                                       summaryview);
+               }
                g_slist_free(summaryview->mlist);
                summaryview->mlist = NULL;
                return val;
@@ -4973,7 +4981,7 @@ static gint summary_execute_move(SummaryView *summaryview)
        return 0;
 }
 
-static void summary_execute_move_func(GtkCTree *ctree, GtkCTreeNode *node,
+static void summary_execute_move_func(GtkCMCTree *ctree, GtkCMCTreeNode *node,
                                      gpointer data)
 {
        SummaryView *summaryview = data;
@@ -4984,31 +4992,34 @@ static void summary_execute_move_func(GtkCTree *ctree, GtkCTreeNode *node,
        if (msginfo && MSG_IS_MOVE(msginfo->flags) && msginfo->to_folder) {
                summaryview->mlist =
                        g_slist_prepend(summaryview->mlist, msginfo);
-               gtk_ctree_node_set_row_data(ctree, node, NULL);
-
-               if (msginfo->msgid && *msginfo->msgid &&
-                   node == g_hash_table_lookup(summaryview->msgid_table,
-                                               msginfo->msgid))
-                       g_hash_table_remove(summaryview->msgid_table,
-                                           msginfo->msgid);
-               if (prefs_common.thread_by_subject &&
-                   msginfo->subject && *msginfo->subject && 
-                   node == subject_table_lookup(summaryview->subject_table,
-                                                msginfo->subject)) {
-                       subject_table_remove(summaryview->subject_table,
-                                            msginfo->subject);
-               }                                           
+               if (!summaryview->folder_item->folder->account || 
+                    summaryview->folder_item->folder->account->imap_use_trash) {
+                       gtk_cmctree_node_set_row_data(ctree, node, NULL);
+
+                       if (msginfo->msgid && *msginfo->msgid &&
+                           node == g_hash_table_lookup(summaryview->msgid_table,
+                                                       msginfo->msgid))
+                               g_hash_table_remove(summaryview->msgid_table,
+                                                   msginfo->msgid);
+                       if (prefs_common.thread_by_subject &&
+                           msginfo->subject && *msginfo->subject && 
+                           node == subject_table_lookup(summaryview->subject_table,
+                                                        msginfo->subject)) {
+                               subject_table_remove(summaryview->subject_table,
+                                                    msginfo->subject);
+                       }
+               }
        }
 }
 
 static void summary_execute_copy(SummaryView *summaryview)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
 
        /* search copying messages and execute */
        hooks_unregister_hook(MSGINFO_UPDATE_HOOKLIST,
                summaryview->msginfo_update_callback_id);
-       gtk_ctree_pre_recursive(ctree, NULL, summary_execute_copy_func,
+       gtk_cmctree_pre_recursive(ctree, NULL, summary_execute_copy_func,
                                summaryview);
 
        if (summaryview->mlist) {
@@ -5023,7 +5034,7 @@ static void summary_execute_copy(SummaryView *summaryview)
                        summary_update_msg, (gpointer) summaryview);
 }
 
-static void summary_execute_copy_func(GtkCTree *ctree, GtkCTreeNode *node,
+static void summary_execute_copy_func(GtkCMCTree *ctree, GtkCMCTreeNode *node,
                                      gpointer data)
 {
        SummaryView *summaryview = data;
@@ -5042,13 +5053,14 @@ static void summary_execute_copy_func(GtkCTree *ctree, GtkCTreeNode *node,
 
 static void summary_execute_delete(SummaryView *summaryview)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
        GSList *cur;
 
        /* search deleting messages and execute */
-       gtk_ctree_pre_recursive
-               (ctree, NULL, summary_execute_delete_func, summaryview);
-
+       if (!summaryview->folder_item->folder->account || summaryview->folder_item->folder->account->imap_use_trash) {
+               gtk_cmctree_pre_recursive
+                       (ctree, NULL, summary_execute_delete_func, summaryview);
+       }
        if (!summaryview->mlist) return;
 
        hooks_unregister_hook(MSGINFO_UPDATE_HOOKLIST,
@@ -5060,14 +5072,44 @@ static void summary_execute_delete(SummaryView *summaryview)
        summaryview->msginfo_update_callback_id =
                hooks_register_hook(MSGINFO_UPDATE_HOOKLIST, 
                        summary_update_msg, (gpointer) summaryview);
-       for (cur = summaryview->mlist; cur != NULL && cur->data != NULL; cur = cur->next)
-               procmsg_msginfo_free((MsgInfo *)cur->data);
-
+       if (!summaryview->folder_item->folder->account || summaryview->folder_item->folder->account->imap_use_trash) {
+               for (cur = summaryview->mlist; cur != NULL && cur->data != NULL; cur = cur->next)
+                       procmsg_msginfo_free((MsgInfo *)cur->data);
+       }
        g_slist_free(summaryview->mlist);
        summaryview->mlist = NULL;
 }
 
-static void summary_execute_delete_func(GtkCTree *ctree, GtkCTreeNode *node,
+static void summary_execute_delete_func(GtkCMCTree *ctree, GtkCMCTreeNode *node,
+                                       gpointer data)
+{
+       SummaryView *summaryview = data;
+       MsgInfo *msginfo;
+
+       msginfo = GTKUT_CTREE_NODE_GET_ROW_DATA(node);
+
+       if (msginfo && MSG_IS_DELETED(msginfo->flags)) {
+               summaryview->mlist =
+                       g_slist_prepend(summaryview->mlist, msginfo);
+               gtk_cmctree_node_set_row_data(ctree, node, NULL);
+
+               if (msginfo->msgid && *msginfo->msgid &&
+                   node == g_hash_table_lookup(summaryview->msgid_table,
+                                               msginfo->msgid)) {
+                       g_hash_table_remove(summaryview->msgid_table,
+                                           msginfo->msgid);
+               }       
+               if (prefs_common.thread_by_subject &&
+                   msginfo->subject && *msginfo->subject && 
+                   node == subject_table_lookup(summaryview->subject_table,
+                                                msginfo->subject)) {
+                       subject_table_remove(summaryview->subject_table,
+                                            msginfo->subject);
+               }                                           
+       }
+}
+
+static void summary_execute_expunge_func(GtkCMCTree *ctree, GtkCMCTreeNode *node,
                                        gpointer data)
 {
        SummaryView *summaryview = data;
@@ -5078,7 +5120,7 @@ static void summary_execute_delete_func(GtkCTree *ctree, GtkCTreeNode *node,
        if (msginfo && MSG_IS_DELETED(msginfo->flags)) {
                summaryview->mlist =
                        g_slist_prepend(summaryview->mlist, msginfo);
-               gtk_ctree_node_set_row_data(ctree, node, NULL);
+               gtk_cmctree_node_set_row_data(ctree, node, NULL);
 
                if (msginfo->msgid && *msginfo->msgid &&
                    node == g_hash_table_lookup(summaryview->msgid_table,
@@ -5096,14 +5138,37 @@ static void summary_execute_delete_func(GtkCTree *ctree, GtkCTreeNode *node,
        }
 }
 
+static void summary_execute_expunge(SummaryView *summaryview)
+{
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
+       GSList *cur;
+
+       gtk_cmctree_pre_recursive
+               (ctree, NULL, summary_execute_expunge_func, summaryview);
+
+       hooks_unregister_hook(MSGINFO_UPDATE_HOOKLIST,
+               summaryview->msginfo_update_callback_id);
+
+       folder_item_expunge(summaryview->folder_item);
+
+       summaryview->msginfo_update_callback_id =
+               hooks_register_hook(MSGINFO_UPDATE_HOOKLIST, 
+                       summary_update_msg, (gpointer) summaryview);
+       for (cur = summaryview->mlist; cur != NULL && cur->data != NULL; cur = cur->next)
+               procmsg_msginfo_free((MsgInfo *)cur->data);
+
+       g_slist_free(summaryview->mlist);
+       summaryview->mlist = NULL;
+}
+
 /* thread functions */
 
 static void summary_thread_build(SummaryView *summaryview)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
-       GtkCTreeNode *node;
-       GtkCTreeNode *next;
-       GtkCTreeNode *parent;
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
+       GtkCMCTreeNode *node;
+       GtkCMCTreeNode *next;
+       GtkCMCTreeNode *parent;
        MsgInfo *msginfo;
         GSList *reflist;
 
@@ -5117,9 +5182,9 @@ static void summary_thread_build(SummaryView *summaryview)
                                       G_CALLBACK(summary_tree_expanded), summaryview);
        summary_freeze(summaryview);
 
-       node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
+       node = GTK_CMCTREE_NODE(GTK_CMCLIST(ctree)->row_list);
        while (node) {
-               next = GTK_CTREE_ROW(node)->sibling;
+               next = GTK_CMCTREE_ROW(node)->sibling;
 
                msginfo = GTKUT_CTREE_NODE_GET_ROW_DATA(node);
 
@@ -5139,14 +5204,14 @@ static void summary_thread_build(SummaryView *summaryview)
                        }
                }
 
-               if (prefs_common.thread_by_subject && parent == NULL) {
+               if (msginfo && prefs_common.thread_by_subject && parent == NULL) {
                        parent = subject_table_lookup
                                (summaryview->subject_table,
                                 msginfo->subject);
                }
 
-               if (parent && parent != node && parent != GTK_CTREE_ROW(node)->parent) {
-                       gtk_ctree_move(ctree, node, parent, NULL);
+               if (parent && parent != node && parent != GTK_CMCTREE_ROW(node)->parent) {
+                       gtk_cmctree_move(ctree, node, parent, NULL);
                }
 
                node = next;
@@ -5169,17 +5234,17 @@ static void summary_thread_build(SummaryView *summaryview)
 
 static void summary_thread_init(SummaryView *summaryview)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
-       GtkCTreeNode *node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
-       GtkCTreeNode *next;
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
+       GtkCMCTreeNode *node = GTK_CMCTREE_NODE(GTK_CMCLIST(ctree)->row_list);
+       GtkCMCTreeNode *next;
        START_TIMING("");
        if (!summaryview->thread_collapsed) {
                g_signal_handlers_block_by_func(G_OBJECT(ctree),
                                       G_CALLBACK(summary_tree_expanded), summaryview);
                while (node) {
-                       next = GTK_CTREE_ROW(node)->sibling;
-                       if (GTK_CTREE_ROW(node)->children)
-                               gtk_ctree_expand_recursive(ctree, node);
+                       next = GTK_CMCTREE_ROW(node)->sibling;
+                       if (GTK_CMCTREE_ROW(node)->children)
+                               gtk_cmctree_expand_recursive(ctree, node);
                        node = next;
                }
                g_signal_handlers_unblock_by_func(G_OBJECT(ctree),
@@ -5190,15 +5255,15 @@ static void summary_thread_init(SummaryView *summaryview)
 
 static void summary_unthread_for_exec(SummaryView *summaryview)
 {
-       GtkCTreeNode *node;
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCMCTreeNode *node;
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
        gboolean froze = FALSE;
 
        debug_print("Unthreading for execution...");
 
        START_LONG_OPERATION(summaryview, TRUE);
-       for (node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
-            node != NULL; node = GTK_CTREE_NODE_NEXT(node)) {
+       for (node = GTK_CMCTREE_NODE(GTK_CMCLIST(ctree)->row_list);
+            node != NULL; node = GTK_CMCTREE_NODE_NEXT(node)) {
                summary_unthread_for_exec_func(ctree, node, summaryview);
        }
 
@@ -5207,13 +5272,13 @@ static void summary_unthread_for_exec(SummaryView *summaryview)
        debug_print("done.\n");
 }
 
-static void summary_unthread_for_exec_func(GtkCTree *ctree, GtkCTreeNode *node,
+static void summary_unthread_for_exec_func(GtkCMCTree *ctree, GtkCMCTreeNode *node,
                                           gpointer data)
 {
        MsgInfo *msginfo;
-       GtkCTreeNode *top_parent;
-       GtkCTreeNode *child;
-       GtkCTreeNode *sibling;
+       GtkCMCTreeNode *top_parent;
+       GtkCMCTreeNode *child;
+       GtkCMCTreeNode *sibling;
        SummaryView * summaryview = (SummaryView *)data;
        msginfo = GTKUT_CTREE_NODE_GET_ROW_DATA(node);
 
@@ -5221,7 +5286,7 @@ static void summary_unthread_for_exec_func(GtkCTree *ctree, GtkCTreeNode *node,
            (!MSG_IS_MOVE(msginfo->flags) &&
             !MSG_IS_DELETED(msginfo->flags)))
                return;
-       child = GTK_CTREE_ROW(node)->children;
+       child = GTK_CMCTREE_ROW(node)->children;
        if (!child) return;
 
        if (node == summaryview->selected)
@@ -5230,20 +5295,20 @@ static void summary_unthread_for_exec_func(GtkCTree *ctree, GtkCTreeNode *node,
                summaryview->displayed = NULL;
 
        for (top_parent = node;
-            GTK_CTREE_ROW(top_parent)->parent != NULL;
-            top_parent = GTK_CTREE_ROW(top_parent)->parent)
+            GTK_CMCTREE_ROW(top_parent)->parent != NULL;
+            top_parent = GTK_CMCTREE_ROW(top_parent)->parent)
                ;
-       sibling = GTK_CTREE_ROW(top_parent)->sibling;
+       sibling = GTK_CMCTREE_ROW(top_parent)->sibling;
 
        GTK_SCTREE(ctree)->sorting = TRUE;
        while (child != NULL) {
-               GtkCTreeNode *next_child;
+               GtkCMCTreeNode *next_child;
                MsgInfo *cinfo = GTKUT_CTREE_NODE_GET_ROW_DATA(child);
                
-               next_child = GTK_CTREE_ROW(child)->sibling;
+               next_child = GTK_CMCTREE_ROW(child)->sibling;
                
                if (!MSG_IS_MOVE(cinfo->flags) && !MSG_IS_DELETED(cinfo->flags)) {
-                       gtk_ctree_move(ctree, child, 
+                       gtk_cmctree_move(ctree, child, 
                                NULL, 
                                sibling); 
                } else {
@@ -5263,48 +5328,75 @@ static void summary_unthread_for_exec_func(GtkCTree *ctree, GtkCTreeNode *node,
 
 void summary_expand_threads(SummaryView *summaryview)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
-       GtkCTreeNode *node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
+       GtkCMCTreeNode *node = GTK_CMCTREE_NODE(GTK_CMCLIST(ctree)->row_list);
+       GtkCMCTreeNode *focus_node = GTK_CMCTREE_NODE (g_list_nth (GTK_CMCLIST(ctree)->row_list, GTK_CMCLIST(ctree)->focus_row));
 
        g_signal_handlers_block_by_func(G_OBJECT(ctree),
                                       G_CALLBACK(summary_tree_expanded), summaryview);
        summary_freeze(summaryview);
+       GTK_SCTREE(ctree)->sorting = TRUE;
 
        while (node) {
-               if (GTK_CTREE_ROW(node)->children) {
-                       gtk_ctree_expand(ctree, node);
+               if (GTK_CMCTREE_ROW(node)->children) {
+                       gtk_cmctree_expand(ctree, node);
                        summary_set_row_marks(summaryview, node);
                }
-               node = GTK_CTREE_NODE_NEXT(node);
+               node = GTK_CMCTREE_NODE_NEXT(node);
        }
 
+       GTK_SCTREE(ctree)->sorting = FALSE;
+       if (focus_node) {
+               GTK_CMCLIST(ctree)->focus_row = g_list_position (GTK_CMCLIST(ctree)->row_list,(GList *)focus_node);
+       }
        summary_thaw(summaryview);
+
        g_signal_handlers_unblock_by_func(G_OBJECT(ctree),
                                         G_CALLBACK(summary_tree_expanded), summaryview);
 
        summaryview->thread_collapsed = FALSE;
 
-       gtk_ctree_node_moveto(ctree, summaryview->selected, 0, 0.5, 0);
+       gtk_cmctree_node_moveto(ctree, summaryview->selected, 0, 0.5, 0);
 }
 
 void summary_collapse_threads(SummaryView *summaryview)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
-       GtkCTreeNode *node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
+       GtkCMCTreeNode *node = NULL;
+       GtkCMCTreeNode *focus_node = GTK_CMCTREE_NODE (g_list_nth (GTK_CMCLIST(ctree)->row_list, GTK_CMCLIST(ctree)->focus_row));
 
+       g_signal_handlers_block_by_func(G_OBJECT(ctree),
+                                      G_CALLBACK(summary_tree_collapsed), summaryview);
        summary_freeze(summaryview);
+       GTK_SCTREE(ctree)->sorting = TRUE;
 
+       node = focus_node;
+       while (node && GTK_CMCTREE_ROW(node)->parent) {
+               focus_node = node = GTK_CMCTREE_ROW(node)->parent;
+       }
+       gtk_sctree_select(GTK_SCTREE(ctree), focus_node);
+       node = GTK_CMCTREE_NODE(GTK_CMCLIST(ctree)->row_list);
        while (node) {
-               if (GTK_CTREE_ROW(node)->children)
-                       gtk_ctree_collapse(ctree, node);
-               node = GTK_CTREE_ROW(node)->sibling;
+               if (GTK_CMCTREE_ROW(node)->children) {
+                       gtk_cmctree_collapse(ctree, node);
+                       summary_set_row_marks(summaryview, node);
+               }
+               node = GTK_CMCTREE_ROW(node)->sibling;
        }
 
+       GTK_SCTREE(ctree)->sorting = FALSE;
+       if (focus_node) {
+               GTK_CMCLIST(ctree)->focus_row = g_list_position (GTK_CMCLIST(ctree)->row_list,(GList *)focus_node);
+       }
+       GTK_SCTREE(ctree)->anchor_row =
+                       gtk_cmctree_node_nth(ctree, GTK_CMCLIST(ctree)->focus_row);
        summary_thaw(summaryview);
+       g_signal_handlers_unblock_by_func(G_OBJECT(ctree),
+                                        G_CALLBACK(summary_tree_collapsed), summaryview);
        
        summaryview->thread_collapsed = TRUE;
 
-       gtk_ctree_node_moveto(ctree, summaryview->selected, 0, 0.5, 0);
+       gtk_cmctree_node_moveto(ctree, summaryview->selected, 0, 0.5, 0);
 }
 
 static void account_rules_radio_button_toggled_cb(GtkToggleButton *btn, gpointer data)
@@ -5403,7 +5495,7 @@ void summary_filter(SummaryView *summaryview, gboolean selected_only)
        if (selected_only) {
                GList *cur;
 
-               for (cur = GTK_CLIST(summaryview->ctree)->selection;
+               for (cur = GTK_CMCLIST(summaryview->ctree)->selection;
                     cur != NULL && cur->data != NULL; cur = cur->next) {
                        mlist = g_slist_prepend(mlist, 
                                 procmsg_msginfo_new_ref(
@@ -5497,7 +5589,7 @@ void summary_filter_open(SummaryView *summaryview, PrefsFilterType type,
        
        if (!summaryview->selected) return;
 
-       msginfo = gtk_ctree_node_get_row_data(GTK_CTREE(summaryview->ctree),
+       msginfo = gtk_cmctree_node_get_row_data(GTK_CMCTREE(summaryview->ctree),
                                              summaryview->selected);
        if (!msginfo) return;
        
@@ -5516,7 +5608,7 @@ static void summary_colorlabel_menu_item_activate_cb(GtkWidget *widget,
        SummaryView *summaryview;
 
        summaryview = g_object_get_data(G_OBJECT(widget), "summaryview");
-       g_return_if_fail(summaryview != NULL);
+       cm_return_if_fail(summaryview != NULL);
 
        /* "dont_toggle" state set? */
        if (g_object_get_data(G_OBJECT(summaryview->colorlabel_menu),
@@ -5528,7 +5620,7 @@ static void summary_colorlabel_menu_item_activate_cb(GtkWidget *widget,
 
 /* summary_set_colorlabel_color() - labelcolor parameter is the color *flag*
  * for the messsage; not the color index */
-void summary_set_colorlabel_color(GtkCTree *ctree, GtkCTreeNode *node,
+void summary_set_colorlabel_color(GtkCMCTree *ctree, GtkCMCTreeNode *node,
                                  guint labelcolor)
 {
        GdkColor color;
@@ -5536,12 +5628,12 @@ void summary_set_colorlabel_color(GtkCTree *ctree, GtkCTreeNode *node,
        MsgInfo *msginfo;
        gint color_index;
 
-       msginfo = gtk_ctree_node_get_row_data(ctree, node);
-       g_return_if_fail(msginfo);
+       msginfo = gtk_cmctree_node_get_row_data(ctree, node);
+       cm_return_if_fail(msginfo);
 
        color_index = labelcolor == 0 ? -1 : (gint)labelcolor - 1;
        ctree_style = gtk_widget_get_style(GTK_WIDGET(ctree));
-       prev_style = gtk_ctree_node_get_row_style(ctree, node);
+       prev_style = gtk_cmctree_node_get_row_style(ctree, node);
 
        if (color_index < 0 || color_index >= N_COLOR_LABELS) {
                if (!prev_style) return;
@@ -5564,17 +5656,17 @@ void summary_set_colorlabel_color(GtkCTree *ctree, GtkCTreeNode *node,
                style->fg[GTK_STATE_SELECTED].blue  = (color.blue  + 3*ctree_style->fg[GTK_STATE_SELECTED].blue ) / 4;
        }
 
-       gtk_ctree_node_set_row_style(ctree, node, style);
-       gtk_style_unref(style);
+       gtk_cmctree_node_set_row_style(ctree, node, style);
+       g_object_unref(style);
 }
 
-static void summary_set_row_colorlabel(SummaryView *summaryview, GtkCTreeNode *row, guint labelcolor)
+static void summary_set_row_colorlabel(SummaryView *summaryview, GtkCMCTreeNode *row, guint labelcolor)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
        MsgInfo *msginfo;
 
-       msginfo = gtk_ctree_node_get_row_data(ctree, row);
-       g_return_if_fail(msginfo);
+       msginfo = gtk_cmctree_node_get_row_data(ctree, row);
+       cm_return_if_fail(msginfo);
 
        summary_msginfo_change_flags(msginfo, MSG_COLORLABEL_TO_FLAGS(labelcolor), 0, 
                                        MSG_CLABEL_FLAG_MASK, 0);
@@ -5584,30 +5676,30 @@ static void summary_set_row_colorlabel(SummaryView *summaryview, GtkCTreeNode *r
 void summary_set_colorlabel(SummaryView *summaryview, guint labelcolor,
                            GtkWidget *widget)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
        GList *cur;
        gboolean froze = FALSE;
 
        START_LONG_OPERATION(summaryview, FALSE);
-       for (cur = GTK_CLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next)
+       for (cur = GTK_CMCLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next)
                summary_set_row_colorlabel(summaryview,
-                                          GTK_CTREE_NODE(cur->data), labelcolor);
+                                          GTK_CMCTREE_NODE(cur->data), labelcolor);
        END_LONG_OPERATION(summaryview);
 }
 
-static gboolean summary_set_row_tag(SummaryView *summaryview, GtkCTreeNode *row, gboolean refresh, gboolean set, gint id)
+static gboolean summary_set_row_tag(SummaryView *summaryview, GtkCMCTreeNode *row, gboolean refresh, gboolean set, gint id)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
        MsgInfo *msginfo;
        gchar *tags_str = NULL;
-       msginfo = gtk_ctree_node_get_row_data(ctree, row);
-       g_return_val_if_fail(msginfo, FALSE);
+       msginfo = gtk_cmctree_node_get_row_data(ctree, row);
+       cm_return_val_if_fail(msginfo, FALSE);
 
        procmsg_msginfo_update_tags(msginfo, set, id);
        
        if (summaryview->col_state[summaryview->col_pos[S_COL_TAGS]].visible) {
                tags_str = procmsg_msginfo_get_tags_str(msginfo);
-               gtk_ctree_node_set_text(ctree, row, 
+               gtk_cmctree_node_set_text(ctree, row, 
                                summaryview->col_pos[S_COL_TAGS],
                                tags_str?tags_str:"-");
                g_free(tags_str);
@@ -5623,7 +5715,7 @@ static gboolean summary_set_row_tag(SummaryView *summaryview, GtkCTreeNode *row,
 void summary_set_tag(SummaryView *summaryview, gint tag_id,
                            GtkWidget *widget)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
        GList *cur;
        gboolean set = tag_id > 0;
        gint real_id = set? tag_id:-tag_id;
@@ -5634,9 +5726,9 @@ void summary_set_tag(SummaryView *summaryview, gint tag_id,
                return;
        START_LONG_OPERATION(summaryview, FALSE);
        folder_item_set_batch(summaryview->folder_item, TRUE);
-       for (cur = GTK_CLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next) {
+       for (cur = GTK_CMCLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next) {
                redisplay |= summary_set_row_tag(summaryview,
-                                          GTK_CTREE_NODE(cur->data), FALSE, set, real_id);
+                                          GTK_CMCTREE_NODE(cur->data), FALSE, set, real_id);
        }
        folder_item_set_batch(summaryview->folder_item, FALSE);
        END_LONG_OPERATION(summaryview);
@@ -5652,7 +5744,7 @@ static void summary_tags_menu_item_activate_cb(GtkWidget *widget,
        SummaryView *summaryview;
 
        summaryview = g_object_get_data(G_OBJECT(widget), "summaryview");
-       g_return_if_fail(summaryview != NULL);
+       cm_return_if_fail(summaryview != NULL);
 
        /* "dont_toggle" state set? */
        if (g_object_get_data(G_OBJECT(summaryview->tags_menu),
@@ -5674,14 +5766,14 @@ static void summary_colorlabel_menu_item_activate_item_cb(GtkMenuItem *menu_item
        GList *cur, *sel;
 
        summaryview = (SummaryView *)data;
-       g_return_if_fail(summaryview != NULL);
+       cm_return_if_fail(summaryview != NULL);
 
-       sel = GTK_CLIST(summaryview->ctree)->selection;
+       sel = GTK_CMCLIST(summaryview->ctree)->selection;
        if (!sel) return;
 
        menu = GTK_MENU_SHELL(summaryview->colorlabel_menu);
        
-       g_return_if_fail(menu != NULL);
+       cm_return_if_fail(menu != NULL);
 
        Xalloca(items, (N_COLOR_LABELS + 1) * sizeof(GtkWidget *), return);
 
@@ -5707,9 +5799,9 @@ static void summary_colorlabel_menu_item_activate_item_cb(GtkMenuItem *menu_item
                        MsgInfo *msginfo;
                        gint clabel;
 
-                       msginfo = gtk_ctree_node_get_row_data
-                               (GTK_CTREE(summaryview->ctree),
-                                GTK_CTREE_NODE(sel->data));
+                       msginfo = gtk_cmctree_node_get_row_data
+                               (GTK_CMCTREE(summaryview->ctree),
+                                GTK_CMCTREE_NODE(sel->data));
                        if (msginfo) {
                                clabel = MSG_GET_COLORLABEL_VALUE(msginfo->flags);
                                if (!items[clabel]->active)
@@ -5731,8 +5823,9 @@ static void summary_colorlabel_menu_create(SummaryView *summaryview, gboolean re
        GtkWidget *menu;
        GtkWidget *item;
        gint i;
+       gchar *accel_path = NULL;
 
-       label_menuitem = gtk_ui_manager_get_widget(gtkut_ui_manager(), "/Menus/SummaryViewPopup/ColorLabel");
+       label_menuitem = gtk_ui_manager_get_widget(summaryview->mainwin->ui_manager, "/Menus/SummaryViewPopup/ColorLabel");
        g_signal_connect(G_OBJECT(label_menuitem), "activate",
                         G_CALLBACK(summary_colorlabel_menu_item_activate_item_cb),
                           summaryview);
@@ -5740,6 +5833,9 @@ static void summary_colorlabel_menu_create(SummaryView *summaryview, gboolean re
 
        menu = gtk_menu_new();
 
+       gtk_menu_set_accel_group (GTK_MENU (menu), 
+               gtk_ui_manager_get_accel_group(mainwindow_get_mainwindow()->ui_manager));
+
        /* create sub items. for the menu item activation callback we pass the
         * index of label_colors[] as data parameter. for the None color we
         * pass an invalid (high) value. also we attach a data pointer so we
@@ -5753,6 +5849,11 @@ static void summary_colorlabel_menu_create(SummaryView *summaryview, gboolean re
        g_object_set_data(G_OBJECT(item), "summaryview", summaryview);
        gtk_widget_show(item);
 
+       accel_path = g_strdup_printf("<ClawsColorLabels>/None");
+       gtk_menu_item_set_accel_path(GTK_MENU_ITEM(item), accel_path);
+       g_free(accel_path);
+       gtk_accel_map_add_entry("<ClawsColorLabels>/None", GDK_0, GDK_CONTROL_MASK);
+
        item = gtk_menu_item_new();
        gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
        gtk_widget_show(item);
@@ -5768,6 +5869,13 @@ static void summary_colorlabel_menu_create(SummaryView *summaryview, gboolean re
                g_object_set_data(G_OBJECT(item), "summaryview",
                                  summaryview);
                gtk_widget_show(item);
+               accel_path = g_strdup_printf("<ClawsColorLabels>/%d", i+1);
+               gtk_menu_item_set_accel_path(GTK_MENU_ITEM(item), accel_path);
+               if (i < 9)
+                       gtk_accel_map_add_entry(accel_path, GDK_1+i, GDK_CONTROL_MASK);
+               g_free(accel_path);
+               g_signal_connect (gtk_ui_manager_get_accel_group(mainwindow_get_mainwindow()->ui_manager), 
+                       "accel-changed", G_CALLBACK (mainwin_accel_changed_cb), item);
        }
 
        gtk_widget_show(menu);
@@ -5791,13 +5899,13 @@ static void summary_tags_menu_item_activate_item_cb(GtkMenuItem *menu_item,
                                        NULL, NULL);
        gint sel_len;
        SummaryView *summaryview = (SummaryView *)data;
-       g_return_if_fail(summaryview != NULL);
+       cm_return_if_fail(summaryview != NULL);
 
-       sel = GTK_CLIST(summaryview->ctree)->selection;
+       sel = GTK_CMCLIST(summaryview->ctree)->selection;
        if (!sel) return;
 
        menu = GTK_MENU_SHELL(summaryview->tags_menu);
-       g_return_if_fail(menu != NULL);
+       cm_return_if_fail(menu != NULL);
 
        /* NOTE: don't return prematurely because we set the "dont_toggle"
         * state for check menu items */
@@ -5825,9 +5933,9 @@ static void summary_tags_menu_item_activate_item_cb(GtkMenuItem *menu_item,
                GSList *tags = NULL;
                gint id;
                GtkCheckMenuItem *item;
-               msginfo = gtk_ctree_node_get_row_data
-                       (GTK_CTREE(summaryview->ctree),
-                        GTK_CTREE_NODE(sel->data));
+               msginfo = gtk_cmctree_node_get_row_data
+                       (GTK_CMCTREE(summaryview->ctree),
+                        GTK_CMCTREE_NODE(sel->data));
                sel_len++;
                if (msginfo) {
                        tags =  msginfo->tags;
@@ -5868,11 +5976,13 @@ static void summary_tags_menu_item_activate_item_cb(GtkMenuItem *menu_item,
 
 void summaryview_destroy(SummaryView *summaryview)
 {
+#ifndef G_OS_WIN32
        if(summaryview->simplify_subject_preg) {
                regfree(summaryview->simplify_subject_preg);
                g_free(summaryview->simplify_subject_preg);
                summaryview->simplify_subject_preg = NULL;
        }
+#endif
 }
 static void summary_tags_menu_item_apply_tags_activate_cb(GtkWidget *widget,
                                                     gpointer data)
@@ -5880,7 +5990,7 @@ static void summary_tags_menu_item_apply_tags_activate_cb(GtkWidget *widget,
        SummaryView *summaryview;
 
        summaryview = g_object_get_data(G_OBJECT(widget), "summaryview");
-       g_return_if_fail(summaryview != NULL);
+       cm_return_if_fail(summaryview != NULL);
 
        /* "dont_toggle" state set? */
        if (g_object_get_data(G_OBJECT(summaryview->tags_menu),
@@ -5915,9 +6025,10 @@ static void summary_tags_menu_create(SummaryView *summaryview, gboolean refresh)
        GSList *cur = tags_get_list();
        GSList *orig = NULL;
        gboolean existing_tags = FALSE;
+       gchar *accel_path = NULL;
 
        cur = orig = g_slist_sort(cur, summary_tag_cmp_list);
-       label_menuitem = gtk_ui_manager_get_widget(gtkut_ui_manager(), "/Menus/SummaryViewPopup/Tags");
+       label_menuitem = gtk_ui_manager_get_widget(summaryview->mainwin->ui_manager, "/Menus/SummaryViewPopup/Tags");
        g_signal_connect(G_OBJECT(label_menuitem), "activate",
                         G_CALLBACK(summary_tags_menu_item_activate_item_cb),
                           summaryview);
@@ -5926,11 +6037,13 @@ static void summary_tags_menu_create(SummaryView *summaryview, gboolean refresh)
 
        menu = gtk_menu_new();
 
+       gtk_menu_set_accel_group (GTK_MENU (menu), 
+               gtk_ui_manager_get_accel_group(summaryview->mainwin->ui_manager));
+
        /* create tags menu items */
        for (; cur; cur = cur->next) {
                gint id = GPOINTER_TO_INT(cur->data);
                const gchar *tag = tags_get_tag(id);
-
                item = gtk_check_menu_item_new_with_label(tag);
                gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
                g_signal_connect(G_OBJECT(item), "activate",
@@ -5941,6 +6054,9 @@ static void summary_tags_menu_create(SummaryView *summaryview, gboolean refresh)
                g_object_set_data(G_OBJECT(item), "tag_id",
                                  GINT_TO_POINTER(id));
                gtk_widget_show(item);
+               accel_path = g_strconcat("<ClawsTags>/",tag, NULL);
+               gtk_menu_item_set_accel_path(GTK_MENU_ITEM(item), accel_path);
+               g_free(accel_path);
                existing_tags = TRUE;
        }
        if (existing_tags) {
@@ -5958,6 +6074,9 @@ static void summary_tags_menu_create(SummaryView *summaryview, gboolean refresh)
        g_object_set_data(G_OBJECT(item), "summaryview",
                          summaryview);
        gtk_widget_show(item);
+       accel_path = g_strdup_printf("<ClawsTags>/ApplyTags");
+       gtk_menu_item_set_accel_path(GTK_MENU_ITEM(item), accel_path);
+       g_free(accel_path);
 
        g_slist_free(orig);
        gtk_widget_show(menu);
@@ -6048,11 +6167,11 @@ static gboolean tooltip_cb (GtkWidget  *widget,
                             GtkTooltip *tooltip,
                             gpointer    user_data) 
 {
-       GtkCTree *ctree = GTK_CTREE(widget);
+       GtkCMCTree *ctree = GTK_CMCTREE(widget);
        SummaryView *summaryview = (SummaryView *)user_data;
        gint row = -1, column = -1;
        int offset = prefs_common.show_col_headers ? 24:0;
-       GtkCTreeNode *node = NULL;
+       GtkCMCTreeNode *node = NULL;
        gchar *text = NULL;
        gchar *formatted = NULL;
        MsgInfo *info = NULL;
@@ -6065,24 +6184,24 @@ static gboolean tooltip_cb (GtkWidget  *widget,
        if (y - offset < 0)
                return FALSE;
 
-       if (!gtk_clist_get_selection_info(GTK_CLIST(ctree), x, y - offset,
+       if (!gtk_cmclist_get_selection_info(GTK_CMCLIST(ctree), x, y - offset,
                                          &row, &column))
                return FALSE;
 
-       if ((node = gtk_ctree_node_nth(ctree, row)) == NULL)
+       if ((node = gtk_cmctree_node_nth(ctree, row)) == NULL)
                return FALSE;
 
-       if ((info = gtk_ctree_node_get_row_data(ctree, node)) == NULL)
+       if ((info = gtk_cmctree_node_get_row_data(ctree, node)) == NULL)
                return FALSE;
 
-       switch (gtk_ctree_node_get_cell_type(ctree, node, column)) {
-               case GTK_CELL_TEXT:
-                       if (gtk_ctree_node_get_text(ctree, node, column, &text) != TRUE)
+       switch (gtk_cmctree_node_get_cell_type(ctree, node, column)) {
+               case GTK_CMCELL_TEXT:
+                       if (gtk_cmctree_node_get_text(ctree, node, column, &text) != TRUE)
                                return FALSE;
                        break;
-               case GTK_CELL_PIXTEXT:
-                       if (gtk_ctree_node_get_pixtext(ctree, node, column, &text, 
-                               NULL, NULL, NULL) != TRUE)
+               case GTK_CMCELL_PIXTEXT:
+                       if (gtk_cmctree_node_get_pixtext(ctree, node, column, &text, 
+                               NULL, NULL) != TRUE)
                                return FALSE;
                        break;
                default: 
@@ -6136,79 +6255,79 @@ static GtkWidget *summary_ctree_create(SummaryView *summaryview)
                (N_SUMMARY_COLS, col_pos[S_COL_SUBJECT], titles);
 
        /* get normal row height */
-       gtk_clist_set_row_height(GTK_CLIST(ctree), 0);
-       normal_row_height = GTK_CLIST(ctree)->row_height;
+       gtk_cmclist_set_row_height(GTK_CMCLIST(ctree), 0);
+       normal_row_height = GTK_CMCLIST(ctree)->row_height;
 
        if (prefs_common.show_col_headers == FALSE)
-               gtk_clist_column_titles_hide(GTK_CLIST(ctree));
+               gtk_cmclist_column_titles_hide(GTK_CMCLIST(ctree));
 
-       gtk_clist_set_selection_mode(GTK_CLIST(ctree), GTK_SELECTION_EXTENDED);
-       gtk_clist_set_column_justification(GTK_CLIST(ctree), col_pos[S_COL_MARK],
+       gtk_cmclist_set_selection_mode(GTK_CMCLIST(ctree), GTK_SELECTION_EXTENDED);
+       gtk_cmclist_set_column_justification(GTK_CMCLIST(ctree), col_pos[S_COL_MARK],
                                           GTK_JUSTIFY_CENTER);
-       gtk_clist_set_column_justification(GTK_CLIST(ctree), col_pos[S_COL_STATUS],
+       gtk_cmclist_set_column_justification(GTK_CMCLIST(ctree), col_pos[S_COL_STATUS],
                                           GTK_JUSTIFY_CENTER);
-       gtk_clist_set_column_justification(GTK_CLIST(ctree), col_pos[S_COL_LOCKED],
+       gtk_cmclist_set_column_justification(GTK_CMCLIST(ctree), col_pos[S_COL_LOCKED],
                                           GTK_JUSTIFY_CENTER);
-       gtk_clist_set_column_justification(GTK_CLIST(ctree), col_pos[S_COL_MIME],
+       gtk_cmclist_set_column_justification(GTK_CMCLIST(ctree), col_pos[S_COL_MIME],
                                           GTK_JUSTIFY_CENTER);
-       gtk_clist_set_column_justification(GTK_CLIST(ctree), col_pos[S_COL_SIZE],
+       gtk_cmclist_set_column_justification(GTK_CMCLIST(ctree), col_pos[S_COL_SIZE],
                                           GTK_JUSTIFY_RIGHT);
-       gtk_clist_set_column_justification(GTK_CLIST(ctree), col_pos[S_COL_NUMBER],
+       gtk_cmclist_set_column_justification(GTK_CMCLIST(ctree), col_pos[S_COL_NUMBER],
                                           GTK_JUSTIFY_RIGHT);
-       gtk_clist_set_column_justification(GTK_CLIST(ctree), col_pos[S_COL_SCORE],
+       gtk_cmclist_set_column_justification(GTK_CMCLIST(ctree), col_pos[S_COL_SCORE],
                                           GTK_JUSTIFY_RIGHT);
-       gtk_clist_set_column_width(GTK_CLIST(ctree), col_pos[S_COL_MARK],
+       gtk_cmclist_set_column_width(GTK_CMCLIST(ctree), col_pos[S_COL_MARK],
                                   prefs_common.summary_col_size[S_COL_MARK]);
-       gtk_clist_set_column_width(GTK_CLIST(ctree), col_pos[S_COL_STATUS],
+       gtk_cmclist_set_column_width(GTK_CMCLIST(ctree), col_pos[S_COL_STATUS],
                                   prefs_common.summary_col_size[S_COL_STATUS]);
-       gtk_clist_set_column_width(GTK_CLIST(ctree), col_pos[S_COL_LOCKED],
+       gtk_cmclist_set_column_width(GTK_CMCLIST(ctree), col_pos[S_COL_LOCKED],
                                   prefs_common.summary_col_size[S_COL_LOCKED]);
-       gtk_clist_set_column_width(GTK_CLIST(ctree), col_pos[S_COL_MIME],
+       gtk_cmclist_set_column_width(GTK_CMCLIST(ctree), col_pos[S_COL_MIME],
                                   prefs_common.summary_col_size[S_COL_MIME]);
-       gtk_clist_set_column_width(GTK_CLIST(ctree), col_pos[S_COL_SUBJECT],
+       gtk_cmclist_set_column_width(GTK_CMCLIST(ctree), col_pos[S_COL_SUBJECT],
                                   prefs_common.summary_col_size[S_COL_SUBJECT]);
-       gtk_clist_set_column_width(GTK_CLIST(ctree), col_pos[S_COL_FROM],
+       gtk_cmclist_set_column_width(GTK_CMCLIST(ctree), col_pos[S_COL_FROM],
                                   prefs_common.summary_col_size[S_COL_FROM]);
-       gtk_clist_set_column_width(GTK_CLIST(ctree), col_pos[S_COL_TO],
+       gtk_cmclist_set_column_width(GTK_CMCLIST(ctree), col_pos[S_COL_TO],
                                   prefs_common.summary_col_size[S_COL_TO]);
-       gtk_clist_set_column_width(GTK_CLIST(ctree), col_pos[S_COL_DATE],
+       gtk_cmclist_set_column_width(GTK_CMCLIST(ctree), col_pos[S_COL_DATE],
                                   prefs_common.summary_col_size[S_COL_DATE]);
-       gtk_clist_set_column_width(GTK_CLIST(ctree), col_pos[S_COL_SIZE],
+       gtk_cmclist_set_column_width(GTK_CMCLIST(ctree), col_pos[S_COL_SIZE],
                                   prefs_common.summary_col_size[S_COL_SIZE]);
-       gtk_clist_set_column_width(GTK_CLIST(ctree), col_pos[S_COL_NUMBER],
+       gtk_cmclist_set_column_width(GTK_CMCLIST(ctree), col_pos[S_COL_NUMBER],
                                   prefs_common.summary_col_size[S_COL_NUMBER]);
-       gtk_clist_set_column_width(GTK_CLIST(ctree), col_pos[S_COL_SCORE],
+       gtk_cmclist_set_column_width(GTK_CMCLIST(ctree), col_pos[S_COL_SCORE],
                                   prefs_common.summary_col_size[S_COL_SCORE]);
-       gtk_clist_set_column_width(GTK_CLIST(ctree), col_pos[S_COL_TAGS],
+       gtk_cmclist_set_column_width(GTK_CMCLIST(ctree), col_pos[S_COL_TAGS],
                                   prefs_common.summary_col_size[S_COL_TAGS]);
 
        if (prefs_common.enable_dotted_lines) {
-               gtk_ctree_set_line_style(GTK_CTREE(ctree), GTK_CTREE_LINES_DOTTED);
-               gtk_ctree_set_expander_style(GTK_CTREE(ctree),
-                                    GTK_CTREE_EXPANDER_SQUARE);
+               gtk_cmctree_set_line_style(GTK_CMCTREE(ctree), GTK_CMCTREE_LINES_DOTTED);
+               gtk_cmctree_set_expander_style(GTK_CMCTREE(ctree),
+                                    GTK_CMCTREE_EXPANDER_SQUARE);
        } else {
-               gtk_ctree_set_line_style(GTK_CTREE(ctree), GTK_CTREE_LINES_NONE);
-               gtk_ctree_set_expander_style(GTK_CTREE(ctree),
-                                    GTK_CTREE_EXPANDER_TRIANGLE);
+               gtk_cmctree_set_line_style(GTK_CMCTREE(ctree), GTK_CMCTREE_LINES_NONE);
+               gtk_cmctree_set_expander_style(GTK_CMCTREE(ctree),
+                                    GTK_CMCTREE_EXPANDER_TRIANGLE);
        }
 
        gtk_sctree_set_stripes(GTK_SCTREE(ctree), prefs_common.use_stripes_in_summaries);
 
-       gtk_ctree_set_indent(GTK_CTREE(ctree), 12);
+       gtk_cmctree_set_indent(GTK_CMCTREE(ctree), 12);
        g_object_set_data(G_OBJECT(ctree), "summaryview", (gpointer)summaryview); 
 
        for (pos = 0; pos < N_SUMMARY_COLS; pos++) {
-               GTK_WIDGET_UNSET_FLAGS(GTK_CLIST(ctree)->column[pos].button,
-                                      GTK_CAN_FOCUS);
+               gtkut_widget_set_can_focus(GTK_CMCLIST(ctree)->column[pos].button,
+                                      FALSE);
                if (((pos == summaryview->col_pos[S_COL_FROM] && !FOLDER_SHOWS_TO_HDR(summaryview->folder_item)) ||
                     (pos == summaryview->col_pos[S_COL_TO] && FOLDER_SHOWS_TO_HDR(summaryview->folder_item)) ||
                     pos == summaryview->col_pos[S_COL_DATE]) && vert &&
                            prefs_common.two_line_vert)
-                       gtk_clist_set_column_visibility
-                               (GTK_CLIST(ctree), pos, FALSE);
+                       gtk_cmclist_set_column_visibility
+                               (GTK_CMCLIST(ctree), pos, FALSE);
                else
-                       gtk_clist_set_column_visibility
-                               (GTK_CLIST(ctree), pos, col_state[pos].visible);
+                       gtk_cmclist_set_column_visibility
+                               (GTK_CMCLIST(ctree), pos, col_state[pos].visible);
        }
        if (prefs_common.two_line_vert)
                gtk_sctree_set_use_markup(GTK_SCTREE(ctree), summaryview->col_pos[S_COL_SUBJECT], vert);
@@ -6216,7 +6335,7 @@ static GtkWidget *summary_ctree_create(SummaryView *summaryview)
        /* connect signal to the buttons for sorting */
 #define CLIST_BUTTON_SIGNAL_CONNECT(col, func) \
        g_signal_connect \
-               (G_OBJECT(GTK_CLIST(ctree)->column[col_pos[col]].button), \
+               (G_OBJECT(GTK_CMCLIST(ctree)->column[col_pos[col]].button), \
                 "clicked", \
                 G_CALLBACK(func), \
                 summaryview)
@@ -6280,7 +6399,7 @@ static GtkWidget *summary_ctree_create(SummaryView *summaryview)
                         summaryview);
 
        gtk_drag_dest_set(ctree, GTK_DEST_DEFAULT_ALL & ~GTK_DEST_DEFAULT_HIGHLIGHT,
-                         summary_drag_types, 2,
+                         summary_drag_types, 3,
                          GDK_ACTION_MOVE | GDK_ACTION_COPY | GDK_ACTION_DEFAULT);
 
        g_signal_connect(G_OBJECT(ctree), "drag_data_received",
@@ -6317,9 +6436,9 @@ void summary_set_column_order(SummaryView *summaryview)
        summary_set_fonts(summaryview);
        summary_set_column_titles(summaryview);
        gtk_scrolled_window_set_hadjustment(GTK_SCROLLED_WINDOW(scrolledwin),
-                                           GTK_CLIST(ctree)->hadjustment);
+                                           GTK_CMCLIST(ctree)->hadjustment);
        gtk_scrolled_window_set_vadjustment(GTK_SCROLLED_WINDOW(scrolledwin),
-                                           GTK_CLIST(ctree)->vadjustment);
+                                           GTK_CMCLIST(ctree)->vadjustment);
        gtk_container_add(GTK_CONTAINER(scrolledwin), ctree);
        gtk_widget_show(ctree);
 
@@ -6337,9 +6456,9 @@ void summary_set_column_order(SummaryView *summaryview)
 
        if (prefs_common.layout_mode == VERTICAL_LAYOUT &&
            prefs_common.two_line_vert) {
-               gtk_clist_set_row_height(GTK_CLIST(summaryview->ctree), 2*normal_row_height + 2);               
+               gtk_cmclist_set_row_height(GTK_CMCLIST(summaryview->ctree), 2*normal_row_height + 2);           
        } else {
-               gtk_clist_set_row_height(GTK_CLIST(summaryview->ctree), 0);             
+               gtk_cmclist_set_row_height(GTK_CMCLIST(summaryview->ctree), 0);         
        }
 }
 
@@ -6377,8 +6496,8 @@ static gboolean summary_button_pressed(GtkWidget *ctree, GdkEventButton *event,
        if (!event) return FALSE;
 
        if (event->button == 3) {
-               summaryview->display_msg = messageview_is_visible(summaryview->messageview);
                /* right clicked */
+               summary_set_menu_sensitive(summaryview);
                gtk_menu_popup(GTK_MENU(summaryview->popupmenu), NULL, NULL,
                               NULL, NULL, event->button, event->time);
        } else if (event->button == 2) {
@@ -6400,6 +6519,8 @@ static gboolean summary_button_released(GtkWidget *ctree, GdkEventButton *event,
 
 gboolean summary_pass_key_press_event(SummaryView *summaryview, GdkEventKey *event)
 {
+       if (!summaryview)
+               return FALSE;
        if (summary_is_list(summaryview))
                return summary_key_pressed(summaryview->ctree, event, summaryview);
        else
@@ -6412,8 +6533,8 @@ gboolean summary_pass_key_press_event(SummaryView *summaryview, GdkEventKey *eve
 static gboolean summary_key_pressed(GtkWidget *widget, GdkEventKey *event,
                                    SummaryView *summaryview)
 {
-       GtkCTree *ctree = GTK_CTREE(widget);
-       GtkCTreeNode *node;
+       GtkCMCTree *ctree = GTK_CMCTREE(widget);
+       GtkCMCTreeNode *node;
        MessageView *messageview;
        TextView *textview;
        GtkAdjustment *adj;
@@ -6436,8 +6557,10 @@ static gboolean summary_key_pressed(GtkWidget *widget, GdkEventKey *event,
                switch (event->keyval) {
                case GDK_space:         /* Page down or go to the next */
                        handled = TRUE;
-                       if (event->state & GDK_CONTROL_MASK) 
-                               event->state &= ~GDK_CONTROL_MASK;
+                       if (event->state & GDK_CONTROL_MASK) {
+                               handled = FALSE;
+                               break;
+                       }
                        if (event->state & GDK_SHIFT_MASK) 
                                mimeview_scroll_page(messageview->mimeview, TRUE);
                        else {
@@ -6495,18 +6618,18 @@ static gboolean summary_key_pressed(GtkWidget *widget, GdkEventKey *event,
        case GDK_Home:
        case GDK_End:
                if ((node = summaryview->selected) != NULL) {
-                       GtkCTreeNode *next = NULL;
+                       GtkCMCTreeNode *next = NULL;
                        next = (event->keyval == GDK_Home)
-                                       ? gtk_ctree_node_nth(ctree, 0)
-                                       : gtk_ctree_node_nth(ctree, 
-                                               g_list_length(GTK_CLIST(ctree)->row_list)-1);
+                                       ? gtk_cmctree_node_nth(ctree, 0)
+                                       : gtk_cmctree_node_nth(ctree, 
+                                               g_list_length(GTK_CMCLIST(ctree)->row_list)-1);
                        if (next) {
                                gtk_sctree_select_with_state
                                        (GTK_SCTREE(ctree), next, (event->state & ~GDK_CONTROL_MASK) );
 
                                /* Deprecated - what are the non-deprecated equivalents? */
-                               if (gtk_ctree_node_is_visible(GTK_CTREE(ctree), next) != GTK_VISIBILITY_FULL)
-                                       gtk_ctree_node_moveto(GTK_CTREE(ctree), next, 0, 0, 0);
+                               if (gtk_cmctree_node_is_visible(GTK_CMCTREE(ctree), next) != GTK_VISIBILITY_FULL)
+                                       gtk_cmctree_node_moveto(GTK_CMCTREE(ctree), next, 0, 0, 0);
                                summaryview->selected = next;
                        }
                }
@@ -6516,7 +6639,7 @@ static gboolean summary_key_pressed(GtkWidget *widget, GdkEventKey *event,
        }
 
        if (!summaryview->selected) {
-               node = gtk_ctree_node_nth(ctree, 0);
+               node = gtk_cmctree_node_nth(ctree, 0);
                if (node)
                        gtk_sctree_select(GTK_SCTREE(ctree), node);
                else
@@ -6591,27 +6714,28 @@ void summary_open_row(GtkSCTree *sctree, SummaryView *summaryview)
        summaryview->display_msg = FALSE;
 }
 
-static void summary_tree_expanded(GtkCTree *ctree, GtkCTreeNode *node,
+static void summary_tree_expanded(GtkCMCTree *ctree, GtkCMCTreeNode *node,
                                  SummaryView *summaryview)
 {
        summary_set_row_marks(summaryview, node);
        if (prefs_common.bold_unread) {
                while (node) {
-                       GtkCTreeNode *next = GTK_CTREE_NODE_NEXT(node);
-                       if (GTK_CTREE_ROW(node)->children)
+                       GtkCMCTreeNode *next = GTK_CMCTREE_NODE_NEXT(node);
+                       if (GTK_CMCTREE_ROW(node)->children)
                                summary_set_row_marks(summaryview, node);
                        node = next;
                }
        }
 }
 
-static void summary_tree_collapsed(GtkCTree *ctree, GtkCTreeNode *node,
+static void summary_tree_collapsed(GtkCMCTree *ctree, GtkCMCTreeNode *node,
                                   SummaryView *summaryview)
 {
+       gtk_sctree_select(GTK_SCTREE(ctree), node);
        summary_set_row_marks(summaryview, node);
 }
 
-static void summary_unselected(GtkCTree *ctree, GtkCTreeNode *row,
+static void summary_unselected(GtkCMCTree *ctree, GtkCMCTreeNode *row,
                               gint column, SummaryView *summaryview)
 {
        if (summary_is_locked(summaryview)
@@ -6622,7 +6746,7 @@ static void summary_unselected(GtkCTree *ctree, GtkCTreeNode *row,
        summary_status_show(summaryview);
 }
 
-static void summary_selected(GtkCTree *ctree, GtkCTreeNode *row,
+static void summary_selected(GtkCMCTree *ctree, GtkCMCTreeNode *row,
                             gint column, SummaryView *summaryview)
 {
        MsgInfo *msginfo;
@@ -6653,8 +6777,8 @@ static void summary_selected(GtkCTree *ctree, GtkCTreeNode *row,
 
        summary_status_show(summaryview);
 
-       if (GTK_CLIST(ctree)->selection &&
-           GTK_CLIST(ctree)->selection->next) {
+       if (GTK_CMCLIST(ctree)->selection &&
+           GTK_CMCLIST(ctree)->selection->next) {
                summaryview->display_msg = FALSE;
                summary_set_menu_sensitive(summaryview);
                toolbar_main_set_sensitive(summaryview->mainwin);
@@ -6663,8 +6787,8 @@ static void summary_selected(GtkCTree *ctree, GtkCTreeNode *row,
 
        summaryview->selected = row;
 
-       msginfo = gtk_ctree_node_get_row_data(ctree, row);
-       g_return_if_fail(msginfo != NULL);
+       msginfo = gtk_cmctree_node_get_row_data(ctree, row);
+       cm_return_if_fail(msginfo != NULL);
 
        main_create_mailing_list_menu (summaryview->mainwin, msginfo);
        toolbar_set_learn_button
@@ -6739,7 +6863,7 @@ static void summary_selected(GtkCTree *ctree, GtkCTreeNode *row,
        toolbar_main_set_sensitive(summaryview->mainwin);
 }
 
-static void summary_col_resized(GtkCList *clist, gint column, gint width,
+static void summary_col_resized(GtkCMCList *clist, gint column, gint width,
                                SummaryView *summaryview)
 {
        SummaryColumnType type = summaryview->col_state[column].type;
@@ -6760,68 +6884,24 @@ GSList *summary_get_selection(SummaryView *summaryview)
        GList *sel = NULL;
        GSList *msginfo_list = NULL;
        
-       g_return_val_if_fail(summaryview != NULL, NULL);
+       cm_return_val_if_fail(summaryview != NULL, NULL);
 
-       sel = GTK_CLIST(summaryview->ctree)->selection;
+       sel = GTK_CMCLIST(summaryview->ctree)->selection;
 
-       g_return_val_if_fail(sel != NULL, NULL);
+       cm_return_val_if_fail(sel != NULL, NULL);
 
        for ( ; sel != NULL; sel = sel->next)
                msginfo_list = 
                        g_slist_prepend(msginfo_list, 
-                                      gtk_ctree_node_get_row_data(GTK_CTREE(summaryview->ctree),
-                                                                  GTK_CTREE_NODE(sel->data)));
+                                      gtk_cmctree_node_get_row_data(GTK_CMCTREE(summaryview->ctree),
+                                                                  GTK_CMCTREE_NODE(sel->data)));
        return g_slist_reverse(msginfo_list);
 }
 
-static void summary_reply_cb(SummaryView *summaryview, guint action,
-                            GtkWidget *widget)
-{
-       MessageView *msgview = (MessageView*)summaryview->messageview;
-       GSList *msginfo_list;
-
-       g_return_if_fail(msgview != NULL);
-
-       msginfo_list = summary_get_selection(summaryview);
-       g_return_if_fail(msginfo_list != NULL);
-       compose_reply_from_messageview(msgview, msginfo_list, action);
-       g_slist_free(msginfo_list);
-}
-#ifndef GENERIC_UMPC
-static void summary_show_all_header_cb(SummaryView *summaryview,
-                                      guint action, GtkWidget *widget)
-{
-       GtkWidget *menuitem = gtk_ui_manager_get_widget(gtkut_ui_manager(), "/Menus/SummaryViewPopup/View/AllHeaders");
-       if (!menuitem)
-               return;
-       summaryview->messageview->all_headers =
-                       GTK_CHECK_MENU_ITEM(menuitem)->active;
-       summary_display_msg_selected(summaryview,
-                                    GTK_CHECK_MENU_ITEM(menuitem)->active);
-}
-
-static void summary_add_address_cb(SummaryView *summaryview,
-                                  guint action, GtkWidget *widget)
-{
-       summary_add_address(summaryview);
-}
-#endif
-static void summary_create_filter_cb(SummaryView *summaryview,
-                                    guint action, GtkWidget *widget)
-{
-       summary_filter_open(summaryview, (PrefsFilterType)action, 0);
-}
-#ifndef GENERIC_UMPC
-static void summary_create_processing_cb(SummaryView *summaryview,
-                                        guint action, GtkWidget *widget)
-{
-       summary_filter_open(summaryview, (PrefsFilterType)action, 1);
-}
-#endif
 static void summary_sort_by_column_click(SummaryView *summaryview,
                                         FolderSortKey sort_key)
 {
-       GtkCTreeNode *node = NULL;
+       GtkCMCTreeNode *node = NULL;
        START_TIMING("");
        if (summaryview->sort_key == sort_key)
                summary_sort(summaryview, sort_key,
@@ -6830,13 +6910,13 @@ static void summary_sort_by_column_click(SummaryView *summaryview,
        else
                summary_sort(summaryview, sort_key, SORT_ASCENDING);
 
-       node = GTK_CTREE_NODE(GTK_CLIST(summaryview->ctree)->row_list);
+       node = GTK_CMCTREE_NODE(GTK_CMCLIST(summaryview->ctree)->row_list);
 
        summary_freeze(summaryview);
        if (prefs_common.bold_unread) {
                while (node) {
-                       GtkCTreeNode *next = GTK_CTREE_NODE_NEXT(node);
-                       if (GTK_CTREE_ROW(node)->children)
+                       GtkCMCTreeNode *next = GTK_CMCTREE_NODE_NEXT(node);
+                       if (GTK_CMCTREE_ROW(node)->children)
                                summary_set_row_marks(summaryview, node);
                        node = next;
                }
@@ -6920,9 +7000,9 @@ static void summary_start_drag(GtkWidget *widget, gint button, GdkEvent *event,
 {
        GdkDragContext *context;
 
-       g_return_if_fail(summaryview != NULL);
-       g_return_if_fail(summaryview->folder_item != NULL);
-       g_return_if_fail(summaryview->folder_item->folder != NULL);
+       cm_return_if_fail(summaryview != NULL);
+       cm_return_if_fail(summaryview->folder_item != NULL);
+       cm_return_if_fail(summaryview->folder_item->folder != NULL);
 
        if (summaryview->selected == NULL) return;
 
@@ -6961,15 +7041,15 @@ static void summary_drag_data_get(GtkWidget        *widget,
                                  SummaryView      *summaryview)
 {
        if (info == TARGET_MAIL_URI_LIST) {
-               GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+               GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
                GList *cur;
                MsgInfo *msginfo;
                gchar *mail_list = NULL, *tmp1, *tmp2;
 
-               for (cur = GTK_CLIST(ctree)->selection;
+               for (cur = GTK_CMCLIST(ctree)->selection;
                     cur != NULL && cur->data != NULL; cur = cur->next) {
-                       msginfo = gtk_ctree_node_get_row_data
-                               (ctree, GTK_CTREE_NODE(cur->data));
+                       msginfo = gtk_cmctree_node_get_row_data
+                               (ctree, GTK_CMCTREE_NODE(cur->data));
                        tmp2 = procmsg_get_message_file(msginfo);
                        if (!tmp2) continue;
                        if (msginfo->subject) {
@@ -7012,12 +7092,45 @@ static void summary_drag_data_get(GtkWidget        *widget,
                        g_free(mail_list);
                } 
        } else if (info == TARGET_DUMMY) {
-               if (GTK_CLIST(summaryview->ctree)->selection)
+               if (GTK_CMCLIST(summaryview->ctree)->selection)
                        gtk_selection_data_set(selection_data,
                                               selection_data->target, 8,
                                               "Dummy-Summaryview", 
                                               strlen("Dummy-Summaryview")+1);
-       }
+       } else if (info == TARGET_MAIL_CM_PATH_LIST) {
+               /* content: folder_item_identifier\nmsgid1\nmsgid2\nmsgid3 */
+
+               GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
+               GList *cur;
+               MsgInfo *msginfo;
+               gchar *path_list = NULL;
+
+               /* identifier */
+               if(GTK_CMCLIST(ctree)->selection != NULL) {
+                       msginfo = gtk_cmctree_node_get_row_data(ctree, GTK_CMCTREE_NODE(GTK_CMCLIST(ctree)->selection->data));
+            if(msginfo && msginfo->folder)
+              path_list = folder_item_get_identifier(msginfo->folder);
+               }
+
+               for (cur = GTK_CMCLIST(ctree)->selection;
+                    cur != NULL && cur->data != NULL; cur = cur->next) {
+                       gchar *tmp;
+
+                       msginfo = gtk_cmctree_node_get_row_data(ctree, GTK_CMCTREE_NODE(cur->data));
+            if(!msginfo)
+              continue;
+                       tmp = path_list;
+                       path_list = g_strconcat(path_list, "\n", (msginfo->msgid ? msginfo->msgid : "unknown"), NULL);
+                       g_free(tmp);
+               }
+
+               if (path_list != NULL) {
+                       gtk_selection_data_set(selection_data,
+                                              selection_data->target, 8,
+                                              path_list, strlen(path_list));
+                       g_free(path_list);
+               }
+    }
 }
 
 static gboolean summary_drag_motion_cb(GtkWidget      *widget,
@@ -7071,16 +7184,33 @@ static void summary_drag_data_received(GtkWidget        *widget,
 
 /* custom compare functions for sorting */
 
+static gint summary_cmp_by_date(GtkCMCList *clist,
+                     gconstpointer ptr1, gconstpointer ptr2)
+{
+       MsgInfo *msginfo1 = ((GtkCMCListRow *)ptr1)->data;
+       MsgInfo *msginfo2 = ((GtkCMCListRow *)ptr2)->data;
+       gint res;
+       if (!msginfo1 || !msginfo2)
+               return -1;
+
+       res = (msginfo1->date_t - msginfo2->date_t);
+       if (res == 0)
+               res = msginfo1->msgnum - msginfo2->msgnum;
+       return res;
+}
+
 #define CMP_FUNC_DEF(func_name, val)                                    \
-static gint func_name(GtkCList *clist,                                  \
+static gint func_name(GtkCMCList *clist,                                \
                      gconstpointer ptr1, gconstpointer ptr2)            \
 {                                                                       \
-       MsgInfo *msginfo1 = ((GtkCListRow *)ptr1)->data;                 \
-       MsgInfo *msginfo2 = ((GtkCListRow *)ptr2)->data;                 \
+       MsgInfo *msginfo1 = ((GtkCMCListRow *)ptr1)->data;               \
+       MsgInfo *msginfo2 = ((GtkCMCListRow *)ptr2)->data;               \
+       gint res;                                                        \
        if (!msginfo1 || !msginfo2)                                      \
                return -1;                                               \
                                                                         \
-       return (val);                                                    \
+       res = (val);                                                     \
+       return (res != 0) ? res:summary_cmp_by_date(clist, ptr1, ptr2);  \
 }
 
 CMP_FUNC_DEF(summary_cmp_by_mark,
@@ -7098,16 +7228,15 @@ CMP_FUNC_DEF(summary_cmp_by_locked,
 
 CMP_FUNC_DEF(summary_cmp_by_num, msginfo1->msgnum - msginfo2->msgnum)
 CMP_FUNC_DEF(summary_cmp_by_size, msginfo1->size - msginfo2->size)
-CMP_FUNC_DEF(summary_cmp_by_date, msginfo1->date_t - msginfo2->date_t)
 
 #undef CMP_FUNC_DEF
 
-static gint summary_cmp_by_subject(GtkCList *clist,
+static gint summary_cmp_by_subject(GtkCMCList *clist,
                                   gconstpointer ptr1,
                                   gconstpointer ptr2)
 {
-       MsgInfo *msginfo1 = ((GtkCListRow *)ptr1)->data;
-       MsgInfo *msginfo2 = ((GtkCListRow *)ptr2)->data;
+       MsgInfo *msginfo1 = ((GtkCMCListRow *)ptr1)->data;
+       MsgInfo *msginfo2 = ((GtkCMCListRow *)ptr2)->data;
        gint res;
 
        if (!msginfo1->subject)
@@ -7120,12 +7249,12 @@ static gint summary_cmp_by_subject(GtkCList *clist,
        return (res != 0)? res: summary_cmp_by_date(clist, ptr1, ptr2);
 }
 
-static gint summary_cmp_by_thread_date(GtkCList *clist,
+static gint summary_cmp_by_thread_date(GtkCMCList *clist,
                                   gconstpointer ptr1,
                                   gconstpointer ptr2)
 {
-       MsgInfo *msginfo1 = ((GtkCListRow *)ptr1)->data;
-       MsgInfo *msginfo2 = ((GtkCListRow *)ptr2)->data;
+       MsgInfo *msginfo1 = ((GtkCMCListRow *)ptr1)->data;
+       MsgInfo *msginfo2 = ((GtkCMCListRow *)ptr2)->data;
        gint thread_diff = msginfo1->thread_date - msginfo2->thread_date;
        
        if (msginfo1->thread_date > 0 && msginfo2->thread_date > 0)
@@ -7134,19 +7263,25 @@ static gint summary_cmp_by_thread_date(GtkCList *clist,
                return msginfo1->date_t - msginfo2->date_t;
 }
 
-static gint summary_cmp_by_from(GtkCList *clist, gconstpointer ptr1,
+static gint summary_cmp_by_from(GtkCMCList *clist, gconstpointer ptr1,
                                gconstpointer ptr2)
 {
        const gchar *str1, *str2;
-       const GtkCListRow *r1 = (const GtkCListRow *) ptr1;
-       const GtkCListRow *r2 = (const GtkCListRow *) ptr2;
+       const GtkCMCListRow *r1 = (const GtkCMCListRow *) ptr1;
+       const GtkCMCListRow *r2 = (const GtkCMCListRow *) ptr2;
+       MsgInfo *msginfo1 = ((GtkCMCListRow *)ptr1)->data;
+       MsgInfo *msginfo2 = ((GtkCMCListRow *)ptr2)->data;
        const SummaryView *sv = g_object_get_data(G_OBJECT(clist), "summaryview");
        gint res;
 
-       g_return_val_if_fail(sv, -1);
-       
-       str1 = GTK_CELL_TEXT(r1->cell[sv->col_pos[S_COL_FROM]])->text;
-       str2 = GTK_CELL_TEXT(r2->cell[sv->col_pos[S_COL_FROM]])->text;
+       cm_return_val_if_fail(sv, -1);
+       if (sv->col_state[sv->col_pos[S_COL_FROM]].visible) {
+               str1 = GTK_CMCELL_TEXT(r1->cell[sv->col_pos[S_COL_FROM]])->text;
+               str2 = GTK_CMCELL_TEXT(r2->cell[sv->col_pos[S_COL_FROM]])->text;
+       } else {
+               str1 = msginfo1->from;
+               str2 = msginfo2->from;
+       }
 
        if (!str1)
                return str2 != NULL;
@@ -7158,18 +7293,25 @@ static gint summary_cmp_by_from(GtkCList *clist, gconstpointer ptr1,
        return (res != 0)? res: summary_cmp_by_date(clist, ptr1, ptr2);
 }
  
-static gint summary_cmp_by_to(GtkCList *clist, gconstpointer ptr1,
+static gint summary_cmp_by_to(GtkCMCList *clist, gconstpointer ptr1,
                                gconstpointer ptr2)
 {
        const gchar *str1, *str2;
-       const GtkCListRow *r1 = (const GtkCListRow *) ptr1;
-       const GtkCListRow *r2 = (const GtkCListRow *) ptr2;
+       const GtkCMCListRow *r1 = (const GtkCMCListRow *) ptr1;
+       const GtkCMCListRow *r2 = (const GtkCMCListRow *) ptr2;
+       MsgInfo *msginfo1 = ((GtkCMCListRow *)ptr1)->data;
+       MsgInfo *msginfo2 = ((GtkCMCListRow *)ptr2)->data;
        const SummaryView *sv = g_object_get_data(G_OBJECT(clist), "summaryview");
        gint res;
-       g_return_val_if_fail(sv, -1);
+       cm_return_val_if_fail(sv, -1);
        
-       str1 = GTK_CELL_TEXT(r1->cell[sv->col_pos[S_COL_TO]])->text;
-       str2 = GTK_CELL_TEXT(r2->cell[sv->col_pos[S_COL_TO]])->text;
+       if (sv->col_state[sv->col_pos[S_COL_TO]].visible) {
+               str1 = GTK_CMCELL_TEXT(r1->cell[sv->col_pos[S_COL_TO]])->text;
+               str2 = GTK_CMCELL_TEXT(r2->cell[sv->col_pos[S_COL_TO]])->text;
+       } else {
+               str1 = msginfo1->to;
+               str2 = msginfo2->to;
+       }
 
        if (!str1)
                return str2 != NULL;
@@ -7181,46 +7323,64 @@ static gint summary_cmp_by_to(GtkCList *clist, gconstpointer ptr1,
        return (res != 0)? res: summary_cmp_by_date(clist, ptr1, ptr2);
 }
  
-static gint summary_cmp_by_tags(GtkCList *clist, gconstpointer ptr1,
+static gint summary_cmp_by_tags(GtkCMCList *clist, gconstpointer ptr1,
                                gconstpointer ptr2)
 {
-       const gchar *str1, *str2;
-       const GtkCListRow *r1 = (const GtkCListRow *) ptr1;
-       const GtkCListRow *r2 = (const GtkCListRow *) ptr2;
+       gchar *str1, *str2;
+       const GtkCMCListRow *r1 = (const GtkCMCListRow *) ptr1;
+       const GtkCMCListRow *r2 = (const GtkCMCListRow *) ptr2;
        const SummaryView *sv = g_object_get_data(G_OBJECT(clist), "summaryview");
+       MsgInfo *msginfo1 = ((GtkCMCListRow *)ptr1)->data;
+       MsgInfo *msginfo2 = ((GtkCMCListRow *)ptr2)->data;
        gint res;
-       g_return_val_if_fail(sv, -1);
+       cm_return_val_if_fail(sv, -1);
        
-       str1 = GTK_CELL_TEXT(r1->cell[sv->col_pos[S_COL_TAGS]])->text;
-       str2 = GTK_CELL_TEXT(r2->cell[sv->col_pos[S_COL_TAGS]])->text;
+       if (sv->col_state[sv->col_pos[S_COL_TAGS]].visible) {
+               str1 = g_strdup(GTK_CMCELL_TEXT(r1->cell[sv->col_pos[S_COL_TAGS]])->text);
+               str2 = g_strdup(GTK_CMCELL_TEXT(r2->cell[sv->col_pos[S_COL_TAGS]])->text);
+       } else {
+               str1 = procmsg_msginfo_get_tags_str(msginfo1);
+               str2 = procmsg_msginfo_get_tags_str(msginfo2);
+       }
 
-       if (!str1)
-               return str2 != NULL;
-       if (!str2)
+       if (!str1) {
+               res = (str2 != NULL);
+               g_free(str2);
+               return res;
+       }
+       if (!str2) {
+               g_free(str1);
                return -1;
+       }
  
        res = g_utf8_collate(str1, str2);
+       g_free(str1);
+       g_free(str2);
        return (res != 0)? res: summary_cmp_by_date(clist, ptr1, ptr2);
 }
  
 static gint summary_cmp_by_simplified_subject
-       (GtkCList *clist, gconstpointer ptr1, gconstpointer ptr2)
+       (GtkCMCList *clist, gconstpointer ptr1, gconstpointer ptr2)
 {
        const FolderItemPrefs *prefs;
        const gchar *str1, *str2;
-       const GtkCListRow *r1 = (const GtkCListRow *) ptr1;
-       const GtkCListRow *r2 = (const GtkCListRow *) ptr2;
+       const GtkCMCListRow *r1 = (const GtkCMCListRow *) ptr1;
+       const GtkCMCListRow *r2 = (const GtkCMCListRow *) ptr2;
        const MsgInfo *msginfo1 = r1->data;
        const MsgInfo *msginfo2 = r2->data;
        const SummaryView *sv = g_object_get_data(G_OBJECT(clist), "summaryview");
        gint res;
 
-       g_return_val_if_fail(sv, -1);
-       g_return_val_if_fail(msginfo1 != NULL && msginfo2 != NULL, -1);
+       cm_return_val_if_fail(sv, -1);
+       cm_return_val_if_fail(msginfo1 != NULL && msginfo2 != NULL, -1);
        
-       str1 = GTK_CELL_TEXT(r1->cell[sv->col_pos[S_COL_SUBJECT]])->text;
-       str2 = GTK_CELL_TEXT(r2->cell[sv->col_pos[S_COL_SUBJECT]])->text;
+       if (sv->col_state[sv->col_pos[S_COL_SUBJECT]].visible) {
+               str1 = GTK_CMCELL_TEXT(r1->cell[sv->col_pos[S_COL_SUBJECT]])->text;
+               str2 = GTK_CMCELL_TEXT(r2->cell[sv->col_pos[S_COL_SUBJECT]])->text;
+       } else {
+               str1 = msginfo1->subject;
+               str2 = msginfo2->subject;
+       }
 
        if (!str1)
                return str2 != NULL;
@@ -7238,11 +7398,11 @@ static gint summary_cmp_by_simplified_subject
        return (res != 0)? res: summary_cmp_by_date(clist, ptr1, ptr2);
 }
 
-static gint summary_cmp_by_score(GtkCList *clist,
+static gint summary_cmp_by_score(GtkCMCList *clist,
                                 gconstpointer ptr1, gconstpointer ptr2)
 {
-       MsgInfo *msginfo1 = ((GtkCListRow *)ptr1)->data;
-       MsgInfo *msginfo2 = ((GtkCListRow *)ptr2)->data;
+       MsgInfo *msginfo1 = ((GtkCMCListRow *)ptr1)->data;
+       MsgInfo *msginfo2 = ((GtkCMCListRow *)ptr2)->data;
        int diff;
 
        /* if score are equal, sort by date */
@@ -7254,13 +7414,13 @@ static gint summary_cmp_by_score(GtkCList *clist,
                return summary_cmp_by_date(clist, ptr1, ptr2);
 }
 
-static void summary_ignore_thread_func(GtkCTree *ctree, GtkCTreeNode *row, gpointer data)
+static void summary_ignore_thread_func(GtkCMCTree *ctree, GtkCMCTreeNode *row, gpointer data)
 {
        SummaryView *summaryview = (SummaryView *) data;
        MsgInfo *msginfo;
 
-       msginfo = gtk_ctree_node_get_row_data(ctree, row);
-       g_return_if_fail(msginfo);
+       msginfo = gtk_cmctree_node_get_row_data(ctree, row);
+       cm_return_if_fail(msginfo);
 
        summary_msginfo_unset_flags(msginfo, MSG_WATCH_THREAD, 0);
        summary_msginfo_change_flags(msginfo, MSG_IGNORE_THREAD, 0, MSG_NEW | MSG_UNREAD, 0);
@@ -7272,14 +7432,14 @@ static void summary_ignore_thread_func(GtkCTree *ctree, GtkCTreeNode *row, gpoin
 
 void summary_ignore_thread(SummaryView *summaryview)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
        GList *cur;
        gboolean froze = FALSE;
 
        START_LONG_OPERATION(summaryview, FALSE);
-       for (cur = GTK_CLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next)
-               gtk_ctree_pre_recursive(ctree, GTK_CTREE_NODE(cur->data), 
-                                       GTK_CTREE_FUNC(summary_ignore_thread_func), 
+       for (cur = GTK_CMCLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next)
+               gtk_cmctree_pre_recursive(ctree, GTK_CMCTREE_NODE(cur->data), 
+                                       GTK_CMCTREE_FUNC(summary_ignore_thread_func), 
                                        summaryview);
 
        END_LONG_OPERATION(summaryview);
@@ -7287,13 +7447,13 @@ void summary_ignore_thread(SummaryView *summaryview)
        summary_status_show(summaryview);
 }
 
-static void summary_unignore_thread_func(GtkCTree *ctree, GtkCTreeNode *row, gpointer data)
+static void summary_unignore_thread_func(GtkCMCTree *ctree, GtkCMCTreeNode *row, gpointer data)
 {
        SummaryView *summaryview = (SummaryView *) data;
        MsgInfo *msginfo;
 
-       msginfo = gtk_ctree_node_get_row_data(ctree, row);
-       g_return_if_fail(msginfo);
+       msginfo = gtk_cmctree_node_get_row_data(ctree, row);
+       cm_return_if_fail(msginfo);
 
        summary_msginfo_unset_flags(msginfo, MSG_IGNORE_THREAD, 0);
 
@@ -7304,14 +7464,14 @@ static void summary_unignore_thread_func(GtkCTree *ctree, GtkCTreeNode *row, gpo
 
 void summary_unignore_thread(SummaryView *summaryview)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
        GList *cur;
        gboolean froze = FALSE;
 
        START_LONG_OPERATION(summaryview, FALSE);
-       for (cur = GTK_CLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next)
-               gtk_ctree_pre_recursive(ctree, GTK_CTREE_NODE(cur->data), 
-                                       GTK_CTREE_FUNC(summary_unignore_thread_func), 
+       for (cur = GTK_CMCLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next)
+               gtk_cmctree_pre_recursive(ctree, GTK_CMCTREE_NODE(cur->data), 
+                                       GTK_CMCTREE_FUNC(summary_unignore_thread_func), 
                                        summaryview);
 
        END_LONG_OPERATION(summaryview);
@@ -7320,27 +7480,27 @@ void summary_unignore_thread(SummaryView *summaryview)
 }
 
 static void summary_check_ignore_thread_func
-               (GtkCTree *ctree, GtkCTreeNode *row, gpointer data)
+               (GtkCMCTree *ctree, GtkCMCTreeNode *row, gpointer data)
 {
        MsgInfo *msginfo;
        gint *found_ignore = (gint *) data;
 
        if (*found_ignore) return;
        else {
-               msginfo = gtk_ctree_node_get_row_data(ctree, row);
+               msginfo = gtk_cmctree_node_get_row_data(ctree, row);
                *found_ignore = msginfo && MSG_IS_IGNORE_THREAD(msginfo->flags);
        }               
 }
 
 void summary_toggle_ignore_thread(SummaryView *summaryview)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
        GList *cur;
        gint found_ignore = 0;
 
-       for (cur = GTK_CLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next)
-               gtk_ctree_pre_recursive(ctree, GTK_CTREE_NODE(cur->data),
-                                       GTK_CTREE_FUNC(summary_check_ignore_thread_func),
+       for (cur = GTK_CMCLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next)
+               gtk_cmctree_pre_recursive(ctree, GTK_CMCTREE_NODE(cur->data),
+                                       GTK_CMCTREE_FUNC(summary_check_ignore_thread_func),
                                        &found_ignore);
 
        if (found_ignore) 
@@ -7349,13 +7509,13 @@ void summary_toggle_ignore_thread(SummaryView *summaryview)
                summary_ignore_thread(summaryview);
 }
 
-static void summary_watch_thread_func(GtkCTree *ctree, GtkCTreeNode *row, gpointer data)
+static void summary_watch_thread_func(GtkCMCTree *ctree, GtkCMCTreeNode *row, gpointer data)
 {
        SummaryView *summaryview = (SummaryView *) data;
        MsgInfo *msginfo;
 
-       msginfo = gtk_ctree_node_get_row_data(ctree, row);
-       g_return_if_fail(msginfo);
+       msginfo = gtk_cmctree_node_get_row_data(ctree, row);
+       cm_return_if_fail(msginfo);
 
        summary_msginfo_change_flags(msginfo, MSG_WATCH_THREAD, 0, MSG_IGNORE_THREAD, 0);
 
@@ -7366,14 +7526,14 @@ static void summary_watch_thread_func(GtkCTree *ctree, GtkCTreeNode *row, gpoint
 
 void summary_watch_thread(SummaryView *summaryview)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
        GList *cur;
        gboolean froze = FALSE;
 
        START_LONG_OPERATION(summaryview, FALSE);
-       for (cur = GTK_CLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next)
-               gtk_ctree_pre_recursive(ctree, GTK_CTREE_NODE(cur->data), 
-                                       GTK_CTREE_FUNC(summary_watch_thread_func), 
+       for (cur = GTK_CMCLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next)
+               gtk_cmctree_pre_recursive(ctree, GTK_CMCTREE_NODE(cur->data), 
+                                       GTK_CMCTREE_FUNC(summary_watch_thread_func), 
                                        summaryview);
 
        END_LONG_OPERATION(summaryview);
@@ -7381,13 +7541,13 @@ void summary_watch_thread(SummaryView *summaryview)
        summary_status_show(summaryview);
 }
 
-static void summary_unwatch_thread_func(GtkCTree *ctree, GtkCTreeNode *row, gpointer data)
+static void summary_unwatch_thread_func(GtkCMCTree *ctree, GtkCMCTreeNode *row, gpointer data)
 {
        SummaryView *summaryview = (SummaryView *) data;
        MsgInfo *msginfo;
 
-       msginfo = gtk_ctree_node_get_row_data(ctree, row);
-       g_return_if_fail(msginfo);
+       msginfo = gtk_cmctree_node_get_row_data(ctree, row);
+       cm_return_if_fail(msginfo);
 
        summary_msginfo_unset_flags(msginfo, MSG_WATCH_THREAD, 0);
 
@@ -7398,14 +7558,14 @@ static void summary_unwatch_thread_func(GtkCTree *ctree, GtkCTreeNode *row, gpoi
 
 void summary_unwatch_thread(SummaryView *summaryview)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
        GList *cur;
        gboolean froze = FALSE;
 
        START_LONG_OPERATION(summaryview, FALSE);
-       for (cur = GTK_CLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next)
-               gtk_ctree_pre_recursive(ctree, GTK_CTREE_NODE(cur->data), 
-                                       GTK_CTREE_FUNC(summary_unwatch_thread_func), 
+       for (cur = GTK_CMCLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next)
+               gtk_cmctree_pre_recursive(ctree, GTK_CMCTREE_NODE(cur->data), 
+                                       GTK_CMCTREE_FUNC(summary_unwatch_thread_func), 
                                        summaryview);
 
        END_LONG_OPERATION(summaryview);
@@ -7414,27 +7574,27 @@ void summary_unwatch_thread(SummaryView *summaryview)
 }
 
 static void summary_check_watch_thread_func
-               (GtkCTree *ctree, GtkCTreeNode *row, gpointer data)
+               (GtkCMCTree *ctree, GtkCMCTreeNode *row, gpointer data)
 {
        MsgInfo *msginfo;
        gint *found_watch = (gint *) data;
 
        if (*found_watch) return;
        else {
-               msginfo = gtk_ctree_node_get_row_data(ctree, row);
+               msginfo = gtk_cmctree_node_get_row_data(ctree, row);
                *found_watch = msginfo && MSG_IS_WATCH_THREAD(msginfo->flags);
        }               
 }
 
 void summary_toggle_watch_thread(SummaryView *summaryview)
 {
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
        GList *cur;
        gint found_watch = 0;
 
-       for (cur = GTK_CLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next)
-               gtk_ctree_pre_recursive(ctree, GTK_CTREE_NODE(cur->data),
-                                       GTK_CTREE_FUNC(summary_check_watch_thread_func),
+       for (cur = GTK_CMCLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next)
+               gtk_cmctree_pre_recursive(ctree, GTK_CMCTREE_NODE(cur->data),
+                                       GTK_CMCTREE_FUNC(summary_check_watch_thread_func),
                                        &found_watch);
 
        if (found_watch) 
@@ -7458,13 +7618,40 @@ void summary_toggle_show_read_messages(SummaryView *summaryview)
        summary_show(summaryview, summaryview->folder_item);
 }
  
+void summary_toggle_show_del_messages(SummaryView *summaryview)
+{
+       FolderItemUpdateData source;
+       if (summaryview->folder_item->hide_del_msgs)
+               summaryview->folder_item->hide_del_msgs = 0;
+       else
+               summaryview->folder_item->hide_del_msgs = 1;
+
+       source.item = summaryview->folder_item;
+       source.update_flags = F_ITEM_UPDATE_NAME;
+       source.msg = NULL;
+       hooks_invoke(FOLDER_ITEM_UPDATE_HOOKLIST, &source);
+       summary_show(summaryview, summaryview->folder_item);
+}
 static void summary_set_hide_read_msgs_menu (SummaryView *summaryview,
                                             guint action)
 {
        GtkWidget *widget;
-       widget = gtk_item_factory_get_item(gtk_item_factory_from_widget(summaryview->mainwin->menubar),
-                                          "/View/Hide read messages");
+
+       widget = gtk_ui_manager_get_widget(summaryview->mainwin->ui_manager, "/Menu/View/HideReadMessages");
+       g_object_set_data(G_OBJECT(widget), "dont_toggle",
+                         GINT_TO_POINTER(1));
+       gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(widget), action);
+       g_object_set_data(G_OBJECT(widget), "dont_toggle",
+                         GINT_TO_POINTER(0));
+}
+
+static void summary_set_hide_del_msgs_menu (SummaryView *summaryview,
+                                            guint action)
+{
+       GtkWidget *widget;
+
+       widget = gtk_ui_manager_get_widget(summaryview->mainwin->ui_manager, "/Menu/View/HideDelMessages");
        g_object_set_data(G_OBJECT(widget), "dont_toggle",
                          GINT_TO_POINTER(1));
        gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(widget), action);
@@ -7477,23 +7664,24 @@ void summary_reflect_prefs_pixmap_theme(SummaryView *summaryview)
        GtkWidget *ctree = summaryview->ctree;
        GtkWidget *pixmap; 
 
-       stock_pixmap_gdk(ctree, STOCK_PIXMAP_MARK, &markxpm, &markxpmmask);
-       stock_pixmap_gdk(ctree, STOCK_PIXMAP_DELETED, &deletedxpm, &deletedxpmmask);
-       stock_pixmap_gdk(ctree, STOCK_PIXMAP_NEW, &newxpm, &newxpmmask);
-       stock_pixmap_gdk(ctree, STOCK_PIXMAP_UNREAD, &unreadxpm, &unreadxpmmask);
-       stock_pixmap_gdk(ctree, STOCK_PIXMAP_REPLIED, &repliedxpm, &repliedxpmmask);
-       stock_pixmap_gdk(ctree, STOCK_PIXMAP_FORWARDED, &forwardedxpm, &forwardedxpmmask);
-       stock_pixmap_gdk(ctree, STOCK_PIXMAP_CLIP, &clipxpm, &clipxpmmask);
-       stock_pixmap_gdk(ctree, STOCK_PIXMAP_LOCKED, &lockedxpm, &lockedxpmmask);
-       stock_pixmap_gdk(ctree, STOCK_PIXMAP_IGNORETHREAD, &ignorethreadxpm, &ignorethreadxpmmask);
-       stock_pixmap_gdk(ctree, STOCK_PIXMAP_WATCHTHREAD, &watchthreadxpm, &watchthreadxpmmask);
-       stock_pixmap_gdk(ctree, STOCK_PIXMAP_CLIP_KEY, &clipkeyxpm, &clipkeyxpmmask);
-       stock_pixmap_gdk(ctree, STOCK_PIXMAP_KEY, &keyxpm, &keyxpmmask);
-       stock_pixmap_gdk(ctree, STOCK_PIXMAP_GPG_SIGNED, &gpgsignedxpm, &gpgsignedxpmmask);
-       stock_pixmap_gdk(ctree, STOCK_PIXMAP_CLIP_GPG_SIGNED, &clipgpgsignedxpm, &clipgpgsignedxpmmask);
-       stock_pixmap_gdk(ctree, STOCK_PIXMAP_SPAM, &spamxpm, &spamxpmmask);
-       stock_pixmap_gdk(ctree, STOCK_PIXMAP_MOVED, &movedxpm, &movedxpmmask);
-       stock_pixmap_gdk(ctree, STOCK_PIXMAP_COPIED, &copiedxpm, &copiedxpmmask);
+       stock_pixbuf_gdk(ctree, STOCK_PIXMAP_MARK, &markxpm);
+       stock_pixbuf_gdk(ctree, STOCK_PIXMAP_DELETED, &deletedxpm);
+       stock_pixbuf_gdk(ctree, STOCK_PIXMAP_NEW, &newxpm);
+       stock_pixbuf_gdk(ctree, STOCK_PIXMAP_UNREAD, &unreadxpm);
+       stock_pixbuf_gdk(ctree, STOCK_PIXMAP_REPLIED, &repliedxpm);
+       stock_pixbuf_gdk(ctree, STOCK_PIXMAP_FORWARDED, &forwardedxpm);
+       stock_pixbuf_gdk(ctree, STOCK_PIXMAP_CLIP, &clipxpm);
+       stock_pixbuf_gdk(ctree, STOCK_PIXMAP_LOCKED, &lockedxpm);
+       stock_pixbuf_gdk(ctree, STOCK_PIXMAP_IGNORETHREAD, &ignorethreadxpm);
+       stock_pixbuf_gdk(ctree, STOCK_PIXMAP_WATCHTHREAD, &watchthreadxpm);
+       stock_pixbuf_gdk(ctree, STOCK_PIXMAP_CLIP_KEY, &clipkeyxpm);
+       stock_pixbuf_gdk(ctree, STOCK_PIXMAP_KEY, &keyxpm);
+       stock_pixbuf_gdk(ctree, STOCK_PIXMAP_KEY_SIGN, &keysignxpm);
+       stock_pixbuf_gdk(ctree, STOCK_PIXMAP_GPG_SIGNED, &gpgsignedxpm);
+       stock_pixbuf_gdk(ctree, STOCK_PIXMAP_CLIP_GPG_SIGNED, &clipgpgsignedxpm);
+       stock_pixbuf_gdk(ctree, STOCK_PIXMAP_SPAM, &spamxpm);
+       stock_pixbuf_gdk(ctree, STOCK_PIXMAP_MOVED, &movedxpm);
+       stock_pixbuf_gdk(ctree, STOCK_PIXMAP_COPIED, &copiedxpm);
 
        summary_set_folder_pixmap(summaryview, STOCK_PIXMAP_DIR_OPEN);
 
@@ -7525,11 +7713,15 @@ void summary_reflect_prefs_custom_colors(SummaryView *summaryview)
 
        /* re-create colorlabel submenu */
        menu = GTK_MENU_SHELL(summaryview->colorlabel_menu);
-       g_return_if_fail(menu != NULL);
+       cm_return_if_fail(menu != NULL);
 
        /* clear items. get item pointers. */
        for (cur = menu->children; cur != NULL && cur->data != NULL; cur = cur->next) {
-               gtk_menu_item_remove_submenu(GTK_MENU_ITEM(cur->data));
+               g_signal_handlers_disconnect_matched
+                        (gtk_ui_manager_get_accel_group(summaryview->mainwin->ui_manager), 
+                        G_SIGNAL_MATCH_DATA|G_SIGNAL_MATCH_FUNC,
+                        0, 0, NULL, mainwin_accel_changed_cb, cur->data);
+               gtk_menu_item_set_submenu(GTK_MENU_ITEM(cur->data), NULL);
        }
        summary_colorlabel_menu_create(summaryview, TRUE);
 }
@@ -7539,14 +7731,14 @@ void summary_reflect_prefs_custom_colors(SummaryView *summaryview)
  */
 void summary_harvest_address(SummaryView *summaryview)
 {
-       GtkCTree *ctree = GTK_CTREE( summaryview->ctree );
+       GtkCMCTree *ctree = GTK_CMCTREE( summaryview->ctree );
        GList *cur;
        GList *msgList;
        MsgInfo *msginfo;
 
        msgList = NULL;
-       for( cur = GTK_CLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next ) {
-               msginfo = gtk_ctree_node_get_row_data( ctree, GTK_CTREE_NODE(cur->data) );
+       for( cur = GTK_CMCLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next ) {
+               msginfo = gtk_cmctree_node_get_row_data( ctree, GTK_CMCTREE_NODE(cur->data) );
                if (!msginfo)
                        continue;
                msgList = g_list_append( msgList, GUINT_TO_POINTER( msginfo->msgnum ) );
@@ -7555,6 +7747,7 @@ void summary_harvest_address(SummaryView *summaryview)
        g_list_free( msgList );
 }
 
+#ifndef G_OS_WIN32
 static regex_t *summary_compile_simplify_regexp(gchar *simplify_subject_regexp)
 {
        int err;
@@ -7574,15 +7767,16 @@ static regex_t *summary_compile_simplify_regexp(gchar *simplify_subject_regexp)
        
        return preg;
 }
-
+#endif
 void summary_set_prefs_from_folderitem(SummaryView *summaryview, FolderItem *item)
 {
        FolderSortKey sort_key;
        FolderSortType sort_type;
-       g_return_if_fail(summaryview != NULL);
-       g_return_if_fail(item != NULL);
+       cm_return_if_fail(summaryview != NULL);
+       cm_return_if_fail(item != NULL);
 
        /* Subject simplification */
+#ifndef G_OS_WIN32
        if(summaryview->simplify_subject_preg) {
                regfree(summaryview->simplify_subject_preg);
                g_free(summaryview->simplify_subject_preg);
@@ -7591,7 +7785,7 @@ void summary_set_prefs_from_folderitem(SummaryView *summaryview, FolderItem *ite
        if(item->prefs && item->prefs->simplify_subject_regexp && 
           item->prefs->simplify_subject_regexp[0] && item->prefs->enable_simplify_subject)
                summaryview->simplify_subject_preg = summary_compile_simplify_regexp(item->prefs->simplify_subject_regexp);
-
+#endif
        /* Sorting */
        sort_key = item->sort_key;
        sort_type = item->sort_type;
@@ -7623,17 +7817,17 @@ static gboolean summary_update_msg(gpointer source, gpointer data)
 {
        MsgInfoUpdate *msginfo_update = (MsgInfoUpdate *) source;
        SummaryView *summaryview = (SummaryView *)data;
-       GtkCTreeNode *node;
+       GtkCMCTreeNode *node;
 
-       g_return_val_if_fail(msginfo_update != NULL, TRUE);
-       g_return_val_if_fail(summaryview != NULL, FALSE);
+       cm_return_val_if_fail(msginfo_update != NULL, TRUE);
+       cm_return_val_if_fail(summaryview != NULL, FALSE);
 
        if (msginfo_update->msginfo->folder != summaryview->folder_item)
                return FALSE;
 
        if (msginfo_update->flags & MSGINFO_UPDATE_FLAGS) {
-               node = gtk_ctree_find_by_row_data(
-                               GTK_CTREE(summaryview->ctree), NULL, 
+               node = gtk_cmctree_find_by_row_data(
+                               GTK_CMCTREE(summaryview->ctree), NULL, 
                                msginfo_update->msginfo);
 
                if (node) 
@@ -7649,7 +7843,7 @@ void summary_update_unread(SummaryView *summaryview, FolderItem *removed_item)
        guint replied, forwarded, locked, ignored, watched;
        static gboolean tips_initialized = FALSE;
 #if !(GTK_CHECK_VERSION(2,12,0))
-       GtkTooltips *tips = summaryview->tips;
+       GtkTooltips *tips = summaryview->tooltips;
 #endif
 
        if (prefs_common.layout_mode != SMALL_LAYOUT) {
@@ -7688,9 +7882,9 @@ static gboolean summary_update_folder_item_hook(gpointer source, gpointer data)
        FolderItemUpdateData *hookdata = (FolderItemUpdateData *)source;
        SummaryView *summaryview = (SummaryView *)data;
 
-       g_return_val_if_fail(hookdata != NULL, FALSE);
-       g_return_val_if_fail(hookdata->item != NULL, FALSE);
-       g_return_val_if_fail(summaryview != NULL, FALSE);
+       cm_return_val_if_fail(hookdata != NULL, FALSE);
+       cm_return_val_if_fail(hookdata->item != NULL, FALSE);
+       cm_return_val_if_fail(summaryview != NULL, FALSE);
 
        if (hookdata->update_flags & F_ITEM_UPDATE_NAME) {
                gchar *name = folder_item_get_name(hookdata->item);
@@ -7726,7 +7920,7 @@ static void summary_find_answers (SummaryView *summaryview, MsgInfo *msg)
 {
        FolderItem *sent_folder = NULL;
        PrefsAccount *account = NULL;
-       GtkCTreeNode *node = NULL;
+       GtkCMCTreeNode *node = NULL;
        char *buf = NULL;
        if (msg == NULL || msg->msgid == NULL)
                return;
@@ -7748,7 +7942,7 @@ static void summary_find_answers (SummaryView *summaryview, MsgInfo *msg)
        quicksearch_set(summaryview->quicksearch, QUICK_SEARCH_EXTENDED, buf);
        g_free(buf);
 
-       node = gtk_ctree_node_nth(GTK_CTREE(summaryview->ctree), 0);
+       node = gtk_cmctree_node_nth(GTK_CMCTREE(summaryview->ctree), 0);
        if (node)
                summary_select_node(summaryview, node, TRUE, TRUE);
 }