Fix Reply from mainwindow menu and toolbar when mainwindow's
[claws.git] / src / mainwindow.c
index 919626a74987ef174e7f307f4b5f0e2541914021..30376f0b6c17d2819f0b153bfd230fe9878c1671 100644 (file)
@@ -1,6 +1,6 @@
 /*
    Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
-   Copyright (C) 1999-2013 Hiroyuki Yamamoto and the Claws Mail team
+   Copyright (C) 1999-2018 the Claws Mail team and Hiroyuki Yamamoto
 
    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
@@ -30,6 +30,7 @@
 #include "folderview.h"
 #include "folder_item_prefs.h"
 #include "foldersel.h"
+#include "quicksearch.h"
 #include "summaryview.h"
 #include "summary_search.h"
 #include "messageview.h"
@@ -46,6 +47,7 @@
 #include "import.h"
 #include "export.h"
 #include "edittags.h"
+#include "password.h"
 #include "prefs_common.h"
 #include "prefs_actions.h"
 #include "prefs_filtering.h"
@@ -55,7 +57,7 @@
 #include "prefs_template.h"
 #include "action.h"
 #include "account.h"
-#ifndef USE_NEW_ADDRBOOK
+#ifndef USE_ALT_ADDRBOOK
        #include "addressbook.h"
 #else
        #include "addressbook-dbus.h"
@@ -201,6 +203,8 @@ static void show_all_header_cb              (GtkAction      *action,
                                  gpointer       data);
 static void toggle_fullscreen_cb       (GtkAction      *action,
                                  gpointer       data);
+static void toggle_menubar_cb  (GtkAction      *action,
+                                 gpointer       data);
 
 static void hide_quotes_cb(GtkAction   *action,
                                  gpointer       data);
@@ -228,6 +232,8 @@ static void mark_as_read_cb         (GtkAction      *action,
                                  gpointer       data);
 static void mark_all_read_cb           (GtkAction      *action,
                                  gpointer       data);
+static void mark_all_unread_cb         (GtkAction      *action,
+                                 gpointer       data);
 static void mark_as_spam_cb            (GtkAction      *action,
                                  gpointer       data);
 static void mark_as_ham_cb             (GtkAction      *action,
@@ -344,6 +350,8 @@ static void allsel_cb                (GtkAction     *action,
                                  gpointer       data);
 static void select_thread_cb    (GtkAction     *action,
                                  gpointer       data);
+static void trash_thread_cb     (GtkAction     *action,
+                                 gpointer       data);
 static void delete_thread_cb    (GtkAction     *action,
                                  gpointer       data);
 
@@ -424,7 +432,10 @@ static void sync_cb                 ( GtkAction    *action,
 
 static void forget_session_passwords_cb        (GtkAction      *action,
                                         gpointer        data );
-
+#ifndef PASSWORD_CRYPTO_OLD
+static void forget_master_passphrase_cb        (GtkAction      *action,
+                                        gpointer        data );
+#endif
 static gboolean mainwindow_focus_in_event      (GtkWidget      *widget, 
                                                 GdkEventFocus  *focus,
                                                 gpointer        data);
@@ -498,366 +509,369 @@ static void     mw_compose_news_cb                      (GtkAction *gaction, gpointer data)
 
 static GtkActionEntry mainwin_entries[] =
 {
-       {"Menu",                                NULL, "Menu" },
+       {"Menu",                        NULL, "Menu", NULL, NULL, NULL },
 /* menus */
-       {"File",                                NULL, N_("_File") },
-       {"Edit",                                NULL, N_("_Edit") },
-       {"View",                                NULL, N_("_View") },
-       {"Message",                             NULL, N_("_Message") },
-       {"Tools",                               NULL, N_("_Tools") },
-       {"Configuration",                       NULL, N_("_Configuration") },
-       {"Help",                                NULL, N_("_Help") },
+       {"File",                        NULL, N_("_File"), NULL, NULL, NULL },
+       {"Edit",                        NULL, N_("_Edit"), NULL, NULL, NULL },
+       {"View",                        NULL, N_("_View"), NULL, NULL, NULL },
+       {"Message",                     NULL, N_("_Message"), NULL, NULL, NULL },
+       {"Tools",                       NULL, N_("_Tools"), NULL, NULL, NULL },
+       {"Configuration",               NULL, N_("_Configuration"), NULL, NULL, NULL },
+       {"Help",                        NULL, N_("_Help"), NULL, NULL, NULL },
 
 /* File menu */
-       {"File/AddMailbox",                     NULL, N_("_Add mailbox") },
-       {"File/AddMailbox/MH",                  NULL, N_("MH..."), NULL, NULL, G_CALLBACK(add_mailbox_cb) },
-       {"File/---",                            NULL, "---" },
-
-       {"File/SortMailboxes",                  NULL, N_("Change mailbox order..."), NULL, NULL, G_CALLBACK(foldersort_cb) },
-
-       /* {"File/---",                         NULL, "---" }, */
-       {"File/ImportMbox",                     NULL, N_("_Import mbox file..."), NULL, NULL, G_CALLBACK(import_mbox_cb) },
-       {"File/ExportMbox",                     NULL, N_("_Export to mbox file..."), NULL, NULL, G_CALLBACK(export_mbox_cb) },
-       {"File/ExportSelMbox",                  NULL, N_("_Export selected to mbox file..."), NULL, NULL, G_CALLBACK(export_list_mbox_cb) },
-       /* {"File/---",                         NULL, "---" }, */
-       {"File/EmptyTrashes",                   NULL, N_("Empty all _Trash folders"), "<shift>D", NULL, G_CALLBACK(empty_trash_cb) },
-       /* {"File/---",                         NULL, "---" }, */
-
-       {"File/SaveAs",                         NULL, N_("_Save email as..."), "<control>S", NULL, G_CALLBACK(save_as_cb) },
-       {"File/SavePartAs",                     NULL, N_("_Save part as..."), "Y", NULL, G_CALLBACK(save_part_as_cb) },
-       /* {"File/---",                         NULL, "---" }, */
-
-       {"File/PageSetup",                      NULL, N_("Page setup..."), NULL, NULL, G_CALLBACK(page_setup_cb) },
-       {"File/Print",                          NULL, N_("_Print..."), "<control>P", NULL, G_CALLBACK(print_cb) },
-       /* {"File/---",                         NULL, "---" }, */
-       {"File/SynchroniseFolders",             NULL, N_("Synchronise folders"), "<control><shift>S", NULL, G_CALLBACK(sync_cb) }, 
-       /* {"File/---",                         NULL, "---" }, */
-       {"File/Exit",                           NULL, N_("E_xit"), "<control>Q", NULL, G_CALLBACK(app_exit_cb) }, 
+       {"File/AddMailbox",             NULL, N_("_Add mailbox"), NULL, NULL, NULL },
+       {"File/AddMailbox/MH",          NULL, N_("MH..."), NULL, NULL, G_CALLBACK(add_mailbox_cb) },
+       {"File/---",                    NULL, "---", NULL, NULL, NULL },
+
+       {"File/SortMailboxes",          NULL, N_("Change mailbox order..."), NULL, NULL, G_CALLBACK(foldersort_cb) },
+
+       /* {"File/---",                 NULL, "---", NULL, NULL, NULL }, */
+       {"File/ImportMbox",             NULL, N_("_Import mbox file..."), NULL, NULL, G_CALLBACK(import_mbox_cb) },
+       {"File/ExportMbox",             NULL, N_("_Export to mbox file..."), NULL, NULL, G_CALLBACK(export_mbox_cb) },
+       {"File/ExportSelMbox",          NULL, N_("_Export selected to mbox file..."), NULL, NULL, G_CALLBACK(export_list_mbox_cb) },
+       /* {"File/---",                 NULL, "---", NULL, NULL, NULL }, */
+       {"File/EmptyTrashes",           NULL, N_("Empty all _Trash folders"), "<shift>D", NULL, G_CALLBACK(empty_trash_cb) },
+       /* {"File/---",                 NULL, "---", NULL, NULL, NULL }, */
+
+       {"File/SaveAs",                 NULL, N_("_Save email as..."), "<control>S", NULL, G_CALLBACK(save_as_cb) },
+       {"File/SavePartAs",             NULL, N_("_Save part as..."), "Y", NULL, G_CALLBACK(save_part_as_cb) },
+       /* {"File/---",                 NULL, "---", NULL, NULL, NULL }, */
+
+       {"File/PageSetup",              NULL, N_("Page setup..."), NULL, NULL, G_CALLBACK(page_setup_cb) },
+       {"File/Print",                  NULL, N_("_Print..."), "<control>P", NULL, G_CALLBACK(print_cb) },
+       /* {"File/---",                 NULL, "---", NULL, NULL, NULL }, */
+       {"File/SynchroniseFolders",     NULL, N_("Synchronise folders"), "<control><shift>S", NULL, G_CALLBACK(sync_cb) }, 
+       /* {"File/---",                 NULL, "---", NULL, NULL, NULL }, */
+       {"File/Exit",                   NULL, N_("E_xit"), "<control>Q", NULL, G_CALLBACK(app_exit_cb) }, 
 
 /* Edit menu */
-       {"Edit/Copy",                           NULL, N_("_Copy"), "<control>C", NULL, G_CALLBACK(copy_cb) }, 
-       {"Edit/SelectAll",                      NULL, N_("Select _all"), "<control>A", NULL, G_CALLBACK(allsel_cb) }, 
-       {"Edit/SelectThread",                   NULL, N_("Select _thread"), NULL, NULL, G_CALLBACK(select_thread_cb) }, 
-       {"Edit/DeleteThread",                   NULL, N_("_Delete thread"), NULL, NULL, G_CALLBACK(delete_thread_cb) }, 
-       {"Edit/---",                            NULL, "---" },
-       {"Edit/Find",                           NULL, N_("_Find in current message..."), "<control>F", NULL, G_CALLBACK(search_cb) },
+       {"Edit/Copy",                   NULL, N_("_Copy"), "<control>C", NULL, G_CALLBACK(copy_cb) }, 
+       {"Edit/SelectAll",              NULL, N_("Select _all"), "<control>A", NULL, G_CALLBACK(allsel_cb) }, 
+       {"Edit/SelectThread",           NULL, N_("Select _thread"), NULL, NULL, G_CALLBACK(select_thread_cb) }, 
+       {"Edit/---",                    NULL, "---", NULL, NULL, NULL },
+       {"Edit/Find",                   NULL, N_("_Find in current message..."), "<control>F", NULL, G_CALLBACK(search_cb) },
        {"Edit/SearchFolder",                   NULL, N_("_Search folder..."), "<shift><control>F", NULL, G_CALLBACK(search_folder_cb) },
        {"Edit/QuickSearch",                    NULL, N_("_Quick search"), "slash", NULL, G_CALLBACK(mainwindow_quicksearch) },
 
 /* View menu */
-       {"View/ShowHide",                       NULL, N_("Show or hi_de") },
-       {"View/ShowHide/Toolbar",               NULL, N_("_Toolbar") },
+       {"View/ShowHide",               NULL, N_("Show or hi_de"), NULL, NULL, NULL },
+       {"View/ShowHide/Toolbar",       NULL, N_("_Toolbar"), NULL, NULL, NULL },
 
-       {"View/SetColumns",                     NULL, N_("Set displayed _columns") },
-       {"View/SetColumns/Folderlist",          NULL, N_("In _folder list..."), NULL, NULL, G_CALLBACK(set_folder_display_item_cb) },
-       {"View/SetColumns/Messagelist",         NULL, N_("In _message list..."), NULL, NULL, G_CALLBACK(set_summary_display_item_cb) },
-       {"View/---",                            NULL, "---" },
+       {"View/SetColumns",             NULL, N_("Set displayed _columns"), NULL, NULL, NULL },
+       {"View/SetColumns/Folderlist",  NULL, N_("In _folder list..."), NULL, NULL, G_CALLBACK(set_folder_display_item_cb) },
+       {"View/SetColumns/Messagelist", NULL, N_("In _message list..."), NULL, NULL, G_CALLBACK(set_summary_display_item_cb) },
+       {"View/---",                    NULL, "---", NULL, NULL, NULL },
 
 
 #ifndef GENERIC_UMPC
-       {"View/Layout",                         NULL, N_("La_yout") },
-
+       {"View/Layout",                 NULL, N_("La_yout"), NULL, NULL, NULL },
 #endif
-       {"View/Sort",                           NULL, N_("_Sort") },
-       {"View/Sort/---",                       NULL, "---" }, 
+       {"View/Sort",                   NULL, N_("_Sort"), NULL, NULL, NULL },
+       {"View/Sort/---",               NULL, "---", NULL, NULL, NULL }, 
        {"View/Sort/AttractSubj",               NULL, N_("_Attract by subject"), NULL, NULL, G_CALLBACK(attract_by_subject_cb) }, 
 
        {"View/ExpandThreads",                  NULL, N_("E_xpand all threads"), NULL, NULL, G_CALLBACK(expand_threads_cb) }, 
        {"View/CollapseThreads",                NULL, N_("Co_llapse all threads"), NULL, NULL, G_CALLBACK(collapse_threads_cb) }, 
 
-       {"View/Goto",                           NULL, N_("_Go to") },
-       {"View/Goto/Prev",                      NULL, N_("_Previous message"), "P", NULL, G_CALLBACK(prev_cb) },
-       {"View/Goto/Next",                      NULL, N_("_Next message"), "N", NULL, G_CALLBACK(next_cb) },
-       {"View/Goto/---",                       NULL, "---", NULL, NULL, NULL },
-       {"View/Goto/PrevUnread",                NULL, N_("P_revious unread message"), "<shift>P", NULL, G_CALLBACK(prev_unread_cb) },
-       {"View/Goto/NextUnread",                NULL, N_("N_ext unread message"), "<shift>N", NULL, G_CALLBACK(next_unread_cb) },
-       /* {"View/Goto/---",                    NULL, "---", NULL, NULL, NULL }, */
-       {"View/Goto/PrevNew",                   NULL, N_("Previous ne_w message"), NULL, NULL, G_CALLBACK(prev_new_cb) },
-       {"View/Goto/NextNew",                   NULL, N_("Ne_xt new message"), NULL, NULL, G_CALLBACK(next_new_cb) },
-       /* {"View/Goto/---",                    NULL, "---", NULL, NULL, NULL }, */
-       {"View/Goto/PrevMarked",                NULL, N_("Previous _marked message"), NULL, NULL, G_CALLBACK(prev_marked_cb) },
-       {"View/Goto/NextMarked",                NULL, N_("Next m_arked message"), NULL, NULL, G_CALLBACK(next_marked_cb) },
-       /* {"View/Goto/---",                    NULL, "---", NULL, NULL, NULL }, */
-       {"View/Goto/PrevLabeled",               NULL, N_("Previous _labeled message"), NULL, NULL, G_CALLBACK(prev_labeled_cb) },
-       {"View/Goto/NextLabeled",               NULL, N_("Next la_beled message"), NULL, NULL, G_CALLBACK(next_labeled_cb) },
-       /* {"View/Goto/---",                    NULL, "---", NULL, NULL, NULL }, */
-       {"View/Goto/PrevHistory",               NULL, N_("Previous opened message"), "<alt>Left", NULL, G_CALLBACK(prev_history_cb) },
-       {"View/Goto/NextHistory",               NULL, N_("Next opened message"), "<alt>Right", NULL, G_CALLBACK(next_history_cb) },
-       /* {"View/Goto/---",                    NULL, "---", NULL, NULL, NULL }, */
-       {"View/Goto/ParentMessage",             NULL, N_("Parent message"), "<control>Up", NULL, G_CALLBACK(parent_cb) },
-       /* {"View/Goto/---",                    NULL, "---", NULL, NULL, NULL }, */
-       {"View/Goto/NextUnreadFolder",          NULL, N_("Next unread _folder"), "<shift>G", NULL, G_CALLBACK(goto_unread_folder_cb) },
-       {"View/Goto/OtherFolder",               NULL, N_("_Other folder..."), "G", NULL, G_CALLBACK(goto_folder_cb) },
-       /* {"View/Goto/---",                    NULL, "---", NULL, NULL, NULL }, */
-       {"View/Goto/NextPart",                  NULL, N_("Next part"), "A", NULL, G_CALLBACK(goto_next_part_cb) },
-       {"View/Goto/PrevPart",                  NULL, N_("Previous part"), "Z", NULL, G_CALLBACK(goto_prev_part_cb) },
-
-        /* {"View/Scroll/---",                  NULL, "---", NULL, NULL, NULL }, */
-        {"View/Scroll",                         NULL, N_("Message scroll") },
-        {"View/Scroll/PrevLine",                NULL, N_("Previous line"), NULL, NULL, G_CALLBACK(scroll_prev_line_cb) },
-        {"View/Scroll/NextLine",                NULL, N_("Next line"), NULL, NULL, G_CALLBACK(scroll_next_line_cb) },
-        {"View/Scroll/PrevPage",                NULL, N_("Previous page"), NULL, NULL, G_CALLBACK(scroll_prev_page_cb) },
-        {"View/Scroll/NextPage",                NULL, N_("Next page"), NULL, NULL, G_CALLBACK(scroll_next_page_cb) },
-
-       /* {"View/---",                         NULL, "---", NULL, NULL, NULL }, */
-       {"View/Encoding",                       NULL, N_("Character _encoding") }, /* set_charset_cb */
-       {"View/Encoding/---",                   NULL, "---" },
+       {"View/Goto",                   NULL, N_("_Go to"), NULL, NULL, NULL },
+       {"View/Goto/Prev",              NULL, N_("_Previous message"), "P", NULL, G_CALLBACK(prev_cb) },
+       {"View/Goto/Next",              NULL, N_("_Next message"), "N", NULL, G_CALLBACK(next_cb) },
+       {"View/Goto/---",               NULL, "---", NULL, NULL, NULL },
+       {"View/Goto/PrevUnread",        NULL, N_("P_revious unread message"), "<shift>P", NULL, G_CALLBACK(prev_unread_cb) },
+       {"View/Goto/NextUnread",        NULL, N_("N_ext unread message"), "<shift>N", NULL, G_CALLBACK(next_unread_cb) },
+       /* {"View/Goto/---",            NULL, "---", NULL, NULL, NULL }, */
+       {"View/Goto/PrevNew",           NULL, N_("Previous ne_w message"), NULL, NULL, G_CALLBACK(prev_new_cb) },
+       {"View/Goto/NextNew",           NULL, N_("Ne_xt new message"), NULL, NULL, G_CALLBACK(next_new_cb) },
+       /* {"View/Goto/---",            NULL, "---", NULL, NULL, NULL }, */
+       {"View/Goto/PrevMarked",        NULL, N_("Previous _marked message"), NULL, NULL, G_CALLBACK(prev_marked_cb) },
+       {"View/Goto/NextMarked",        NULL, N_("Next m_arked message"), NULL, NULL, G_CALLBACK(next_marked_cb) },
+       /* {"View/Goto/---",            NULL, "---", NULL, NULL, NULL }, */
+       {"View/Goto/PrevLabeled",       NULL, N_("Previous _labeled message"), NULL, NULL, G_CALLBACK(prev_labeled_cb) },
+       {"View/Goto/NextLabeled",       NULL, N_("Next la_beled message"), NULL, NULL, G_CALLBACK(next_labeled_cb) },
+       /* {"View/Goto/---",            NULL, "---", NULL, NULL, NULL }, */
+       {"View/Goto/PrevHistory",       NULL, N_("Previous opened message"), "<alt>Left", NULL, G_CALLBACK(prev_history_cb) },
+       {"View/Goto/NextHistory",       NULL, N_("Next opened message"), "<alt>Right", NULL, G_CALLBACK(next_history_cb) },
+       /* {"View/Goto/---",            NULL, "---", NULL, NULL, NULL }, */
+       {"View/Goto/ParentMessage",     NULL, N_("Parent message"), "<control>Up", NULL, G_CALLBACK(parent_cb) },
+       /* {"View/Goto/---",            NULL, "---", NULL, NULL, NULL }, */
+       {"View/Goto/NextUnreadFolder",  NULL, N_("Next unread _folder"), "<shift>G", NULL, G_CALLBACK(goto_unread_folder_cb) },
+       {"View/Goto/Folder",            NULL, N_("F_older..."), "G", NULL, G_CALLBACK(goto_folder_cb) },
+       /* {"View/Goto/---",            NULL, "---", NULL, NULL, NULL }, */
+       {"View/Goto/NextPart",          NULL, N_("Next part"), "A", NULL, G_CALLBACK(goto_next_part_cb) },
+       {"View/Goto/PrevPart",          NULL, N_("Previous part"), "Z", NULL, G_CALLBACK(goto_prev_part_cb) },
+
+       /* {"View/Scroll/---",          NULL, "---", NULL, NULL, NULL }, */
+       {"View/Scroll",                 NULL, N_("Message scroll"), NULL, NULL, NULL },
+       {"View/Scroll/PrevLine",        NULL, N_("Previous line"), NULL, NULL, G_CALLBACK(scroll_prev_line_cb) },
+       {"View/Scroll/NextLine",        NULL, N_("Next line"), NULL, NULL, G_CALLBACK(scroll_next_line_cb) },
+       {"View/Scroll/PrevPage",        NULL, N_("Previous page"), NULL, NULL, G_CALLBACK(scroll_prev_page_cb) },
+       {"View/Scroll/NextPage",        NULL, N_("Next page"), NULL, NULL, G_CALLBACK(scroll_next_page_cb) },
+
+       /* {"View/---",                 NULL, "---", NULL, NULL, NULL }, */
+       {"View/Encoding",               NULL, N_("Character _encoding"), NULL, NULL, NULL }, /* set_charset_cb */
+       {"View/Encoding/---",           NULL, "---", NULL, NULL, NULL },
 #define ENC_ACTION(cs_char,c_char,string) \
        { "View/Encoding/" cs_char, NULL, N_(string), NULL, NULL, c_char }
 
-       {"View/Encoding/Western",               NULL, N_("Western European") },
-       {"View/Encoding/Baltic",                NULL, N_("Baltic") },
-       {"View/Encoding/Hebrew",                NULL, N_("Hebrew") },
-       {"View/Encoding/Arabic",                NULL, N_("Arabic") },
-       {"View/Encoding/Cyrillic",              NULL, N_("Cyrillic") },
-       {"View/Encoding/Japanese",              NULL, N_("Japanese") },
-       {"View/Encoding/Chinese",               NULL, N_("Chinese") },
-       {"View/Encoding/Korean",                NULL, N_("Korean") },
-       {"View/Encoding/Thai",                  NULL, N_("Thai") },
+       {"View/Encoding/Western",       NULL, N_("Western European"), NULL, NULL, NULL },
+       {"View/Encoding/Baltic",        NULL, N_("Baltic"), NULL, NULL, NULL },
+       {"View/Encoding/Hebrew",        NULL, N_("Hebrew"), NULL, NULL, NULL },
+       {"View/Encoding/Arabic",        NULL, N_("Arabic"), NULL, NULL, NULL },
+       {"View/Encoding/Cyrillic",      NULL, N_("Cyrillic"), NULL, NULL, NULL },
+       {"View/Encoding/Japanese",      NULL, N_("Japanese"), NULL, NULL, NULL },
+       {"View/Encoding/Chinese",       NULL, N_("Chinese"), NULL, NULL, NULL },
+       {"View/Encoding/Korean",        NULL, N_("Korean"), NULL, NULL, NULL },
+       {"View/Encoding/Thai",          NULL, N_("Thai"), NULL, NULL, NULL },
 
-       {"View/Decode",                         NULL, N_("Decode") }, /* set_decode_cb */
-       {"View/Decode/---",                     NULL, "---" },
+       {"View/Decode",                 NULL, N_("Decode"), NULL, NULL, NULL }, /* set_decode_cb */
+       {"View/Decode/---",             NULL, "---", NULL, NULL, NULL },
 
 #define DEC_ACTION(cs_type,c_type,string) \
        { "View/Decode/" cs_type, NULL, N_(string), NULL, NULL, c_type }
 
-       /* {"View/---",                         NULL, "---", NULL, NULL, NULL }, */
-       {"View/OpenNewWindow",                  NULL, N_("Open in new _window"), "<control><alt>N", NULL, G_CALLBACK(open_msg_cb) },
-       {"View/MessageSource",                  NULL, N_("Mess_age source"), "<control>U", NULL, G_CALLBACK(view_source_cb) },
-       /* {"View/---",                         NULL, "---", NULL, NULL, NULL }, */
-       {"View/Part",                           NULL, N_("Message part") },
-       {"View/Part/AsText",                    NULL, N_("View as text"), "T", NULL, G_CALLBACK(view_part_as_text_cb) },
-       {"View/Part/Open",                      NULL, N_("Open"), "L", NULL, G_CALLBACK(open_part_cb) },
+       /* {"View/---",                 NULL, "---", NULL, NULL, NULL }, */
+       {"View/OpenNewWindow",          NULL, N_("Open in new _window"), "<control><alt>N", NULL, G_CALLBACK(open_msg_cb) },
+       {"View/MessageSource",          NULL, N_("Mess_age source"), "<control>U", NULL, G_CALLBACK(view_source_cb) },
+       /* {"View/---",                 NULL, "---", NULL, NULL, NULL }, */
+       {"View/Part",                   NULL, N_("Message part"), NULL, NULL, NULL },
+       {"View/Part/AsText",            NULL, N_("View as text"), "T", NULL, G_CALLBACK(view_part_as_text_cb) },
+       {"View/Part/Open",              NULL, N_("Open"), "L", NULL, G_CALLBACK(open_part_cb) },
 #ifndef G_OS_WIN32
-       {"View/Part/OpenWith",                  NULL, N_("Open with..."), "O", NULL, G_CALLBACK(open_part_with_cb) },
+       {"View/Part/OpenWith",          NULL, N_("Open with..."), "O", NULL, G_CALLBACK(open_part_with_cb) },
 #endif
-       /* {"View/---",                         NULL, "---", NULL, NULL, NULL }, */
+       /* {"View/---",                 NULL, "---", NULL, NULL, NULL }, */
 
-       {"View/Quotes",                         NULL, N_("Quotes") }, 
-       /* {"View/---",                         NULL, "---", NULL, NULL, NULL }, */
-       {"View/UpdateSummary",                  NULL, N_("_Update summary"), "<control><alt>U", NULL, G_CALLBACK(update_summary_cb) },
+       {"View/Quotes",                 NULL, N_("Quotes"), NULL, NULL, NULL }, 
+       /* {"View/---",                 NULL, "---", NULL, NULL, NULL }, */
+       {"View/UpdateSummary",          NULL, N_("_Update summary"), "<control><alt>U", NULL, G_CALLBACK(update_summary_cb) },
 
 /* Message menu */
-       {"Message/Receive",                     NULL, N_("Recei_ve") },
-       {"Message/Receive/CurrentAccount",      NULL, N_("Get from _current account"), "<control>I", NULL, G_CALLBACK(mw_inc_mail_cb) },
-       {"Message/Receive/AllAccounts",         NULL, N_("Get from _all accounts"), "<shift><control>I", NULL, G_CALLBACK(mw_inc_all_account_mail_cb) },
-       {"Message/Receive/CancelReceiving",     NULL, N_("Cancel receivin_g"), NULL, NULL, G_CALLBACK(inc_cancel_cb) },
-       {"Message/Receive/---",                 NULL, "---" },
-       {"Message/Receive/PlaceHolder",         NULL, "PlaceHolder,", NULL, NULL, G_CALLBACK(mainwindow_nothing_cb) },
-       {"Message/SendQueue",                   NULL, N_("_Send queued messages"), NULL, NULL, G_CALLBACK(mw_send_queue_cb) },
-       {"Message/CancelSending",       NULL, N_("Cancel sending"), NULL, NULL, G_CALLBACK(send_cancel_cb) },
-
-       {"Message/---",                         NULL, "---" },
-
-       {"Message/ComposeEmail",                NULL, N_("Compose a_n email message"), "<control>M", NULL, G_CALLBACK(mw_compose_mail_cb) },
-       {"Message/ComposeNews",                 NULL, N_("Compose a news message"), NULL, NULL, G_CALLBACK(mw_compose_news_cb) },
-
-       {"Message/Reply",                       NULL, N_("_Reply"), "<control>R", NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_REPLY */
-       {"Message/ReplyTo",                     NULL, N_("Repl_y to") }, 
-       {"Message/ReplyTo/All",                 NULL, N_("_All"), "<control><shift>R", NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_REPLY_TO_ALL */
-       {"Message/ReplyTo/Sender",              NULL, N_("_Sender"), NULL, NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_REPLY_TO_SENDER */
-       {"Message/ReplyTo/List",                NULL, N_("Mailing _list"), "<control>L", NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_REPLY_TO_LIST */
-       {"Message/FollowupReply",               NULL, N_("Follow-up and reply to"), NULL, NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_FOLLOWUP_AND_REPLY_TO */
-       /*{"Message/---",                       NULL, "---" },*/
-
-       {"Message/Forward",                     NULL, N_("_Forward"), "<control><alt>F", NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_FORWARD_INLINE */
-       {"Message/ForwardAtt",                  NULL, N_("For_ward as attachment"), NULL, NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_FORWARD_AS_ATTACH */
-       {"Message/Redirect",                    NULL, N_("Redirec_t"), NULL, NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_REDIRECT */
-
-       {"Message/MailingList",                 NULL, N_("Mailing-_List") }, 
-       {"Message/MailingList/Post",            NULL, N_("Post") }, 
-       {"Message/MailingList/Post/PlaceHolder",        NULL, "Placeholder", NULL, NULL, G_CALLBACK(mainwindow_nothing_cb) },
-       {"Message/MailingList/Help",            NULL, N_("Help") }, 
-       {"Message/MailingList/Help/PlaceHolder",        NULL, "Placeholder", NULL, NULL, G_CALLBACK(mainwindow_nothing_cb) },
-       {"Message/MailingList/Subscribe",       NULL, N_("Subscribe") }, 
-       {"Message/MailingList/Subscribe/PlaceHolder",   NULL, "Placeholder", NULL, NULL, G_CALLBACK(mainwindow_nothing_cb) },
-       {"Message/MailingList/Unsubscribe",     NULL, N_("Unsubscribe") }, 
-       {"Message/MailingList/Unsubscribe/PlaceHolder", NULL, "Placeholder", NULL, NULL, G_CALLBACK(mainwindow_nothing_cb) },
-       {"Message/MailingList/ViewArchive",     NULL, N_("View archive") }, 
-       {"Message/MailingList/ViewArchive/PlaceHolder", NULL, "Placeholder", NULL, NULL, G_CALLBACK(mainwindow_nothing_cb) },
-       {"Message/MailingList/ContactOwner",    NULL, N_("Contact owner") }, 
-       {"Message/MailingList/ContactOwner/PlaceHolder",        NULL, "Placeholder", NULL, NULL, G_CALLBACK(mainwindow_nothing_cb) },
+       {"Message/Receive",                              NULL, N_("Recei_ve"), NULL, NULL, NULL },
+       {"Message/Receive/CurrentAccount",               NULL, N_("Get from _current account"), "<control>I", NULL, G_CALLBACK(mw_inc_mail_cb) },
+       {"Message/Receive/AllAccounts",                  NULL, N_("Get from _all accounts"), "<shift><control>I", NULL, G_CALLBACK(mw_inc_all_account_mail_cb) },
+       {"Message/Receive/CancelReceiving",              NULL, N_("Cancel receivin_g"), NULL, NULL, G_CALLBACK(inc_cancel_cb) },
+       {"Message/Receive/---",                          NULL, "---", NULL, NULL, NULL },
+       {"Message/Receive/PlaceHolder",                  NULL, "PlaceHolder,", NULL, NULL, G_CALLBACK(mainwindow_nothing_cb) },
+       {"Message/SendQueue",                            NULL, N_("_Send queued messages"), NULL, NULL, G_CALLBACK(mw_send_queue_cb) },
+       {"Message/CancelSending",                        NULL, N_("Cancel sending"), NULL, NULL, G_CALLBACK(send_cancel_cb) },
+
+       {"Message/---",                                  NULL, "---", NULL, NULL, NULL },
+
+       {"Message/ComposeEmail",                         NULL, N_("Compose a_n email message"), "<control>M", NULL, G_CALLBACK(mw_compose_mail_cb) },
+       {"Message/ComposeNews",                          NULL, N_("Compose a news message"), NULL, NULL, G_CALLBACK(mw_compose_news_cb) },
+
+       {"Message/Reply",                                NULL, N_("_Reply"), "<control>R", NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_REPLY */
+       {"Message/ReplyTo",                              NULL, N_("Repl_y to"), NULL, NULL, NULL }, 
+       {"Message/ReplyTo/All",                          NULL, N_("_All"), "<control><shift>R", NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_REPLY_TO_ALL */
+       {"Message/ReplyTo/Sender",                       NULL, N_("_Sender"), NULL, NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_REPLY_TO_SENDER */
+       {"Message/ReplyTo/List",                         NULL, N_("Mailing _list"), "<control>L", NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_REPLY_TO_LIST */
+       {"Message/FollowupReply",                        NULL, N_("Follow-up and reply to"), NULL, NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_FOLLOWUP_AND_REPLY_TO */
+       /* {"Message/---",                               NULL, "---", NULL, NULL, NULL }, */
+
+       {"Message/Forward",                              NULL, N_("_Forward"), "<control><alt>F", NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_FORWARD_INLINE */
+       {"Message/ForwardAtt",                           NULL, N_("For_ward as attachment"), NULL, NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_FORWARD_AS_ATTACH */
+       {"Message/Redirect",                             NULL, N_("Redirec_t"), NULL, NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_REDIRECT */
+
+       {"Message/MailingList",                          NULL, N_("Mailing-_List"), NULL, NULL, NULL }, 
+       {"Message/MailingList/Post",                     NULL, N_("Post"), NULL, NULL, NULL }, 
+       {"Message/MailingList/Post/PlaceHolder",         NULL, "Placeholder", NULL, NULL, G_CALLBACK(mainwindow_nothing_cb) },
+       {"Message/MailingList/Help",                     NULL, N_("Help"), NULL, NULL, NULL }, 
+       {"Message/MailingList/Help/PlaceHolder",         NULL, "Placeholder", NULL, NULL, G_CALLBACK(mainwindow_nothing_cb) },
+       {"Message/MailingList/Subscribe",                NULL, N_("Subscribe"), NULL, NULL, NULL }, 
+       {"Message/MailingList/Subscribe/PlaceHolder",    NULL, "Placeholder", NULL, NULL, G_CALLBACK(mainwindow_nothing_cb) },
+       {"Message/MailingList/Unsubscribe",              NULL, N_("Unsubscribe"), NULL, NULL, NULL }, 
+       {"Message/MailingList/Unsubscribe/PlaceHolder",  NULL, "Placeholder", NULL, NULL, G_CALLBACK(mainwindow_nothing_cb) },
+       {"Message/MailingList/ViewArchive",              NULL, N_("View archive"), NULL, NULL, NULL }, 
+       {"Message/MailingList/ViewArchive/PlaceHolder",  NULL, "Placeholder", NULL, NULL, G_CALLBACK(mainwindow_nothing_cb) },
+       {"Message/MailingList/ContactOwner",             NULL, N_("Contact owner"), NULL, NULL, NULL }, 
+       {"Message/MailingList/ContactOwner/PlaceHolder", NULL, "Placeholder", NULL, NULL, G_CALLBACK(mainwindow_nothing_cb) },
        /* separation */
 
-       {"Message/Move",                        NULL, N_("M_ove..."), "<control>O", NULL, G_CALLBACK(move_to_cb) },
-       {"Message/Copy",                        NULL, N_("_Copy..."), "<shift><control>O", NULL, G_CALLBACK(copy_to_cb) },
-       {"Message/Trash",                       NULL, N_("Move to _trash"), "<control>D", NULL, G_CALLBACK(delete_trash_cb) },
-       {"Message/Delete",                      NULL, N_("_Delete..."), NULL, NULL, G_CALLBACK(delete_cb) },
-       {"Message/CancelNews",                  NULL, N_("Cancel a news message"), NULL, NULL, G_CALLBACK(cancel_cb) },
+       {"Message/Move",                             NULL, N_("M_ove..."), "<control>O", NULL, G_CALLBACK(move_to_cb) },
+       {"Message/Copy",                             NULL, N_("_Copy..."), "<shift><control>O", NULL, G_CALLBACK(copy_to_cb) },
+       {"Message/Trash",                            NULL, N_("Move to _trash"), "<control>D", NULL, G_CALLBACK(delete_trash_cb) },
+       {"Message/Delete",                           NULL, N_("_Delete..."), NULL, NULL, G_CALLBACK(delete_cb) },
+       {"Message/TrashThread",                      NULL, N_("Move thread to tr_ash"), NULL, NULL, G_CALLBACK(trash_thread_cb) }, 
+       {"Message/DeleteThread",                     NULL, N_("Delete t_hread"), NULL, NULL, G_CALLBACK(delete_thread_cb) }, 
+       {"Message/CancelNews",                       NULL, N_("Cancel a news message"), NULL, NULL, G_CALLBACK(cancel_cb) },
        /* separation */
        
-       {"Message/Mark",                        NULL, N_("_Mark") },
-       {"Message/Mark/Mark",                   NULL, N_("_Mark"), "<shift>asterisk", NULL, G_CALLBACK(mark_cb) },
-       {"Message/Mark/Unmark",                 NULL, N_("_Unmark"), "U", NULL, G_CALLBACK(unmark_cb) },
-       {"Message/Mark/---",                    NULL, "---", NULL, NULL, NULL },
+       {"Message/Mark",                             NULL, N_("_Mark"), NULL, NULL, NULL },
+       {"Message/Mark/Mark",                        NULL, N_("_Mark"), "<shift>asterisk", NULL, G_CALLBACK(mark_cb) },
+       {"Message/Mark/Unmark",                      NULL, N_("_Unmark"), "U", NULL, G_CALLBACK(unmark_cb) },
+       {"Message/Mark/---",                         NULL, "---", NULL, NULL, NULL },
 
-       {"Message/Mark/MarkUnread",             NULL, N_("Mark as unr_ead"), "<shift>exclam", NULL, G_CALLBACK(mark_as_unread_cb) },
-       {"Message/Mark/MarkRead",               NULL, N_("Mark as rea_d"), NULL, NULL, G_CALLBACK(mark_as_read_cb) },
+       {"Message/Mark/MarkRead",                    NULL, N_("Mark as rea_d"), NULL, NULL, G_CALLBACK(mark_as_read_cb) },
+       {"Message/Mark/MarkUnread",                  NULL, N_("Mark as unr_ead"), "<shift>exclam", NULL, G_CALLBACK(mark_as_unread_cb) },
        /* separation */
-       {"Message/Mark/MarkAllRead",            NULL, N_("Mark all read"), NULL, NULL, G_CALLBACK(mark_all_read_cb) },
+       {"Message/Mark/MarkAllRead",                 NULL, N_("Mark all read"), NULL, NULL, G_CALLBACK(mark_all_read_cb) },
+       {"Message/Mark/MarkAllUnread",               NULL, N_("Mark all unread"), NULL, NULL, G_CALLBACK(mark_all_unread_cb) },
        /* separation */
-       {"Message/Mark/IgnoreThread",           NULL, N_("Ignore thread"), NULL, NULL, G_CALLBACK(ignore_thread_cb) },
-       {"Message/Mark/UnignoreThread",         NULL, N_("Unignore thread"), NULL, NULL, G_CALLBACK(unignore_thread_cb) },
-       {"Message/Mark/WatchThread",            NULL, N_("Watch thread"), NULL, NULL, G_CALLBACK(watch_thread_cb) },
-       {"Message/Mark/UnwatchThread",          NULL, N_("Unwatch thread"), NULL, NULL, G_CALLBACK(unwatch_thread_cb) },
+       {"Message/Mark/IgnoreThread",                NULL, N_("Ignore thread"), NULL, NULL, G_CALLBACK(ignore_thread_cb) },
+       {"Message/Mark/UnignoreThread",              NULL, N_("Unignore thread"), NULL, NULL, G_CALLBACK(unignore_thread_cb) },
+       {"Message/Mark/WatchThread",                 NULL, N_("Watch thread"), NULL, NULL, G_CALLBACK(watch_thread_cb) },
+       {"Message/Mark/UnwatchThread",               NULL, N_("Unwatch thread"), NULL, NULL, G_CALLBACK(unwatch_thread_cb) },
        /* separation */
 
-       {"Message/Mark/MarkSpam",               NULL, N_("Mark as _spam"), NULL, NULL, G_CALLBACK(mark_as_spam_cb) },
-       {"Message/Mark/MarkHam",                NULL, N_("Mark as _ham"), NULL, NULL, G_CALLBACK(mark_as_ham_cb) },
+       {"Message/Mark/MarkSpam",                    NULL, N_("Mark as _spam"), NULL, NULL, G_CALLBACK(mark_as_spam_cb) },
+       {"Message/Mark/MarkHam",                     NULL, N_("Mark as _ham"), NULL, NULL, G_CALLBACK(mark_as_ham_cb) },
        /* separation */
 
-       {"Message/Mark/Lock",                   NULL, N_("Lock"), NULL, NULL, G_CALLBACK(lock_msgs_cb) },
-       {"Message/Mark/Unlock",                 NULL, N_("Unlock"), NULL, NULL, G_CALLBACK(unlock_msgs_cb) },
+       {"Message/Mark/Lock",                        NULL, N_("Lock"), NULL, NULL, G_CALLBACK(lock_msgs_cb) },
+       {"Message/Mark/Unlock",                      NULL, N_("Unlock"), NULL, NULL, G_CALLBACK(unlock_msgs_cb) },
 
-       {"Message/ColorLabel",                  NULL, N_("Color la_bel") },
-       {"Message/Tags",                        NULL, N_("Ta_gs") },
-       /*{"Message/---",                       NULL, "---" },*/
+       {"Message/ColorLabel",                       NULL, N_("Color la_bel"), NULL, NULL, NULL },
+       {"Message/Tags",                             NULL, N_("Ta_gs"), NULL, NULL, NULL },
+       /*{"Message/---",                            NULL, "---", NULL, NULL, NULL },*/
 
-       {"Message/Reedit",                      NULL, N_("Re-_edit"), NULL, NULL, G_CALLBACK(reedit_cb) },
-       /*{"Message/---",                       NULL, "---" },*/
+       {"Message/Reedit",                           NULL, N_("Re-_edit"), NULL, NULL, G_CALLBACK(reedit_cb) },
+       /*{"Message/---",                            NULL, "---", NULL, NULL, NULL },*/
 
-       {"Message/CheckSignature",              NULL, N_("Check signature"), "C", NULL, G_CALLBACK(check_signature_cb) },
+       {"Message/CheckSignature",                   NULL, N_("Check signature"), "C", NULL, G_CALLBACK(check_signature_cb) },
 
 /* Tools menu */
 
-       {"Tools/AddressBook",                   NULL, N_("_Address book"), "<control><shift>A", NULL, G_CALLBACK(addressbook_open_cb) }, 
-       {"Tools/AddSenderToAB",                 NULL, N_("Add sender to address boo_k"), NULL, NULL, G_CALLBACK(add_address_cb) }, 
-
-       {"Tools/CollectAddresses",              NULL, N_("C_ollect addresses") }, 
-       {"Tools/CollectAddresses/FromFolder",   NULL, N_("From current _folder..."), NULL, NULL, G_CALLBACK(addr_harvest_cb) }, 
-       {"Tools/CollectAddresses/FromSelected", NULL, N_("From selected _messages..."), NULL, NULL, G_CALLBACK(addr_harvest_msg_cb) }, 
-       {"Tools/---",                           NULL, "---", NULL, NULL, NULL },
-
-       {"Tools/FilterFolder",                  NULL, N_("_Filter all messages in folder"), NULL, NULL, G_CALLBACK(filter_cb) }, 
-       {"Tools/FilterSelected",                NULL, N_("Filter _selected messages"), NULL, NULL, G_CALLBACK(filter_list_cb) }, 
-       {"Tools/RunProcessing",                 NULL, N_("Run folder pr_ocessing rules"), NULL, NULL, G_CALLBACK(process_cb) }, 
-
-       {"Tools/CreateFilterRule",              NULL, N_("_Create filter rule") },
-       {"Tools/CreateFilterRule/Automatically",NULL, N_("_Automatically"), NULL, NULL, G_CALLBACK(create_filter_cb) }, /* FILTER_BY_AUTO */
-       {"Tools/CreateFilterRule/ByFrom",       NULL, N_("By _From"), NULL, NULL, G_CALLBACK(create_filter_cb) }, /* FILTER_BY_FROM */
-       {"Tools/CreateFilterRule/ByTo",         NULL, N_("By _To"), NULL, NULL, G_CALLBACK(create_filter_cb) }, /* FILTER_BY_TO     */
-       {"Tools/CreateFilterRule/BySubject",    NULL, N_("By _Subject"), NULL, NULL, G_CALLBACK(create_filter_cb) }, /* FILTER_BY_SUBJECT */
-
-       {"Tools/CreateProcessingRule",          NULL, N_("Create processing rule") },
-       {"Tools/CreateProcessingRule/Automatically",    NULL, N_("_Automatically"), NULL, NULL, G_CALLBACK(create_processing_cb) }, 
-       {"Tools/CreateProcessingRule/ByFrom",   NULL, N_("By _From"), NULL, NULL, G_CALLBACK(create_processing_cb) }, 
-       {"Tools/CreateProcessingRule/ByTo",     NULL, N_("By _To"), NULL, NULL, G_CALLBACK(create_processing_cb) }, 
-       {"Tools/CreateProcessingRule/BySubject",NULL, N_("By _Subject"), NULL, NULL, G_CALLBACK(create_processing_cb) }, 
-       /* {"Tools/---",                        NULL, "---", NULL, NULL, NULL }, */
-
-       {"Tools/ListUrls",                      NULL, N_("List _URLs..."), "<control><shift>U", NULL, G_CALLBACK(open_urls_cb) }, 
-
-       /* {"Tools/---",                        NULL, "---", NULL, NULL, NULL }, */
-       {"Tools/Actions",                       NULL, N_("Actio_ns") },
-       {"Tools/Actions/PlaceHolder",           NULL, "Placeholder", NULL, NULL, G_CALLBACK(mainwindow_nothing_cb) },
-       /* {"Tools/---",                        NULL, "---", NULL, NULL, NULL }, */
-
-       {"Tools/CheckNewMessages",              NULL, N_("Ch_eck for new messages in all folders"), NULL, NULL, G_CALLBACK(update_folderview_cb) }, 
-       {"Tools/DeleteDuplicates",              NULL, N_("Delete du_plicated messages") },
-       {"Tools/DeleteDuplicates/SelFolder",    NULL, N_("In selected folder"), NULL, NULL, G_CALLBACK(delete_duplicated_cb) },
-       {"Tools/DeleteDuplicates/AllFolders",   NULL, N_("In all folders"), NULL, NULL, G_CALLBACK(delete_duplicated_all_cb) },
-       /* {"Tools/---",                        NULL, "---", NULL, NULL, NULL }, */
-
-       {"Tools/Execute",                       NULL, N_("E_xecute"), "X", NULL, G_CALLBACK(execute_summary_cb) }, 
-       {"Tools/Expunge",                       NULL, N_("Exp_unge"), "<control>E", NULL, G_CALLBACK(expunge_summary_cb) }, 
+       {"Tools/AddressBook",                        NULL, N_("_Address book"), "<control><shift>A", NULL, G_CALLBACK(addressbook_open_cb) }, 
+       {"Tools/AddSenderToAB",                      NULL, N_("Add sender to address boo_k"), NULL, NULL, G_CALLBACK(add_address_cb) }, 
+
+       {"Tools/CollectAddresses",                   NULL, N_("C_ollect addresses"), NULL, NULL, NULL }, 
+       {"Tools/CollectAddresses/FromFolder",        NULL, N_("From current _folder..."), NULL, NULL, G_CALLBACK(addr_harvest_cb) }, 
+       {"Tools/CollectAddresses/FromSelected",      NULL, N_("From selected _messages..."), NULL, NULL, G_CALLBACK(addr_harvest_msg_cb) }, 
+       {"Tools/---",                                NULL, "---", NULL, NULL, NULL },
+
+       {"Tools/FilterFolder",                       NULL, N_("_Filter all messages in folder"), NULL, NULL, G_CALLBACK(filter_cb) }, 
+       {"Tools/FilterSelected",                     NULL, N_("Filter _selected messages"), NULL, NULL, G_CALLBACK(filter_list_cb) }, 
+       {"Tools/RunProcessing",                      NULL, N_("Run folder pr_ocessing rules"), NULL, NULL, G_CALLBACK(process_cb) }, 
+
+       {"Tools/CreateFilterRule",                   NULL, N_("_Create filter rule"), NULL, NULL, NULL },
+       {"Tools/CreateFilterRule/Automatically",     NULL, N_("_Automatically"), NULL, NULL, G_CALLBACK(create_filter_cb) }, /* FILTER_BY_AUTO */
+       {"Tools/CreateFilterRule/ByFrom",            NULL, N_("By _From"), NULL, NULL, G_CALLBACK(create_filter_cb) }, /* FILTER_BY_FROM */
+       {"Tools/CreateFilterRule/ByTo",              NULL, N_("By _To"), NULL, NULL, G_CALLBACK(create_filter_cb) }, /* FILTER_BY_TO     */
+       {"Tools/CreateFilterRule/BySubject",         NULL, N_("By _Subject"), NULL, NULL, G_CALLBACK(create_filter_cb) }, /* FILTER_BY_SUBJECT */
+
+       {"Tools/CreateProcessingRule",               NULL, N_("Create processing rule"), NULL, NULL, NULL },
+       {"Tools/CreateProcessingRule/Automatically", NULL, N_("_Automatically"), NULL, NULL, G_CALLBACK(create_processing_cb) }, 
+       {"Tools/CreateProcessingRule/ByFrom",        NULL, N_("By _From"), NULL, NULL, G_CALLBACK(create_processing_cb) }, 
+       {"Tools/CreateProcessingRule/ByTo",          NULL, N_("By _To"), NULL, NULL, G_CALLBACK(create_processing_cb) }, 
+       {"Tools/CreateProcessingRule/BySubject",     NULL, N_("By _Subject"), NULL, NULL, G_CALLBACK(create_processing_cb) }, 
+       /* {"Tools/---",                             NULL, "---", NULL, NULL, NULL }, */
+
+       {"Tools/ListUrls",                           NULL, N_("List _URLs..."), "<control><shift>U", NULL, G_CALLBACK(open_urls_cb) }, 
+
+       /* {"Tools/---",                             NULL, "---", NULL, NULL, NULL }, */
+       {"Tools/Actions",                            NULL, N_("Actio_ns"), NULL, NULL, NULL },
+       {"Tools/Actions/PlaceHolder",                NULL, "Placeholder", NULL, NULL, G_CALLBACK(mainwindow_nothing_cb) },
+       /* {"Tools/---",                             NULL, "---", NULL, NULL, NULL }, */
+
+       {"Tools/CheckNewMessages",                   NULL, N_("Ch_eck for new messages in all folders"), NULL, NULL, G_CALLBACK(update_folderview_cb) }, 
+       {"Tools/DeleteDuplicates",                   NULL, N_("Delete du_plicated messages"), NULL, NULL, NULL },
+       {"Tools/DeleteDuplicates/SelFolder",         NULL, N_("In selected folder"), NULL, NULL, G_CALLBACK(delete_duplicated_cb) },
+       {"Tools/DeleteDuplicates/AllFolders",        NULL, N_("In all folders"), NULL, NULL, G_CALLBACK(delete_duplicated_all_cb) },
+       /* {"Tools/---",                             NULL, "---", NULL, NULL, NULL }, */
+
+       {"Tools/Execute",                            NULL, N_("E_xecute"), "X", NULL, G_CALLBACK(execute_summary_cb) }, 
+       {"Tools/Expunge",                            NULL, N_("Exp_unge"), "<control>E", NULL, G_CALLBACK(expunge_summary_cb) }, 
 #ifdef USE_GNUTLS
-       /* {"Tools/---",                        NULL, "---", NULL, NULL, NULL }, */
-       {"Tools/SSLCertificates",               NULL, N_("SSL cer_tificates"), NULL, NULL, G_CALLBACK(ssl_manager_open_cb) }, 
+       /* {"Tools/---",                             NULL, "---", NULL, NULL, NULL }, */
+       {"Tools/SSLCertificates",                    NULL, N_("SSL/TLS cer_tificates"), NULL, NULL, G_CALLBACK(ssl_manager_open_cb) }, 
 #endif
-       /* {"Tools/---",                        NULL, "---", NULL, NULL, NULL }, */
-#ifndef G_OS_WIN32
-       {"Tools/FilteringLog",                  NULL, N_("Filtering Lo_g"), NULL, NULL, G_CALLBACK(filtering_debug_window_show_cb) }, 
+       /* {"Tools/---",                             NULL, "---", NULL, NULL, NULL }, */
+       {"Tools/FilteringLog",                       NULL, N_("Filtering Lo_g"), NULL, NULL, G_CALLBACK(filtering_debug_window_show_cb) }, 
+       {"Tools/NetworkLog",                         NULL, N_("Network _Log"), "<shift><control>L", NULL, G_CALLBACK(log_window_show_cb) }, 
+       /* {"Tools/---",                             NULL, "---", NULL, NULL, NULL }, */
+       {"Tools/ForgetSessionPasswords",             NULL, N_("_Forget all session passwords"), NULL, NULL, G_CALLBACK(forget_session_passwords_cb) }, 
+#ifndef PASSWORD_CRYPTO_OLD
+       {"Tools/ForgetMasterPassphrase",             NULL, N_("Forget _master passphrase"), NULL, NULL, G_CALLBACK(forget_master_passphrase_cb) },
 #endif
-       {"Tools/NetworkLog",                    NULL, N_("Network _Log"), "<shift><control>L", NULL, G_CALLBACK(log_window_show_cb) }, 
-       /* {"Tools/---",                        NULL, "---", NULL, NULL, NULL }, */
-       {"Tools/ForgetSessionPasswords",                NULL, N_("_Forget all session passwords"), NULL, NULL, G_CALLBACK(forget_session_passwords_cb) }, 
 
 /* Configuration menu */       
-       {"Configuration/ChangeAccount",         NULL, N_("C_hange current account") },
-       {"Configuration/ChangeAccount/PlaceHolder",     NULL, "Placeholder", NULL, NULL, G_CALLBACK(mainwindow_nothing_cb) },
-       {"Configuration/AccountPrefs",          NULL, N_("_Preferences for current account..."), NULL, NULL, G_CALLBACK(prefs_account_open_cb) },
-       {"Configuration/CreateAccount",         NULL, N_("Create _new account..."), NULL, NULL, G_CALLBACK(new_account_cb) },
-       {"Configuration/EditAccounts",          NULL, N_("_Edit accounts..."), NULL, NULL, G_CALLBACK(account_edit_open) },
-       {"Configuration/---",                   NULL, "---", NULL, NULL, NULL }, 
-
-       {"Configuration/Preferences",           NULL, N_("P_references..."), NULL, NULL, G_CALLBACK(prefs_open_cb) },
-       {"Configuration/PreProcessing",         NULL, N_("Pre-pr_ocessing..."), NULL, NULL, G_CALLBACK(prefs_pre_processing_open_cb) },
-       {"Configuration/PostProcessing",        NULL, N_("Post-pro_cessing..."), NULL, NULL, G_CALLBACK(prefs_post_processing_open_cb) },
-       {"Configuration/Filtering",             NULL, N_("_Filtering..."), NULL, NULL, G_CALLBACK(prefs_filtering_open_cb) },
-       {"Configuration/Templates",             NULL, N_("_Templates..."), NULL, NULL, G_CALLBACK(prefs_template_open_cb) },
-       {"Configuration/Actions",               NULL, N_("_Actions..."), NULL, NULL, G_CALLBACK(prefs_actions_open_cb) },
-       {"Configuration/Tags",                  NULL, N_("Tag_s..."), NULL, NULL, G_CALLBACK(prefs_tags_open_cb) },
-       /*{"Configuration/---",                 NULL, "---", NULL, NULL, NULL }, */
-       {"Configuration/Plugins",               NULL, N_("Plu_gins..."), NULL, NULL, G_CALLBACK(plugins_open_cb) },
+       {"Configuration/ChangeAccount",              NULL, N_("C_hange current account"), NULL, NULL, NULL },
+       {"Configuration/ChangeAccount/PlaceHolder",  NULL, "Placeholder", NULL, NULL, G_CALLBACK(mainwindow_nothing_cb) },
+       {"Configuration/AccountPrefs",               NULL, N_("_Preferences for current account..."), NULL, NULL, G_CALLBACK(prefs_account_open_cb) },
+       {"Configuration/CreateAccount",              NULL, N_("Create _new account..."), NULL, NULL, G_CALLBACK(new_account_cb) },
+       {"Configuration/EditAccounts",               NULL, N_("_Edit accounts..."), NULL, NULL, G_CALLBACK(account_edit_open) },
+       {"Configuration/---",                        NULL, "---", NULL, NULL, NULL }, 
+
+       {"Configuration/Preferences",                NULL, N_("P_references..."), NULL, NULL, G_CALLBACK(prefs_open_cb) },
+       {"Configuration/PreProcessing",              NULL, N_("Pre-pr_ocessing..."), NULL, NULL, G_CALLBACK(prefs_pre_processing_open_cb) },
+       {"Configuration/PostProcessing",             NULL, N_("Post-pro_cessing..."), NULL, NULL, G_CALLBACK(prefs_post_processing_open_cb) },
+       {"Configuration/Filtering",                  NULL, N_("_Filtering..."), NULL, NULL, G_CALLBACK(prefs_filtering_open_cb) },
+       {"Configuration/Templates",                  NULL, N_("_Templates..."), NULL, NULL, G_CALLBACK(prefs_template_open_cb) },
+       {"Configuration/Actions",                    NULL, N_("_Actions..."), NULL, NULL, G_CALLBACK(prefs_actions_open_cb) },
+       {"Configuration/Tags",                       NULL, N_("Tag_s..."), NULL, NULL, G_CALLBACK(prefs_tags_open_cb) },
+       /* {"Configuration/---",                     NULL, "---", NULL, NULL, NULL }, */
+       {"Configuration/Plugins",                    NULL, N_("Plu_gins..."), NULL, NULL, G_CALLBACK(plugins_open_cb) },
 
 /* Help menu */
-       {"Help/Manual",                         NULL, N_("_Manual"), NULL, NULL, G_CALLBACK(manual_open_cb) }, 
-       {"Help/FAQ",                            NULL, N_("_Online User-contributed FAQ"), NULL, NULL, G_CALLBACK(manual_faq_open_cb) }, 
-       {"Help/IconLegend",                     NULL, N_("Icon _Legend"), NULL, NULL, G_CALLBACK(legend_open_cb) }, 
+       {"Help/Manual",                              NULL, N_("_Manual"), NULL, NULL, G_CALLBACK(manual_open_cb) }, 
+       {"Help/FAQ",                                 NULL, N_("_Online User-contributed FAQ"), NULL, NULL, G_CALLBACK(manual_faq_open_cb) }, 
+       {"Help/IconLegend",                          NULL, N_("Icon _Legend"), NULL, NULL, G_CALLBACK(legend_open_cb) }, 
 #ifdef G_OS_WIN32
-       {"Help/SetDefault",                     NULL, N_("Set as default client"), NULL, NULL, G_CALLBACK(set_default_client_cb) }, 
+       {"Help/SetDefault",                          NULL, N_("Set as default client"), NULL, NULL, G_CALLBACK(set_default_client_cb) }, 
 #endif
-       {"Help/---",                            NULL, "---" }, 
-       {"Help/About",                          NULL, N_("_About"), NULL, NULL, G_CALLBACK(about_cb) }, 
+       {"Help/---",                                 NULL, "---", NULL, NULL, NULL }, 
+       {"Help/About",                               NULL, N_("_About"), NULL, NULL, G_CALLBACK(about_cb) }, 
 };
 
 static GtkToggleActionEntry mainwin_toggle_entries[] = {
-       {"File/OfflineMode",                    NULL, N_("Offline _mode"), "<control>W", NULL, G_CALLBACK(toggle_work_offline_cb) }, /*toggle*/
-       {"View/ShowHide/MessageView",           NULL, N_("_Message view"), "V", NULL, G_CALLBACK(toggle_message_cb) }, /* toggle */
+       {"File/OfflineMode",                     NULL, N_("Offline _mode"), "<control>W", NULL, G_CALLBACK(toggle_work_offline_cb), FALSE }, /*toggle*/
+       {"View/ShowHide/MenuBar",                NULL, N_("Men_ubar"), "<control>F12", NULL, G_CALLBACK(toggle_menubar_cb), FALSE }, /* toggle */
+       {"View/ShowHide/MessageView",            NULL, N_("_Message view"), "V", NULL, G_CALLBACK(toggle_message_cb), FALSE }, /* toggle */
 #ifndef GENERIC_UMPC
-       {"View/ShowHide/StatusBar",             NULL, N_("Status _bar"), NULL, NULL, G_CALLBACK(toggle_statusbar_cb) }, /* toggle */
+       {"View/ShowHide/StatusBar",              NULL, N_("Status _bar"), NULL, NULL, G_CALLBACK(toggle_statusbar_cb), FALSE }, /* toggle */
 #endif
-       {"View/ShowHide/ColumnHeaders",         NULL, N_("Column headers"), NULL, NULL, G_CALLBACK(toggle_col_headers_cb) }, /* toggle */
-       {"View/ThreadView",                     NULL, N_("Th_read view"), "<control>T", NULL, G_CALLBACK(thread_cb) }, /* toggle */
-       {"View/HideReadThreads",                NULL, N_("Hide read threads"), NULL, NULL, G_CALLBACK(hide_read_threads) }, /* toggle */
-       {"View/HideReadMessages",               NULL, N_("_Hide read messages"), NULL, NULL, G_CALLBACK(hide_read_messages) }, /* toggle */
-       {"View/HideDelMessages",                NULL, N_("Hide deleted messages"), NULL, NULL, G_CALLBACK(hide_del_messages) }, /* toggle */
-       {"View/FullScreen",                     NULL, N_("_Fullscreen"), "F11", NULL, G_CALLBACK(toggle_fullscreen_cb) }, /* toggle */
-       {"View/AllHeaders",                     NULL, N_("Show all _headers"), "<control>H", NULL, G_CALLBACK(show_all_header_cb) }, /* toggle */
-       {"View/Quotes/CollapseAll",             NULL, N_("_Collapse all"), "<control><shift>Q", NULL, G_CALLBACK(hide_quotes_cb) }, /* 1 toggle */
-       {"View/Quotes/Collapse2",               NULL, N_("Collapse from level _2"), NULL, NULL, G_CALLBACK(hide_quotes_cb) }, /* 2 toggle */
-       {"View/Quotes/Collapse3",               NULL, N_("Collapse from level _3"), NULL, NULL, G_CALLBACK(hide_quotes_cb) }, /* 3 toggle */
+       {"View/ShowHide/ColumnHeaders",          NULL, N_("Column headers"), NULL, NULL, G_CALLBACK(toggle_col_headers_cb), FALSE }, /* toggle */
+       {"View/ThreadView",                      NULL, N_("Th_read view"), "<control>T", NULL, G_CALLBACK(thread_cb), FALSE }, /* toggle */
+       {"View/HideReadThreads",                 NULL, N_("Hide read threads"), NULL, NULL, G_CALLBACK(hide_read_threads), FALSE }, /* toggle */
+       {"View/HideReadMessages",                NULL, N_("_Hide read messages"), NULL, NULL, G_CALLBACK(hide_read_messages), FALSE }, /* toggle */
+       {"View/HideDelMessages",                 NULL, N_("Hide deleted messages"), NULL, NULL, G_CALLBACK(hide_del_messages), FALSE }, /* toggle */
+       {"View/FullScreen",                      NULL, N_("_Fullscreen"), "F11", NULL, G_CALLBACK(toggle_fullscreen_cb), FALSE }, /* toggle */
+       {"View/AllHeaders",                      NULL, N_("Show all _headers"), "<control>H", NULL, G_CALLBACK(show_all_header_cb), FALSE }, /* toggle */
+       {"View/Quotes/CollapseAll",              NULL, N_("_Collapse all"), "<control><shift>Q", NULL, G_CALLBACK(hide_quotes_cb), FALSE }, /* 1 toggle */
+       {"View/Quotes/Collapse2",                NULL, N_("Collapse from level _2"), NULL, NULL, G_CALLBACK(hide_quotes_cb), FALSE }, /* 2 toggle */
+       {"View/Quotes/Collapse3",                NULL, N_("Collapse from level _3"), NULL, NULL, G_CALLBACK(hide_quotes_cb), FALSE }, /* 3 toggle */
 };
 
 static GtkRadioActionEntry mainwin_showhide_radio_entries[] = { /* toggle_toolbar_cb */
-       {"View/ShowHide/Toolbar/TextBelowIcon", NULL, N_("Text _below icons"), NULL, NULL, TOOLBAR_BOTH }, /* radio TOOLBAR_BOTH */
-       {"View/ShowHide/Toolbar/TextBesideIcon",NULL, N_("Text be_side icons"), NULL, NULL, TOOLBAR_BOTH_HORIZ }, /* radio TOOLBAR_BOTH_HORIZ */
-       {"View/ShowHide/Toolbar/IconOnly",      NULL, N_("_Icons only"), NULL, NULL, TOOLBAR_ICON }, /* radio TOOLBAR_ICON */
-       {"View/ShowHide/Toolbar/TextOnly",      NULL, N_("_Text only"), NULL, NULL, TOOLBAR_TEXT }, /* radio TOOLBAR_TEXT */
+       {"View/ShowHide/Toolbar/TextBelowIcon",  NULL, N_("Text _below icons"), NULL, NULL, TOOLBAR_BOTH }, /* radio TOOLBAR_BOTH */
+       {"View/ShowHide/Toolbar/TextBesideIcon", NULL, N_("Text be_side icons"), NULL, NULL, TOOLBAR_BOTH_HORIZ }, /* radio TOOLBAR_BOTH_HORIZ */
+       {"View/ShowHide/Toolbar/IconOnly",       NULL, N_("_Icons only"), NULL, NULL, TOOLBAR_ICON }, /* radio TOOLBAR_ICON */
+       {"View/ShowHide/Toolbar/TextOnly",       NULL, N_("_Text only"), NULL, NULL, TOOLBAR_TEXT }, /* radio TOOLBAR_TEXT */
 #ifndef GENERIC_UMPC
-       {"View/ShowHide/Toolbar/Hide",          NULL, N_("_Hide"), NULL, NULL, TOOLBAR_NONE }, /* radio TOOLBAR_NONE */
+       {"View/ShowHide/Toolbar/Hide",           NULL, N_("_Hide"), NULL, NULL, TOOLBAR_NONE }, /* radio TOOLBAR_NONE */
 #endif
 };
 #ifndef GENERIC_UMPC
 static GtkRadioActionEntry mainwin_layout_radio_entries[] = { /* set_layout_cb */
-       {"View/Layout/Standard",                NULL, N_("_Standard"), NULL, NULL, NORMAL_LAYOUT }, /* radio NORMAL_LAYOUT */
-       {"View/Layout/ThreeColumns",            NULL, N_("_Three columns"), NULL, NULL, VERTICAL_LAYOUT }, /* radio VERTICAL_LAYOUT */
-       {"View/Layout/WideMessage",             NULL, N_("_Wide message"), NULL, NULL, WIDE_LAYOUT }, /* radio WIDE_LAYOUT */
-       {"View/Layout/WideMessageList",         NULL, N_("W_ide message list"), NULL, NULL, WIDE_MSGLIST_LAYOUT }, /* radio WIDE_MSGLIST_LAYOUT */
-       {"View/Layout/SmallScreen",             NULL, N_("S_mall screen"), NULL, NULL, SMALL_LAYOUT }, /* radio SMALL_LAYOUT */
+       {"View/Layout/Standard",                 NULL, N_("_Standard"), NULL, NULL, NORMAL_LAYOUT }, /* radio NORMAL_LAYOUT */
+       {"View/Layout/ThreeColumns",             NULL, N_("_Three columns"), NULL, NULL, VERTICAL_LAYOUT }, /* radio VERTICAL_LAYOUT */
+       {"View/Layout/WideMessage",              NULL, N_("_Wide message"), NULL, NULL, WIDE_LAYOUT }, /* radio WIDE_LAYOUT */
+       {"View/Layout/WideMessageList",          NULL, N_("W_ide message list"), NULL, NULL, WIDE_MSGLIST_LAYOUT }, /* radio WIDE_MSGLIST_LAYOUT */
+       {"View/Layout/SmallScreen",              NULL, N_("S_mall screen"), NULL, NULL, SMALL_LAYOUT }, /* radio SMALL_LAYOUT */
 };
 #endif
 static GtkRadioActionEntry mainwin_sort_radio_entries[] = { /* sort_summary_cb */
-       {"View/Sort/Number",                    NULL, N_("By _number"), NULL, NULL, SORT_BY_NUMBER }, /* radio SORT_BY_NUMBER */
-       {"View/Sort/Size",                      NULL, N_("By s_ize"), NULL, NULL, SORT_BY_SIZE }, /* radio SORT_BY_SIZE */
-       {"View/Sort/Date",                      NULL, N_("By _date"), NULL, NULL, SORT_BY_DATE }, /* radio SORT_BY_DATE */
-       {"View/Sort/ThreadDate",                NULL, N_("By thread date"), NULL, NULL, SORT_BY_THREAD_DATE }, /* radio SORT_BY_THREAD_DATE */
-       {"View/Sort/From",                      NULL, N_("By _From"), NULL, NULL, SORT_BY_FROM }, /* radio SORT_BY_FROM */
-       {"View/Sort/To",                        NULL, N_("By _To"), NULL, NULL, SORT_BY_TO }, /* radio SORT_BY_TO */
-       {"View/Sort/Subject",                   NULL, N_("By s_ubject"), NULL, NULL, SORT_BY_SUBJECT }, /* radio SORT_BY_SUBJECT */
-       {"View/Sort/Color",                     NULL, N_("By _color label"), NULL, NULL, SORT_BY_LABEL }, /* radio SORT_BY_LABEL */
-       {"View/Sort/Tag",                       NULL, N_("By tag"), NULL, NULL, SORT_BY_TAGS }, /* radio SORT_BY_TAGS */
-       {"View/Sort/Mark",                      NULL, N_("By _mark"), NULL, NULL, SORT_BY_MARK }, /* radio SORT_BY_MARK */
-       {"View/Sort/Status",                    NULL, N_("By _status"), NULL, NULL, SORT_BY_STATUS }, /* radio SORT_BY_STATUS */
-       {"View/Sort/Attachment",                NULL, N_("By a_ttachment"), NULL, NULL, SORT_BY_MIME }, /* radio SORT_BY_MIME */
-       {"View/Sort/Score",                     NULL, N_("By score"), NULL, NULL, SORT_BY_SCORE }, /* radio SORT_BY_SCORE */
-       {"View/Sort/Locked",                    NULL, N_("By locked"), NULL, NULL, SORT_BY_LOCKED }, /* radio SORT_BY_LOCKED */
-       {"View/Sort/DontSort",                  NULL, N_("D_on't sort"), NULL, NULL, SORT_BY_NONE }, /* radio SORT_BY_NONE */
+       {"View/Sort/Number",                     NULL, N_("By _number"), NULL, NULL, SORT_BY_NUMBER }, /* radio SORT_BY_NUMBER */
+       {"View/Sort/Size",                       NULL, N_("By s_ize"), NULL, NULL, SORT_BY_SIZE }, /* radio SORT_BY_SIZE */
+       {"View/Sort/Date",                       NULL, N_("By _date"), NULL, NULL, SORT_BY_DATE }, /* radio SORT_BY_DATE */
+       {"View/Sort/ThreadDate",                 NULL, N_("By thread date"), NULL, NULL, SORT_BY_THREAD_DATE }, /* radio SORT_BY_THREAD_DATE */
+       {"View/Sort/From",                       NULL, N_("By _From"), NULL, NULL, SORT_BY_FROM }, /* radio SORT_BY_FROM */
+       {"View/Sort/To",                         NULL, N_("By _To"), NULL, NULL, SORT_BY_TO }, /* radio SORT_BY_TO */
+       {"View/Sort/Subject",                    NULL, N_("By s_ubject"), NULL, NULL, SORT_BY_SUBJECT }, /* radio SORT_BY_SUBJECT */
+       {"View/Sort/Color",                      NULL, N_("By _color label"), NULL, NULL, SORT_BY_LABEL }, /* radio SORT_BY_LABEL */
+       {"View/Sort/Tag",                        NULL, N_("By tag"), NULL, NULL, SORT_BY_TAGS }, /* radio SORT_BY_TAGS */
+       {"View/Sort/Mark",                       NULL, N_("By _mark"), NULL, NULL, SORT_BY_MARK }, /* radio SORT_BY_MARK */
+       {"View/Sort/Status",                     NULL, N_("By _status"), NULL, NULL, SORT_BY_STATUS }, /* radio SORT_BY_STATUS */
+       {"View/Sort/Attachment",                 NULL, N_("By a_ttachment"), NULL, NULL, SORT_BY_MIME }, /* radio SORT_BY_MIME */
+       {"View/Sort/Score",                      NULL, N_("By score"), NULL, NULL, SORT_BY_SCORE }, /* radio SORT_BY_SCORE */
+       {"View/Sort/Locked",                     NULL, N_("By locked"), NULL, NULL, SORT_BY_LOCKED }, /* radio SORT_BY_LOCKED */
+       {"View/Sort/DontSort",                   NULL, N_("D_on't sort"), NULL, NULL, SORT_BY_NONE }, /* radio SORT_BY_NONE */
 };
 
 static GtkRadioActionEntry mainwin_sorttype_radio_entries[] = { /* sort_summary_type_cb */
-       {"View/Sort/Ascending",                 NULL, N_("Ascending"), NULL, NULL, SORT_ASCENDING }, /* radio SORT_ASCENDING */
-       {"View/Sort/Descending",                NULL, N_("Descending"), NULL, NULL, SORT_DESCENDING }, /* radio SORT_DESCENDING */
+       {"View/Sort/Ascending",                  NULL, N_("Ascending"), NULL, NULL, SORT_ASCENDING }, /* radio SORT_ASCENDING */
+       {"View/Sort/Descending",                 NULL, N_("Descending"), NULL, NULL, SORT_DESCENDING }, /* radio SORT_DESCENDING */
 };
 
 static GtkRadioActionEntry mainwin_radio_enc_entries[] =
@@ -879,6 +893,7 @@ static GtkRadioActionEntry mainwin_radio_enc_entries[] =
        ENC_ACTION(CS_ISO_8859_9, C_ISO_8859_9, N_("Turkish (ISO-8859-_9)")), /* RADIO set_charset_cb */
        ENC_ACTION("Cyrillic/"CS_ISO_8859_5, C_ISO_8859_5, "ISO-8859-_5"), /* RADIO set_charset_cb */
        ENC_ACTION("Cyrillic/"CS_KOI8_R, C_KOI8_R, "KOI8-_R"), /* RADIO set_charset_cb */
+       ENC_ACTION("Cyrillic/"CS_MACCYR, C_MACCYR, "_Mac-Cyrillic"), /* RADIO set_charset_cb */
        ENC_ACTION("Cyrillic/"CS_KOI8_U, C_KOI8_U, "KOI8-_U"), /* RADIO set_charset_cb */
        ENC_ACTION("Cyrillic/"CS_WINDOWS_1251, C_WINDOWS_1251, "Windows-1251"), /* RADIO set_charset_cb */
        ENC_ACTION("Japanese/"CS_ISO_2022_JP, C_ISO_2022_JP, "ISO-2022-_JP"), /* RADIO set_charset_cb */
@@ -907,27 +922,8 @@ static GtkRadioActionEntry mainwin_radio_dec_entries[] =
 };
 
 static gboolean offline_ask_sync = TRUE;
-static guint lastkey;
 static gboolean is_obscured = FALSE;
 
-static gboolean main_window_accel_activate (GtkAccelGroup *accelgroup,
-                                            GObject *arg1,
-                                            guint value,
-                                            GdkModifierType mod,
-                                            gpointer user_data) 
-{
-       MainWindow *mainwin = (MainWindow *)user_data;
-
-       if (mainwin->summaryview &&
-           mainwin->summaryview->quicksearch &&
-           quicksearch_has_focus(mainwin->summaryview->quicksearch) &&
-           (mod == 0 || mod == GDK_SHIFT_MASK)) {
-               quicksearch_pass_key(mainwin->summaryview->quicksearch, lastkey, mod);
-               return TRUE;
-       }
-       return FALSE;
-}
-
 #define N_COLOR_LABELS colorlabel_get_color_count()
 
 static void mainwindow_colorlabel_menu_item_activate_item_cb(GtkMenuItem *menu_item,
@@ -985,7 +981,7 @@ static void mainwindow_colorlabel_menu_item_activate_item_cb(GtkMenuItem *menu_i
                        }
                }
        } else
-               g_warning("invalid number of color elements (%d)\n", n);
+               g_warning("invalid number of color elements (%d)", n);
 
        g_slist_free(sel);
        /* reset "dont_toggle" state */
@@ -1241,7 +1237,7 @@ static gint mainwin_tag_cmp_list(gconstpointer a, gconstpointer b)
                return tag_b == NULL ? 0:1;
        
        if (tag_b == NULL)
-               return tag_a == NULL ? 0:1;
+               return 1;
  
        return g_utf8_collate(tag_a, tag_b);
 }
@@ -1365,14 +1361,19 @@ static gboolean mainwindow_key_pressed (GtkWidget *widget, GdkEventKey *event,
                                    gpointer data)
 {
        MainWindow *mainwin = (MainWindow*) data;
-       
+
        if (!mainwin || !event) 
                return FALSE;
 
        if (quicksearch_has_focus(mainwin->summaryview->quicksearch))
        {
-               lastkey = event->keyval;
-               return FALSE;
+               GtkWidget *entry =
+                       quicksearch_get_entry(mainwin->summaryview->quicksearch);
+               gboolean handled;
+               g_signal_emit_by_name(entry, "key-press-event", event, &handled);
+               if (handled) {
+                       return TRUE;
+               }
        }
 
        switch (event->keyval) {
@@ -1393,7 +1394,7 @@ static gboolean mainwindow_key_pressed (GtkWidget *widget, GdkEventKey *event,
                                    && mainwin->summaryview->folder_item->total_msgs == 0))) {
                                g_signal_stop_emission_by_name(G_OBJECT(widget), 
                                               "key_press_event");
-                               folderview_select_next_unread(mainwin->folderview, TRUE);
+                               folderview_select_next_with_flag(mainwin->folderview, MSG_UNREAD);
                        }
                }
                break;
@@ -1446,7 +1447,7 @@ MainWindow *main_window_create()
 
        /* main window */
        window = GTK_WIDGET(gtkut_window_new(GTK_WINDOW_TOPLEVEL, "mainwindow"));
-       gtk_window_set_title(GTK_WINDOW(window), PROG_VERSION_FRIENDLY);
+       gtk_window_set_title(GTK_WINDOW(window), PROG_VERSION);
        gtk_window_set_resizable(GTK_WINDOW(window), TRUE);
 #ifdef GENERIC_UMPC
        prefs_common.layout_mode = SMALL_LAYOUT;
@@ -1535,7 +1536,6 @@ MainWindow *main_window_create()
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Edit", "Copy", "Edit/Copy", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Edit", "SelectAll", "Edit/SelectAll", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Edit", "SelectThread", "Edit/SelectThread", GTK_UI_MANAGER_MENUITEM)
-       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Edit", "DeleteThread", "Edit/DeleteThread", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Edit", "Separator1", "Edit/---", GTK_UI_MANAGER_SEPARATOR)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Edit", "Find", "Edit/Find", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Edit", "SearchFolder", "Edit/SearchFolder", GTK_UI_MANAGER_MENUITEM)
@@ -1543,6 +1543,7 @@ MainWindow *main_window_create()
 
 /* View menu */
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "ShowHide", "View/ShowHide", GTK_UI_MANAGER_MENU)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/ShowHide", "MenuBar", "View/ShowHide/MenuBar", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/ShowHide", "Toolbar", "View/ShowHide/Toolbar", GTK_UI_MANAGER_MENU)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/ShowHide/Toolbar", "TextBelowIcon", "View/ShowHide/Toolbar/TextBelowIcon", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/ShowHide/Toolbar", "TextBesideIcon", "View/ShowHide/Toolbar/TextBesideIcon", GTK_UI_MANAGER_MENUITEM)
@@ -1624,7 +1625,7 @@ MainWindow *main_window_create()
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "ParentMessage", "View/Goto/ParentMessage", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "Separator7", "View/Goto/---", GTK_UI_MANAGER_SEPARATOR)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "NextUnreadFolder", "View/Goto/NextUnreadFolder", GTK_UI_MANAGER_MENUITEM)
-       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "OtherFolder", "View/Goto/OtherFolder", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "Folder", "View/Goto/Folder", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "Separator8", "View/Goto/---", GTK_UI_MANAGER_SEPARATOR)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "NextPart", "View/Goto/NextPart", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "PrevPart", "View/Goto/PrevPart", GTK_UI_MANAGER_MENUITEM)
@@ -1668,6 +1669,7 @@ MainWindow *main_window_create()
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding", "Cyrillic", "View/Encoding/Cyrillic", GTK_UI_MANAGER_MENU)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Cyrillic", CS_ISO_8859_5, "View/Encoding/Cyrillic/"CS_ISO_8859_5, GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Cyrillic", CS_KOI8_R, "View/Encoding/Cyrillic/"CS_KOI8_R, GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Cyrillic", CS_MACCYR, "View/Encoding/Cyrillic/"CS_MACCYR, GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Cyrillic", CS_KOI8_U, "View/Encoding/Cyrillic/"CS_KOI8_U, GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Cyrillic", CS_WINDOWS_1251, "View/Encoding/Cyrillic/"CS_WINDOWS_1251, GTK_UI_MANAGER_MENUITEM)
 
@@ -1760,6 +1762,8 @@ MainWindow *main_window_create()
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Copy", "Message/Copy", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Trash", "Message/Trash", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Delete", "Message/Delete", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "TrashThread", "Message/TrashThread", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "DeleteThread", "Message/DeleteThread", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "CancelNews", "Message/CancelNews", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Separator4", "Message/---", GTK_UI_MANAGER_SEPARATOR)
 
@@ -1767,10 +1771,11 @@ MainWindow *main_window_create()
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "Mark", "Message/Mark/Mark", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "Unmark", "Message/Mark/Unmark", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "Separator1", "Message/Mark/---", GTK_UI_MANAGER_SEPARATOR)
-       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "MarkUnread", "Message/Mark/MarkUnread", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "MarkRead", "Message/Mark/MarkRead", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "MarkUnread", "Message/Mark/MarkUnread", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "Separator2", "Message/Mark/---", GTK_UI_MANAGER_SEPARATOR)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "MarkAllRead", "Message/Mark/MarkAllRead", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "MarkAllUnread", "Message/Mark/MarkAllUnread", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "Separator3", "Message/Mark/---", GTK_UI_MANAGER_SEPARATOR)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "IgnoreThread", "Message/Mark/IgnoreThread", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "UnignoreThread", "Message/Mark/UnignoreThread", GTK_UI_MANAGER_MENUITEM)
@@ -1834,12 +1839,13 @@ MainWindow *main_window_create()
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "SSLCertificates", "Tools/SSLCertificates", GTK_UI_MANAGER_MENUITEM)
 #endif
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "Separator7", "Tools/---", GTK_UI_MANAGER_SEPARATOR)
-#ifndef G_OS_WIN32
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "FilteringLog", "Tools/FilteringLog", GTK_UI_MANAGER_MENUITEM)
-#endif
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "NetworkLog", "Tools/NetworkLog", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "Separator8", "Tools/---", GTK_UI_MANAGER_SEPARATOR)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "ForgetSessionPasswords", "Tools/ForgetSessionPasswords", GTK_UI_MANAGER_MENUITEM)
+#ifndef PASSWORD_CRYPTO_OLD
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "ForgetMasterPassphrase", "Tools/ForgetMasterPassphrase", GTK_UI_MANAGER_MENUITEM)
+#endif
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "Separator9", "Tools/---", GTK_UI_MANAGER_SEPARATOR)
 
 /* Configuration menu */
@@ -1874,7 +1880,10 @@ MainWindow *main_window_create()
 
 
        menubar = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu");
-       gtk_widget_show_all(menubar);
+       if (prefs_common.mainwin_menubar)
+               gtk_widget_show_all(menubar);
+       else
+               gtk_widget_hide(menubar);
        gtk_window_add_accel_group(GTK_WINDOW(window), gtk_ui_manager_get_accel_group(mainwin->ui_manager));
 
        gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, TRUE, 0);
@@ -1943,10 +1952,10 @@ MainWindow *main_window_create()
        gtk_widget_set_size_request(progressbar, 120, 1);
        gtk_box_pack_start(GTK_BOX(hbox_stat), progressbar, FALSE, FALSE, 0);
 
-       online_pixmap = stock_pixmap_widget(hbox_stat, STOCK_PIXMAP_ONLINE);
-       offline_pixmap = stock_pixmap_widget(hbox_stat, STOCK_PIXMAP_OFFLINE);
+       online_pixmap = stock_pixmap_widget(STOCK_PIXMAP_ONLINE);
+       offline_pixmap = stock_pixmap_widget(STOCK_PIXMAP_OFFLINE);
        online_switch = gtk_button_new ();
-       gtkut_widget_set_can_focus(online_switch, FALSE);
+       gtk_widget_set_can_focus(online_switch, FALSE);
        CLAWS_SET_TIP(online_switch, 
                             _("You are online. Click the icon to go offline"));
        offline_switch = gtk_button_new ();
@@ -1966,7 +1975,7 @@ MainWindow *main_window_create()
 
        ac_button = gtk_button_new();
        CLAWS_SET_TIP(ac_button, _("Select account"));
-       gtkut_widget_set_can_focus(ac_button, FALSE);
+       gtk_widget_set_can_focus(ac_button, FALSE);
        gtk_widget_set_size_request(ac_button, -1, 0);
        gtk_box_pack_end(GTK_BOX(hbox_stat), ac_button, FALSE, FALSE, 0);
        g_signal_connect(G_OBJECT(ac_button), "button_press_event",
@@ -2073,16 +2082,12 @@ MainWindow *main_window_create()
        summaryview->color_dim.red = summaryview->color_dim.green =
                summaryview->color_dim.blue = COLOR_DIM;
 
-       gtkut_convert_int_to_gdk_color(prefs_common.color_new,
+       gtkut_convert_int_to_gdk_color(prefs_common.color[COL_NEW],
                                       &folderview->color_new);
 
-       gtkut_convert_int_to_gdk_color(prefs_common.tgt_folder_col,
+       gtkut_convert_int_to_gdk_color(prefs_common.color[COL_TGT_FOLDER],
                                       &folderview->color_op);
 
-       summaryview->color_important.red = 0;
-       summaryview->color_important.green = 0;
-       summaryview->color_important.blue = (guint16)65535;
-
        color[0] = summaryview->color_marked;
        color[1] = summaryview->color_dim;
        color[2] = folderview->color_new;
@@ -2093,7 +2098,7 @@ MainWindow *main_window_create()
        gdk_colormap_alloc_colors(colormap, color, 4, FALSE, TRUE, success);
        for (i = 0; i < 4; i++) {
                if (success[i] == FALSE)
-                       g_warning("MainWindow: color allocation %d failed\n", i);
+                       g_warning("MainWindow: color allocation %d failed", i);
        }
 #endif
 
@@ -2156,10 +2161,7 @@ MainWindow *main_window_create()
 #define        ADD_MENU_ACCEL_GROUP_TO_WINDOW(menu,win)                        \
        gtk_window_add_accel_group                                      \
                (GTK_WINDOW(win),                                       \
-                gtk_ui_manager_get_accel_group(gtkut_ui_manager()));   \
-       g_signal_connect(G_OBJECT(gtk_ui_manager_get_accel_group(gtkut_ui_manager())), \
-                       "accel_activate",                               \
-                       G_CALLBACK(main_window_accel_activate), mainwin);
+                gtk_ui_manager_get_accel_group(gtkut_ui_manager()));
 
        ADD_MENU_ACCEL_GROUP_TO_WINDOW(summaryview->popupmenu, mainwin->window);
        
@@ -2206,6 +2208,9 @@ MainWindow *main_window_create()
                        "Menu/View/FullScreen",
                        TRUE);
        }
+       if (prefs_common.mainwin_menubar)
+               cm_toggle_menu_set_active_full(mainwin->ui_manager,"Menu/View/ShowHide/MenuBar", TRUE);
+       
        return mainwin;
 }
 
@@ -2304,17 +2309,17 @@ static gboolean reflect_prefs_timeout_cb(gpointer data)
                        folderview_reinit_fonts(mainwin->folderview);
                        summary_reflect_prefs_pixmap_theme(mainwin->summaryview);
                        foldersel_reflect_prefs_pixmap_theme();
-#ifndef USE_NEW_ADDRBOOK
+#ifndef USE_ALT_ADDRBOOK
                        addressbook_reflect_prefs_pixmap_theme();
 #endif
 #ifndef GENERIC_UMPC
-                       pixmap = stock_pixmap_widget(mainwin->hbox_stat, STOCK_PIXMAP_ONLINE);
+                       pixmap = stock_pixmap_widget(STOCK_PIXMAP_ONLINE);
                        gtk_container_remove(GTK_CONTAINER(mainwin->online_switch), 
                                             mainwin->online_pixmap);
                        gtk_container_add (GTK_CONTAINER(mainwin->online_switch), pixmap);
                        gtk_widget_show(pixmap);
                        mainwin->online_pixmap = pixmap;
-                       pixmap = stock_pixmap_widget(mainwin->hbox_stat, STOCK_PIXMAP_OFFLINE);
+                       pixmap = stock_pixmap_widget(STOCK_PIXMAP_OFFLINE);
                        gtk_container_remove(GTK_CONTAINER(mainwin->offline_switch), 
                                             mainwin->offline_pixmap);
                        gtk_container_add (GTK_CONTAINER(mainwin->offline_switch), pixmap);
@@ -2382,7 +2387,6 @@ static gboolean main_window_reflect_tags_changes_real(gpointer data)
        MainWindow *mainwin = (MainWindow *)data;
 
        if (summary_is_locked(mainwin->summaryview)) {
-               tags_tag = 0;
                return TRUE;
        }
        /* re-create tags submenu */
@@ -2622,9 +2626,9 @@ static void main_window_show_cur_account(MainWindow *mainwin)
                           : _("none"));
 
        if (cur_account)
-               buf = g_strdup_printf("%s - %s", ac_name, PROG_VERSION_FRIENDLY);
+               buf = g_strdup_printf("%s - %s", ac_name, PROG_VERSION);
        else
-               buf = g_strdup(PROG_VERSION_FRIENDLY);
+               buf = g_strdup(PROG_VERSION);
        gtk_window_set_title(GTK_WINDOW(mainwin->window), buf);
        g_free(buf);
 
@@ -2877,11 +2881,13 @@ gboolean main_window_empty_trash(MainWindow *mainwin, gboolean confirm, gboolean
                if (for_quit)
                        val = alertpanel(_("Empty trash"),
                               _("Delete all messages in trash folders?"),
-                              GTK_STOCK_NO, "+" GTK_STOCK_YES, _("Don't quit"));
+                              GTK_STOCK_NO, GTK_STOCK_YES, _("Don't quit"),
+                                                ALERTFOCUS_SECOND);
                else
                        val = alertpanel(_("Empty trash"),
                               _("Delete all messages in trash folders?"),
-                              GTK_STOCK_NO, "+" GTK_STOCK_YES, NULL);
+                              GTK_STOCK_NO, GTK_STOCK_YES, NULL,
+                                                ALERTFOCUS_SECOND);
                if (val == G_ALERTALTERNATE) {
                        debug_print("will empty trash\n");
                } else if (val == G_ALERTDEFAULT) {
@@ -2897,7 +2903,7 @@ gboolean main_window_empty_trash(MainWindow *mainwin, gboolean confirm, gboolean
 
        if (mainwin->summaryview->folder_item &&
            mainwin->summaryview->folder_item->stype == F_TRASH)
-               gtk_widget_grab_focus(mainwin->folderview->ctree);
+               folderview_grab_focus(mainwin->folderview);
        return TRUE;
 }
 
@@ -2952,7 +2958,7 @@ SensitiveCondMask main_window_get_current_state(MainWindow *mainwin)
 
        if (mainwin->lock_count == 0 && !claws_is_starting())
                UPDATE_STATE(M_UNLOCKED);
-       if (selection != SUMMARY_NONE)
+       if (selection != SUMMARY_NONE && selection != SUMMARY_SELECTED_NONE)
                UPDATE_STATE(M_MSG_EXIST);
        if (item && item->path && folder_item_parent(item) && !item->no_select) {
                UPDATE_STATE(M_EXEC);
@@ -2990,6 +2996,10 @@ SensitiveCondMask main_window_get_current_state(MainWindow *mainwin)
             !folder_has_parent_of_type(mainwin->summaryview->folder_item, F_TRASH)))
                UPDATE_STATE(M_NOT_TRASH);
 
+       if (mainwin->summaryview->folder_item
+           && mainwin->summaryview->folder_item->stype != F_DRAFT)
+               UPDATE_STATE(M_NOT_DRAFT);
+
        if (prefs_common.actions_list && g_slist_length(prefs_common.actions_list))
                UPDATE_STATE(M_ACTIONS_EXIST);
 
@@ -3076,6 +3086,12 @@ SensitiveCondMask main_window_get_current_state(MainWindow *mainwin)
                        break;
                }
        }
+
+#ifndef PASSWORD_CRYPTO_OLD
+       if (master_passphrase_is_entered()) {
+               UPDATE_STATE(M_MASTER_PASSPHRASE);
+       }
+#endif
 #undef UPDATE_STATE
 
        return state;
@@ -3116,7 +3132,7 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
        gint i;
        gboolean mimepart_selected = FALSE;
 
-#define N_ENTRIES 83
+#define N_ENTRIES 88
        static struct {
                const gchar *entry;
                SensitiveCondMask cond;
@@ -3135,7 +3151,6 @@ do { \
        FILL_TABLE("Menu/File/Exit", M_UNLOCKED);
 
        FILL_TABLE("Menu/Edit/SelectThread", M_TARGET_EXIST, M_SUMMARY_ISLIST);
-       FILL_TABLE("Menu/Edit/DeleteThread", M_TARGET_EXIST, M_SUMMARY_ISLIST);
        FILL_TABLE("Menu/Edit/Find", M_SINGLE_TARGET_EXIST);
        FILL_TABLE("Menu/Edit/QuickSearch", M_IN_MSGLIST);
        FILL_TABLE("Menu/Edit/SearchFolder", M_TARGET_EXIST, M_SUMMARY_ISLIST);
@@ -3145,14 +3160,17 @@ do { \
        FILL_TABLE("Menu/View/ThreadView", M_EXEC, M_SUMMARY_ISLIST);
        FILL_TABLE("Menu/View/ExpandThreads", M_MSG_EXIST, M_SUMMARY_ISLIST);
        FILL_TABLE("Menu/View/CollapseThreads", M_MSG_EXIST, M_SUMMARY_ISLIST);
-       FILL_TABLE("Menu/View/HideReadThreads", M_HIDE_READ_THREADS, M_SUMMARY_ISLIST);
-       FILL_TABLE("Menu/View/HideReadMessages", M_HIDE_READ_MSG, M_SUMMARY_ISLIST);
-       FILL_TABLE("Menu/View/HideDelMessages", M_SUMMARY_ISLIST);
+       FILL_TABLE("Menu/View/HideReadThreads", M_HIDE_READ_THREADS, M_SUMMARY_ISLIST, M_NOT_DRAFT);
+       FILL_TABLE("Menu/View/HideReadMessages", M_HIDE_READ_MSG, M_SUMMARY_ISLIST, M_NOT_DRAFT);
+       FILL_TABLE("Menu/View/HideDelMessages", M_SUMMARY_ISLIST, M_NOT_DRAFT);
        FILL_TABLE("Menu/View/Goto/Prev", M_MSG_EXIST);
        FILL_TABLE("Menu/View/Goto/Next", M_MSG_EXIST);
        FILL_TABLE("Menu/View/Goto/PrevUnread", M_MSG_EXIST);
+       FILL_TABLE("Menu/View/Goto/NextUnread", M_MSG_EXIST);
        FILL_TABLE("Menu/View/Goto/PrevNew", M_MSG_EXIST);
+       FILL_TABLE("Menu/View/Goto/NextNew", M_MSG_EXIST);
        FILL_TABLE("Menu/View/Goto/PrevMarked", M_MSG_EXIST);
+       FILL_TABLE("Menu/View/Goto/NextMarked", M_MSG_EXIST);
        FILL_TABLE("Menu/View/Goto/PrevLabeled", M_MSG_EXIST);
        FILL_TABLE("Menu/View/Goto/NextLabeled", M_MSG_EXIST);
        FILL_TABLE("Menu/View/Goto/ParentMessage", M_SINGLE_TARGET_EXIST);
@@ -3181,6 +3199,8 @@ do { \
        FILL_TABLE("Menu/Message/Copy", M_TARGET_EXIST, M_EXEC);
        FILL_TABLE("Menu/Message/Trash", M_TARGET_EXIST, M_ALLOW_DELETE, M_NOT_NEWS, M_NOT_TRASH);
        FILL_TABLE("Menu/Message/Delete", M_TARGET_EXIST, M_ALLOW_DELETE);
+       FILL_TABLE("Menu/Message/TrashThread", M_TARGET_EXIST, M_SUMMARY_ISLIST);
+       FILL_TABLE("Menu/Message/DeleteThread", M_TARGET_EXIST, M_SUMMARY_ISLIST);
        FILL_TABLE("Menu/Message/CancelNews", M_TARGET_EXIST, M_ALLOW_DELETE, M_NEWS);
        FILL_TABLE("Menu/Message/Mark", M_TARGET_EXIST, M_SUMMARY_ISLIST);
        FILL_TABLE("Menu/Message/Mark/MarkSpam", M_TARGET_EXIST, M_CAN_LEARN_SPAM);
@@ -3208,6 +3228,9 @@ do { \
        FILL_TABLE("Menu/Tools/Execute", M_DELAY_EXEC);
        FILL_TABLE("Menu/Tools/Expunge", M_DELETED_EXISTS);
        FILL_TABLE("Menu/Tools/ForgetSessionPasswords", M_SESSION_PASSWORDS);
+#ifndef PASSWORD_CRYPTO_OLD
+       FILL_TABLE("Menu/Tools/ForgetMasterPassphrase", M_MASTER_PASSPHRASE);
+#endif
        FILL_TABLE("Menu/Tools/DeleteDuplicates/SelFolder", M_MSG_EXIST, M_ALLOW_DELETE);
 
        FILL_TABLE("Menu/Configuration", M_UNLOCKED);
@@ -3302,7 +3325,7 @@ do { \
                cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/Sort/Descending", FALSE);
        }
 
-       if (mainwin->messageview 
+       if (mainwin->messageview
        &&  mainwin->messageview->mimeview
        &&  mainwin->messageview->mimeview->textview)
                cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/AllHeaders",
@@ -3310,17 +3333,21 @@ do { \
        cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/ThreadView", (state & main_window_get_mask(M_THREADED, -1)) != 0);
        cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/ExpandThreads", (state & main_window_get_mask(M_THREADED, -1)) != 0);
        cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/CollapseThreads", (state & main_window_get_mask(M_THREADED, -1)) != 0);
-       cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/HideReadThreads", (state & main_window_get_mask(M_THREADED, -1)) != 0);
+       cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/HideReadThreads", (state & main_window_get_mask(M_THREADED, -1)) != 0 && (state & main_window_get_mask(M_NOT_DRAFT, -1)) != 0);
        cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Quotes/CollapseAll", (prefs_common.hide_quotes == 1));
        cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Quotes/Collapse2", (prefs_common.hide_quotes == 2));
        cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Quotes/Collapse3", (prefs_common.hide_quotes == 3));
 
        if (mainwin->summaryview->folder_item && !mainwin->summaryview->folder_item->threaded)
                cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/HideReadThreads", FALSE);
-       if (mainwin->summaryview->folder_item && mainwin->summaryview->folder_item->hide_read_msgs)
+       if ((mainwin->summaryview->folder_item && mainwin->summaryview->folder_item->hide_read_msgs) ||
+           quicksearch_has_sat_predicate(mainwin->summaryview->quicksearch))
                cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/HideReadThreads", FALSE);
-       if (mainwin->summaryview->folder_item && mainwin->summaryview->folder_item->hide_read_threads)
+       if ((mainwin->summaryview->folder_item && mainwin->summaryview->folder_item->hide_read_threads) ||
+           quicksearch_has_sat_predicate(mainwin->summaryview->quicksearch))
                cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/HideReadMessages", FALSE);
+       if (quicksearch_has_sat_predicate(mainwin->summaryview->quicksearch))
+               cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/HideDelMessages", FALSE);
 
        cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/Goto/PrevHistory",
                messageview_nav_has_prev(mainwin->messageview));
@@ -3338,6 +3365,18 @@ do { \
        cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/Message/CheckSignature", 
                                   mimepart_selected && mainwin->messageview->mimeview->signed_part);
 
+       sensitive = TRUE;
+       if (mimepart_selected) {
+               MimeInfo *partinfo = messageview_get_selected_mime_part(mainwin->messageview);
+
+               if (partinfo && (partinfo->type == MIMETYPE_MESSAGE ||
+                                partinfo->type == MIMETYPE_IMAGE ||
+                                partinfo->type == MIMETYPE_MULTIPART)) {
+                       sensitive = FALSE;
+               }
+       }
+       cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/Part/AsText", sensitive);
+
        main_window_menu_callback_unblock(mainwin);
 }
 
@@ -3483,6 +3522,11 @@ static void get_url_part (const gchar **buffer, gchar *url_decoded)
                for (i = 0;
                     *buf != '>' && *buf != 0x00 && i < BUFFSIZE;
                        tmp[i++] = *(buf++));
+               if (*buf == 0) {
+                       *buffer = NULL;
+                       *url_decoded = '\0';
+                       return;
+               }
                buf++;
        }
        else  {
@@ -3623,7 +3667,7 @@ static void main_window_set_widgets(MainWindow *mainwin, LayoutType layout_mode)
        GtkWidget *vpaned;
        GtkWidget *vbox_body = mainwin->vbox_body;
        gboolean first_set = (mainwin->hpaned == NULL);
-       debug_print("Setting widgets... ");
+       debug_print("Setting widgets...\n");
 
 #ifndef GENERIC_UMPC
        mainwin->messageview->statusbar = mainwin->statusbar;
@@ -3828,7 +3872,7 @@ static void main_window_set_widgets(MainWindow *mainwin, LayoutType layout_mode)
                         mainwin);
        }
 
-       debug_print("done.\n");
+       debug_print("Setting widgets done.\n");
 }
 
 void main_window_destroy_all(void)
@@ -3838,8 +3882,7 @@ void main_window_destroy_all(void)
 
                /* free toolbar stuff */
                toolbar_clear_list(TOOLBAR_MAIN);
-               TOOLBAR_DESTROY_ACTIONS(mainwin->toolbar->action_list);
-               TOOLBAR_DESTROY_ITEMS(mainwin->toolbar->item_list);
+               toolbar_destroy(mainwin->toolbar);
 
                summaryview_destroy(mainwin->summaryview);
                mainwin->folderview->mainwin = NULL;
@@ -4009,7 +4052,7 @@ static void app_exit_cb(GtkAction *action, gpointer data)
 
        if (prefs_common.confirm_on_exit) {
                if (alertpanel(_("Exit"), _("Exit Claws Mail?"),
-                              GTK_STOCK_CANCEL, GTK_STOCK_QUIT,  NULL)
+                              GTK_STOCK_CANCEL, GTK_STOCK_QUIT,  NULL, ALERTFOCUS_FIRST)
                    != G_ALERTALTERNATE)
                        return;
                manage_window_focus_in(mainwin->window, NULL, NULL);
@@ -4077,7 +4120,15 @@ static void main_window_reply_cb(GtkAction *gaction, gpointer data)
 
        msginfo_list = summary_get_selection(mainwin->summaryview);
        cm_return_if_fail(msginfo_list != NULL);
-       compose_reply_from_messageview(msgview, msginfo_list, action);
+
+       if (!summary_has_opened_message(mainwin->summaryview)) {
+               compose_reply_from_messageview(NULL, msginfo_list, action);
+       } else if (summary_is_opened_message_selected(mainwin->summaryview)) {
+               compose_reply_from_messageview(msgview, msginfo_list, action);
+       } else {
+               compose_reply_from_messageview(msgview, NULL, action);
+       }
+
        g_slist_free(msginfo_list);
 }
 
@@ -4140,6 +4191,8 @@ static void set_layout_cb(GtkAction *action, GtkRadioAction *current, gpointer d
        mainwindow_reset_paned(GTK_PANED(mainwin->vpaned));
        if (old_layout_mode == SMALL_LAYOUT && layout_mode != SMALL_LAYOUT) {
                mainwindow_reset_paned(GTK_PANED(mainwin->hpaned));
+               if (layout_mode == VERTICAL_LAYOUT)
+                       mainwindow_reset_paned(GTK_PANED(mainwin->vpaned));
        }
        if (old_layout_mode != SMALL_LAYOUT && layout_mode == SMALL_LAYOUT) {
                mainwin_paned_show_first(GTK_PANED(mainwin->hpaned));
@@ -4167,6 +4220,8 @@ void main_window_toggle_work_offline (MainWindow *mainwin, gboolean offline,
                online_switch_clicked (GTK_BUTTON(mainwin->offline_switch), mainwin);
        offline_ask_sync = TRUE;
 
+       inc_reset_offline_override_timers();
+
        switching = FALSE;
 }
 
@@ -4199,7 +4254,7 @@ static void mainwindow_check_synchronise(MainWindow *mainwin, gboolean ask)
 
        if (offline_ask_sync && ask && alertpanel(_("Folder synchronisation"),
                        _("Do you want to synchronise your folders now?"),
-                       GTK_STOCK_CANCEL, _("+_Synchronise"), NULL) != G_ALERTALTERNATE)
+                       GTK_STOCK_CANCEL, _("_Synchronise"), NULL, ALERTFOCUS_SECOND) != G_ALERTALTERNATE)
                return;
        
        if (offline_ask_sync)
@@ -4258,15 +4313,14 @@ static void online_switch_clicked (GtkButton *btn, gpointer data)
 
 static void addressbook_open_cb(GtkAction *action, gpointer data)
 {
-#ifndef USE_NEW_ADDRBOOK
+#ifndef USE_ALT_ADDRBOOK
        addressbook_open(NULL);
 #else
        GError* error = NULL;
        
        addressbook_dbus_open(FALSE, &error);
        if (error) {
-               g_warning("Failed to open address book");
-               g_warning("%s", error->message);
+               g_warning("Failed to open address book: %s", error->message);
                g_error_free(error);
        }
 #endif
@@ -4361,6 +4415,19 @@ static void toggle_fullscreen_cb(GtkAction *action, gpointer data)
        }
 }
 
+static void toggle_menubar_cb(GtkAction *action, gpointer data)
+{
+       MainWindow *mainwin = (MainWindow *)data;
+       if (mainwin->menu_lock_count) return;
+       if (!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) {
+               gtk_widget_hide(GTK_WIDGET(mainwin->menubar));
+               prefs_common.mainwin_menubar = FALSE;
+       } else {
+               gtk_widget_show(GTK_WIDGET(mainwin->menubar));
+               prefs_common.mainwin_menubar = TRUE;
+       }
+}
+
 static void hide_quotes_cb(GtkAction *action, gpointer data)
 {
        MainWindow *mainwin = (MainWindow *)data;
@@ -4396,22 +4463,28 @@ static void unmark_cb(GtkAction *action, gpointer data)
        summary_unmark(mainwin->summaryview);
 }
 
+static void mark_as_read_cb(GtkAction *action, gpointer data)
+{
+       MainWindow *mainwin = (MainWindow *)data;
+       summary_mark_as_read(mainwin->summaryview);
+}
+
 static void mark_as_unread_cb(GtkAction *action, gpointer data)
 {
        MainWindow *mainwin = (MainWindow *)data;
        summary_mark_as_unread(mainwin->summaryview);
 }
 
-static void mark_as_read_cb(GtkAction *action, gpointer data)
+static void mark_all_read_cb(GtkAction *action, gpointer data)
 {
        MainWindow *mainwin = (MainWindow *)data;
-       summary_mark_as_read(mainwin->summaryview);
+       summary_mark_all_read(mainwin->summaryview, TRUE);
 }
 
-static void mark_all_read_cb(GtkAction *action, gpointer data)
+static void mark_all_unread_cb(GtkAction *action, gpointer data)
 {
        MainWindow *mainwin = (MainWindow *)data;
-       summary_mark_all_read(mainwin->summaryview);
+       summary_mark_all_unread(mainwin->summaryview, TRUE);
 }
 
 static void mark_as_spam_cb(GtkAction *action, gpointer data)
@@ -4589,29 +4662,26 @@ static void set_folder_display_item_cb(GtkAction *action, gpointer data)
 static void sort_summary_cb(GtkAction *action, GtkRadioAction *current, gpointer data)
 {
        MainWindow *mainwin = (MainWindow *)data;
-       FolderItem *item = mainwin->summaryview->folder_item;
        gint value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (current));
 
        if (mainwin->menu_lock_count) return;
 
-       if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (current)) && item) {
+       if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (current))) {
                summary_sort(mainwin->summaryview, (FolderSortKey)value,
-                            item->sort_type);
-               item->sort_key = value;
+                            mainwin->summaryview->sort_type);
        }
 }
 
 static void sort_summary_type_cb(GtkAction *gaction, GtkRadioAction *current, gpointer data)
 {
        MainWindow *mainwin = (MainWindow *)data;
-       FolderItem *item = mainwin->summaryview->folder_item;
        gint value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (current));
 
        if (mainwin->menu_lock_count) return;
 
-       if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (current)) && item)
+       if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (current)))
                summary_sort(mainwin->summaryview,
-                            item->sort_key, (FolderSortType)value);
+                            mainwin->summaryview->sort_key, (FolderSortType)value);
 }
 
 static void attract_by_subject_cb(GtkAction *action, gpointer data)
@@ -4620,24 +4690,50 @@ static void attract_by_subject_cb(GtkAction *action, gpointer data)
        summary_attract_by_subject(mainwin->summaryview);
 }
 
-static void delete_duplicated_cb(GtkAction *action, gpointer data)
+void mainwindow_delete_duplicated(MainWindow *mainwin)
 {
-       MainWindow *mainwin = (MainWindow *)data;
        FolderItem *item;
 
        item = folderview_get_selected_item(mainwin->folderview);
        if (item) {
+               gint result;
+
                main_window_cursor_wait(mainwin);
                STATUSBAR_PUSH(mainwin, _("Deleting duplicated messages..."));
-
-               folderutils_delete_duplicates(item, prefs_common.immediate_exec ?
+               result = folderutils_delete_duplicates(item, prefs_common.immediate_exec ?
                                              DELETE_DUPLICATES_REMOVE : DELETE_DUPLICATES_SETFLAG);
-
                STATUSBAR_POP(mainwin);
                main_window_cursor_normal(mainwin);
+
+               switch (result) {
+               case -1:
+                       break;
+               case 0:
+                       alertpanel_notice(_("No duplicate message found in selected folder.\n"));
+                       break;
+               default: {
+                               gchar *msg;
+
+                               if (prefs_common.immediate_exec) {
+                                       msg = ngettext("Deleted %d duplicate message in selected folder.\n",
+                                                              "Deleted %d duplicate messages in selected folder.\n",
+                                                          result);
+                               } else {
+                                       msg = ngettext("Marked %d duplicate message for deletion in selected folder.\n",
+                                                              "Marked %d duplicate messages for deletion in selected folder.\n",
+                                                          result);
+                               }
+                               alertpanel_notice(msg, result);
+                       }
+               }
        }
 }
 
+static void delete_duplicated_cb(GtkAction *action, gpointer data)
+{
+       mainwindow_delete_duplicated((MainWindow *)data);
+}
+
 struct DelDupsData
 {
        guint   dups;
@@ -4656,19 +4752,31 @@ static void deldup_all(FolderItem *item, gpointer _data)
        }
 }
 
-static void delete_duplicated_all_cb(GtkAction *action, gpointer mw)
+void mainwindow_delete_duplicated_all(MainWindow *mainwin)
 {
-       MainWindow *mainwin = (MainWindow *)mw;
        struct DelDupsData data = {0, 0};
 
        main_window_cursor_wait(mainwin);
+       STATUSBAR_PUSH(mainwin, _("Deleting duplicated messages in all folders..."));
        folder_func_to_all_folders(deldup_all, &data);
+       STATUSBAR_POP(mainwin);
        main_window_cursor_normal(mainwin);
-       
-       alertpanel_notice(ngettext("Deleted %d duplicate message in %d folders.\n",
+
+       if (data.dups > 0) {
+               alertpanel_notice(ngettext("Deleted %d duplicate message in %d folders.\n",
                                   "Deleted %d duplicate messages in %d folders.\n",
                                   data.dups),
-                         data.dups, data.folders);
+                                  data.dups, data.folders);
+       } else {
+               alertpanel_notice(_("No duplicate message found in %d folders.\n"), data.folders);
+       }
+}
+
+static void delete_duplicated_all_cb(GtkAction *action, gpointer mw)
+{
+       MainWindow *mainwin = (MainWindow *)mw;
+
+       mainwindow_delete_duplicated_all(mainwin);
 }
 
 static void filter_cb(GtkAction *action, gpointer data)
@@ -4713,14 +4821,9 @@ static void update_summary_cb(GtkAction *action, gpointer data)
        FolderView *folderview = mainwin->folderview;
 
        if (!mainwin->summaryview->folder_item) return;
-       if (!folderview->opened) return;
+       if ((fitem = folderview_get_opened_item(folderview)) == NULL) return;
 
        folder_update_op_count();
-
-       fitem = gtk_cmctree_node_get_row_data(GTK_CMCTREE(folderview->ctree),
-                                           folderview->opened);
-       if (!fitem) return;
-
        folder_item_scan(fitem);
        summary_show(mainwin->summaryview, fitem);
 }
@@ -4728,13 +4831,13 @@ static void update_summary_cb(GtkAction *action, gpointer data)
 static void prev_cb(GtkAction *action, gpointer data)
 {
        MainWindow *mainwin = (MainWindow *)data;
-       summary_step(mainwin->summaryview, GTK_SCROLL_STEP_BACKWARD);
+       summary_select_prev(mainwin->summaryview);
 }
 
 static void next_cb(GtkAction *action, gpointer data)
 {
        MainWindow *mainwin = (MainWindow *)data;
-       summary_step(mainwin->summaryview, GTK_SCROLL_STEP_FORWARD);
+       summary_select_next(mainwin->summaryview);
 }
 
 static void prev_unread_cb(GtkAction *action, gpointer data)
@@ -4792,9 +4895,9 @@ static void prev_history_cb(GtkAction *action, gpointer data)
        if (info) {
                if (info->folder != mainwin->summaryview->folder_item)
                        folderview_select(mainwin->folderview, info->folder);
-               summary_display_by_msgnum(mainwin->summaryview, info->msgnum);
-               summary_display_msg_selected(mainwin->summaryview, FALSE);
-               procmsg_msginfo_free(info);
+               summary_select_by_msgnum(mainwin->summaryview, info->msgnum,
+                               OPEN_SELECTED_ON_PREVNEXT);
+               procmsg_msginfo_free(&info);
                main_window_set_menu_sensitive(mainwindow_get_mainwindow());
                toolbar_main_set_sensitive(mainwindow_get_mainwindow());
        }
@@ -4807,8 +4910,9 @@ static void next_history_cb(GtkAction *action, gpointer data)
        if (info) {
                if (info->folder != mainwin->summaryview->folder_item)
                        folderview_select(mainwin->folderview, info->folder);
-               summary_display_by_msgnum(mainwin->summaryview, info->msgnum);
-               procmsg_msginfo_free(info);
+               summary_select_by_msgnum(mainwin->summaryview, info->msgnum,
+                               OPEN_SELECTED_ON_PREVNEXT);
+               procmsg_msginfo_free(&info);
                main_window_set_menu_sensitive(mainwindow_get_mainwindow());
                toolbar_main_set_sensitive(mainwindow_get_mainwindow());
        }
@@ -4825,7 +4929,8 @@ static void goto_folder_cb(GtkAction *action, gpointer data)
        MainWindow *mainwin = (MainWindow *)data;
        FolderItem *to_folder;
 
-       to_folder = foldersel_folder_sel(NULL, FOLDER_SEL_ALL, NULL, FALSE);
+       to_folder = foldersel_folder_sel(NULL, FOLDER_SEL_ALL, NULL, FALSE,
+                       _("Select folder to go to"));
 
        if (to_folder)
                folderview_select(mainwin->folderview, to_folder);
@@ -4834,7 +4939,7 @@ static void goto_folder_cb(GtkAction *action, gpointer data)
 static void goto_unread_folder_cb(GtkAction *action, gpointer data)
 {
        MainWindow *mainwin = (MainWindow *)data;
-       folderview_select_next_unread(mainwin->folderview, FALSE);
+       folderview_select_next_with_flag(mainwin->folderview, MSG_UNREAD);
 }
 
 static void scroll_prev_line_cb(GtkAction *action, gpointer data)
@@ -4882,13 +4987,19 @@ static void allsel_cb(GtkAction *action, gpointer data)
 static void select_thread_cb(GtkAction *action, gpointer data)
 {
        MainWindow *mainwin = (MainWindow *)data;
-       summary_select_thread(mainwin->summaryview, FALSE);
+       summary_select_thread(mainwin->summaryview, FALSE, FALSE);
+}
+
+static void trash_thread_cb(GtkAction *action, gpointer data)
+{
+       MainWindow *mainwin = (MainWindow *)data;
+       summary_select_thread(mainwin->summaryview, FALSE, TRUE);
 }
 
 static void delete_thread_cb(GtkAction *action, gpointer data)
 {
        MainWindow *mainwin = (MainWindow *)data;
-       summary_select_thread(mainwin->summaryview, TRUE);
+       summary_select_thread(mainwin->summaryview, TRUE, FALSE);
 }
 
 static void create_filter_cb(GtkAction *gaction, gpointer data)
@@ -4971,7 +5082,7 @@ static void prefs_account_open_cb(GtkAction *action, gpointer data)
        if (!cur_account) {
                new_account_cb(NULL, mainwin);
        } else {
-               account_open(cur_account);
+               account_open(cur_account, FALSE);
        }
 }
 
@@ -5275,6 +5386,17 @@ static void forget_session_passwords_cb(GtkAction *action, gpointer data)
                                   fgtn), fgtn, accs);  
 }
 
+#ifndef PASSWORD_CRYPTO_OLD
+static void forget_master_passphrase_cb(GtkAction *action, gpointer data)
+{
+       MainWindow *mainwin = (MainWindow *)data;
+
+       main_window_lock(mainwin);
+       master_passphrase_forget();
+       main_window_unlock(mainwin);
+}
+#endif
+
 void mainwindow_learn (MainWindow *mainwin, gboolean is_spam)
 {
        summary_mark_as_spam(mainwin->summaryview, is_spam, NULL);
@@ -5315,7 +5437,7 @@ void mainwindow_jump_to(const gchar *target, gboolean popup)
                return;
        }
        
-       msg = strrchr(tmp, G_DIR_SEPARATOR);
+       msg = strrchr(tmp, '/');
        if (msg) {
                *msg++ = '\0';
                if ((item = folder_find_item_from_identifier(tmp))) {
@@ -5329,8 +5451,7 @@ void mainwindow_jump_to(const gchar *target, gboolean popup)
                }
                if (item && msg && atoi(msg)) {
                        g_print("selecting message %d\n", atoi(msg));
-                       summary_select_by_msgnum(mainwin->summaryview, atoi(msg));
-                       summary_display_msg_selected(mainwin->summaryview, FALSE);
+                       summary_select_by_msgnum(mainwin->summaryview, atoi(msg), TRUE);
                        if (popup)
                                main_window_popup(mainwin);
                        g_free(tmp);
@@ -5342,12 +5463,11 @@ void mainwindow_jump_to(const gchar *target, gboolean popup)
                        msginfo = folder_item_get_msginfo_by_msgid(item, msg);
                        if (msginfo) {
                                g_print("selecting message %s\n", msg);
-                               summary_select_by_msgnum(mainwin->summaryview, msginfo->msgnum);
-                               summary_display_msg_selected(mainwin->summaryview, FALSE);
+                               summary_select_by_msgnum(mainwin->summaryview, msginfo->msgnum, TRUE);
                                if (popup)
                                        main_window_popup(mainwin);
                                g_free(tmp);
-                               procmsg_msginfo_free(msginfo);
+                               procmsg_msginfo_free(&msginfo);
                                return;
                        } else {
                                g_print("'%s' not found\n", msg);
@@ -5364,9 +5484,9 @@ void mainwindow_jump_to(const gchar *target, gboolean popup)
 
 void mainwindow_exit_folder(MainWindow *mainwin) {
        if (prefs_common.layout_mode == SMALL_LAYOUT) {
-               folderview_close_opened(mainwin->folderview);
+               folderview_close_opened(mainwin->folderview, FALSE);
                mainwin_paned_show_first(GTK_PANED(mainwin->hpaned));
-               gtk_widget_grab_focus(mainwin->folderview->ctree);
+               folderview_grab_focus(mainwin->folderview);
        }
        mainwin->in_folder = FALSE;
        main_window_set_menu_sensitive(mainwin);