2012-11-28 [colin] 3.9.0cvs28
[claws.git] / src / mainwindow.c
index 6f1f3259ac0f56f9c90aadece95472357e9db65b..ed944f64e389b6ffa482014c01a78dd6319fb57c 100644 (file)
@@ -1,17 +1,17 @@
 /*
    Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
-   Copyright (C) 1999-2011 Hiroyuki Yamamoto and the Claws Mail team
+   Copyright (C) 1999-2012 Hiroyuki Yamamoto and the Claws Mail team
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
-   
+
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
-   
+
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 #include "main.h"
 #include "mainwindow.h"
 #include "folderview.h"
+#include "folder_item_prefs.h"
 #include "foldersel.h"
 #include "summaryview.h"
 #include "summary_search.h"
 #include "messageview.h"
+#include "mimeview.h"
 #include "message_search.h"
 #include "headerview.h"
 #include "menu.h"
 #include "prefs_template.h"
 #include "action.h"
 #include "account.h"
-#include "addressbook.h"
+#ifndef USE_NEW_ADDRBOOK
+       #include "addressbook.h"
+#else
+       #include "addressbook-dbus.h"
+#endif
 #include "logwindow.h"
 #include "manage_window.h"
 #include "alertpanel.h"
@@ -79,6 +85,7 @@
 #include "tags.h"
 #include "textview.h"
 #include "imap.h"
+#include "news.h"
 #include "socket.h"
 #include "printing.h"
 #ifdef G_OS_WIN32
@@ -247,6 +254,8 @@ static void set_decode_cb           (GtkAction *action, GtkRadioAction *current, gpointer
 
 static void hide_read_messages   (GtkAction    *action,
                                  gpointer       data);
+static void hide_read_threads   (GtkAction     *action,
+                                 gpointer       data);
 static void hide_del_messages   (GtkAction     *action,
                                  gpointer       data);
 
@@ -304,7 +313,9 @@ static void prev_labeled_cb  (GtkAction     *action,
                                  gpointer       data);
 static void next_labeled_cb     (GtkAction     *action,
                                  gpointer       data);
-static void last_read_cb        (GtkAction     *action,
+static void prev_history_cb     (GtkAction     *action,
+                                 gpointer       data);
+static void next_history_cb     (GtkAction     *action,
                                  gpointer       data);
 static void parent_cb           (GtkAction     *action,
                                  gpointer       data);
@@ -314,6 +325,15 @@ static void goto_folder_cb  (GtkAction     *action,
 static void goto_unread_folder_cb(GtkAction    *action,
                                  gpointer       data);
 
+static void scroll_prev_line_cb  (GtkAction      *action,
+                                  gpointer        data);
+static void scroll_next_line_cb  (GtkAction      *action,
+                                  gpointer        data);
+static void scroll_prev_page_cb  (GtkAction      *action,
+                                  gpointer        data);
+static void scroll_next_page_cb  (GtkAction      *action,
+                                  gpointer        data);
+
 static void copy_cb             (GtkAction     *action,
                                  gpointer       data);
 static void allsel_cb           (GtkAction     *action,
@@ -420,7 +440,7 @@ static gint mailing_list_create_submenu(MainWindow *mainwindow,
 
 static gint mailing_list_populate_submenu(GtkWidget *menu, const gchar * list_header);
        
-static void get_url_part(const gchar **buf, gchar *url_decoded, gint maxlen);
+static void get_url_part(const gchar **buf, gchar *url_decoded);
 
 static void mailing_list_compose(GtkWidget *w, gpointer *data);
  
@@ -430,6 +450,15 @@ static void mainwindow_quicksearch         (GtkAction      *action,
                                  gpointer       data);
 static gboolean any_folder_want_synchronise(void);
 
+static void save_part_as_cb(GtkAction *action, gpointer data);
+static void view_part_as_text_cb(GtkAction *action, gpointer data);
+static void open_part_cb(GtkAction *action, gpointer data);
+#ifndef G_OS_WIN32
+static void open_part_with_cb(GtkAction *action, gpointer data);
+#endif
+static void check_signature_cb(GtkAction *action, gpointer data);
+static void goto_next_part_cb(GtkAction *action, gpointer data);
+static void goto_prev_part_cb(GtkAction *action, gpointer data);
 #define DO_ACTION(name, act)   { if (!strcmp(a_name, name)) action = act; }
 
 static void mainwindow_nothing_cb         (GtkAction *action, gpointer data)
@@ -480,7 +509,7 @@ static GtkActionEntry mainwin_entries[] =
        {"File/AddMailbox/MH",                  NULL, N_("MH..."), NULL, NULL, G_CALLBACK(add_mailbox_cb) },
        {"File/---",                            NULL, "---" },
 
-       {"File/SortFolders",                    NULL, N_("Change folder order..."), NULL, NULL, G_CALLBACK(foldersort_cb) },
+       {"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) },
@@ -490,7 +519,9 @@ static GtkActionEntry mainwin_entries[] =
        {"File/EmptyTrashes",                   NULL, N_("Empty all _Trash folders"), "<shift>D", NULL, G_CALLBACK(empty_trash_cb) },
        /* {"File/---",                         NULL, "---" }, */
 
-       {"File/SaveAs",                         NULL, N_("_Save as..."), "<control>S", NULL, G_CALLBACK(save_as_cb) },
+       {"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) },
@@ -514,8 +545,8 @@ static GtkActionEntry mainwin_entries[] =
        {"View/ShowHide/Toolbar",               NULL, N_("_Toolbar") },
 
        {"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/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, "---" },
 
 
@@ -546,13 +577,25 @@ static GtkActionEntry mainwin_entries[] =
        {"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/LastRead",                  NULL, N_("Last read message"), NULL, NULL, G_CALLBACK(last_read_cb) },
+       {"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/---",                         NULL, "---", NULL, NULL, NULL }, */
+       /* {"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, "---" },
 #define ENC_ACTION(cs_char,c_char,string) \
@@ -577,6 +620,15 @@ static GtkActionEntry mainwin_entries[] =
        /* {"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) },
+#ifndef G_OS_WIN32
+       {"View/Part/OpenWith",                  NULL, N_("Open with..."), "O", NULL, G_CALLBACK(open_part_with_cb) },
+#endif
+       /* {"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) },
@@ -597,9 +649,9 @@ static GtkActionEntry mainwin_entries[] =
 
        {"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/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, "---" },*/
 
@@ -620,14 +672,14 @@ static GtkActionEntry mainwin_entries[] =
        {"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/---",                       NULL, "---" },*/
+       /* 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/---",                       NULL, "---" },*/
+       /* separation */
        
        {"Message/Mark",                        NULL, N_("_Mark") },
        {"Message/Mark/Mark",                   NULL, N_("_Mark"), "<shift>asterisk", NULL, G_CALLBACK(mark_cb) },
@@ -636,7 +688,9 @@ static GtkActionEntry mainwin_entries[] =
 
        {"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) },
+       /* separation */
        {"Message/Mark/MarkAllRead",            NULL, N_("Mark all read"), NULL, NULL, G_CALLBACK(mark_all_read_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) },
@@ -655,6 +709,9 @@ static GtkActionEntry mainwin_entries[] =
        /*{"Message/---",                       NULL, "---" },*/
 
        {"Message/Reedit",                      NULL, N_("Re-_edit"), NULL, NULL, G_CALLBACK(reedit_cb) },
+       /*{"Message/---",                       NULL, "---" },*/
+
+       {"Message/CheckSignature",              NULL, N_("Check signature"), "C", NULL, G_CALLBACK(check_signature_cb) },
 
 /* Tools menu */
 
@@ -662,8 +719,8 @@ static GtkActionEntry mainwin_entries[] =
        {"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/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) }, 
@@ -747,15 +804,16 @@ static GtkToggleActionEntry mainwin_toggle_entries[] = {
 #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 */
 #ifndef MAEMO
        {"View/FullScreen",                     NULL, N_("_Fullscreen"), "F11", NULL, G_CALLBACK(toggle_fullscreen_cb) }, /* toggle */
 #endif
        {"View/AllHeaders",                     NULL, N_("Show all _headers"), "<control>H", NULL, G_CALLBACK(show_all_header_cb) }, /* toggle */
-       {"View/Quotes/FoldAll",                 NULL, N_("_Fold all"), "<control><shift>Q", NULL, G_CALLBACK(hide_quotes_cb) }, /* 1 toggle */
-       {"View/Quotes/Fold2",                   NULL, N_("Fold from level _2"), NULL, NULL, G_CALLBACK(hide_quotes_cb) }, /* 2 toggle */
-       {"View/Quotes/Fold3",                   NULL, N_("Fold from level _3"), NULL, NULL, G_CALLBACK(hide_quotes_cb) }, /* 3 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 */
 };
 
 static GtkRadioActionEntry mainwin_showhide_radio_entries[] = { /* toggle_toolbar_cb */
@@ -777,20 +835,20 @@ static GtkRadioActionEntry mainwin_layout_radio_entries[] = { /* set_layout_cb *
 };
 #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/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 */
 };
 
@@ -876,7 +934,7 @@ static void mainwindow_colorlabel_menu_item_activate_item_cb(GtkMenuItem *menu_i
        GtkMenuShell *menu;
        GtkCheckMenuItem **items;
        gint n;
-       GList *cur;
+       GList *children, *cur;
        GSList *sel;
 
        mainwin = (MainWindow *)data;
@@ -896,7 +954,8 @@ static void mainwindow_colorlabel_menu_item_activate_item_cb(GtkMenuItem *menu_i
                          GINT_TO_POINTER(1));
 
        /* clear items. get item pointers. */
-       for (n = 0, cur = menu->children; cur != NULL && cur->data != NULL; cur = cur->next) {
+       children = gtk_container_get_children(GTK_CONTAINER(menu));
+       for (n = 0, cur = children; cur != NULL && cur->data != NULL; cur = cur->next) {
                if (GTK_IS_CHECK_MENU_ITEM(cur->data)) {
                        gtk_check_menu_item_set_active
                                (GTK_CHECK_MENU_ITEM(cur->data), FALSE);
@@ -905,6 +964,8 @@ static void mainwindow_colorlabel_menu_item_activate_item_cb(GtkMenuItem *menu_i
                }
        }
 
+       g_list_free(children);
+
        if (n == (N_COLOR_LABELS + 1)) {
                /* iterate all messages and set the state of the appropriate
                 * items */
@@ -915,7 +976,7 @@ static void mainwindow_colorlabel_menu_item_activate_item_cb(GtkMenuItem *menu_i
                        msginfo = (MsgInfo *)sel->data;
                        if (msginfo) {
                                clabel = MSG_GET_COLORLABEL_VALUE(msginfo->flags);
-                               if (!items[clabel]->active)
+                               if (!gtk_check_menu_item_get_active(items[clabel]))
                                        gtk_check_menu_item_set_active
                                                (items[clabel], TRUE);
                        }
@@ -951,7 +1012,7 @@ static void mainwindow_tags_menu_item_activate_item_cb(GtkMenuItem *menu_item,
 {
        MainWindow *mainwin;
        GtkMenuShell *menu;
-       GList *cur;
+       GList *children, *cur;
        GSList *sel;
        GHashTable *menu_table = g_hash_table_new_full(
                                        g_direct_hash,
@@ -977,7 +1038,8 @@ static void mainwindow_tags_menu_item_activate_item_cb(GtkMenuItem *menu_item,
                          GINT_TO_POINTER(1));
 
        /* clear items. get item pointers. */
-       for (cur = menu->children; cur != NULL && cur->data != NULL; cur = cur->next) {
+       children = gtk_container_get_children(GTK_CONTAINER(menu));
+       for (cur = children; cur != NULL && cur->data != NULL; cur = cur->next) {
                if (GTK_IS_CHECK_MENU_ITEM(cur->data)) {
                        gint id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cur->data),
                                "tag_id"));
@@ -989,13 +1051,14 @@ static void mainwindow_tags_menu_item_activate_item_cb(GtkMenuItem *menu_item,
                }
        }
 
+       g_list_free(children);
+
        /* iterate all messages and set the state of the appropriate
         * items */
        sel_len = 0;
        for (; sel != NULL; sel = sel->next) {
                MsgInfo *msginfo;
                GSList *tags = NULL;
-               gint id;
                GtkCheckMenuItem *item;
                msginfo = (MsgInfo *)sel->data;
                sel_len++;
@@ -1006,9 +1069,8 @@ static void mainwindow_tags_menu_item_activate_item_cb(GtkMenuItem *menu_item,
 
                        for (; tags; tags = tags->next) {
                                gint num_checked = GPOINTER_TO_INT(g_hash_table_lookup(menu_allsel_table, tags->data));
-                               id = GPOINTER_TO_INT(tags->data);
                                item = g_hash_table_lookup(menu_table, GINT_TO_POINTER(tags->data));
-                               if (item && !item->active) {
+                               if (item && !gtk_check_menu_item_get_active(item)) {
                                        gtk_check_menu_item_set_active
                                                (item, TRUE);
                                }
@@ -1018,7 +1080,8 @@ static void mainwindow_tags_menu_item_activate_item_cb(GtkMenuItem *menu_item,
                }
        }
 
-       for (cur = menu->children; cur != NULL && cur->data != NULL; cur = cur->next) {
+       children = gtk_container_get_children(GTK_CONTAINER(menu));
+       for (cur = children; cur != NULL && cur->data != NULL; cur = cur->next) {
                if (GTK_IS_CHECK_MENU_ITEM(cur->data)) {
                        gint id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cur->data),
                                "tag_id"));
@@ -1029,6 +1092,7 @@ static void mainwindow_tags_menu_item_activate_item_cb(GtkMenuItem *menu_item,
                                gtk_check_menu_item_set_inconsistent(GTK_CHECK_MENU_ITEM(cur->data), FALSE);
                }
        }
+       g_list_free(children);
        g_slist_free(sel);
        g_hash_table_destroy(menu_table);
        g_hash_table_destroy(menu_allsel_table);
@@ -1067,13 +1131,9 @@ void mainwin_accel_changed_cb (GtkAccelGroup *accelgroup, guint keyval, GdkModif
                        GtkLabel *label = g_object_get_data(G_OBJECT(item), "accel_label");
                        gchar *new_accel;
                        
-                       if (keyval == GDK_BackSpace) {
+                       if (keyval == GDK_KEY_BackSpace) {
                                const gchar *accel_path;
-#if GTK_CHECK_VERSION(2,14,0)
                                accel_path = gtk_menu_item_get_accel_path(item);
-#else
-                               accel_path = GTK_MENU_ITEM(item)->accel_path;
-#endif
                                keyval = 0; modifier = 0;
                                gtk_accel_map_change_entry (accel_path, keyval, modifier, TRUE);
                        }
@@ -1118,7 +1178,7 @@ static void mainwindow_colorlabel_menu_create(MainWindow *mainwin, gboolean refr
        accel_path = g_strdup_printf("<ClawsColorLabels>/None");
        gtk_menu_item_set_accel_path(GTK_MENU_ITEM(item), accel_path);
        g_free(accel_path);
-       gtk_accel_map_add_entry("<ClawsColorLabels>/None", GDK_0, GDK_CONTROL_MASK);
+       gtk_accel_map_add_entry("<ClawsColorLabels>/None", GDK_KEY_0, GDK_CONTROL_MASK);
 
        item = gtk_menu_item_new();
        gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
@@ -1138,7 +1198,7 @@ static void mainwindow_colorlabel_menu_create(MainWindow *mainwin, gboolean refr
                accel_path = g_strdup_printf("<ClawsColorLabels>/%d", i+1);
                gtk_menu_item_set_accel_path(GTK_MENU_ITEM(item), accel_path);
                if (i < 9)
-                       gtk_accel_map_add_entry(accel_path, GDK_1+i, GDK_CONTROL_MASK);
+                       gtk_accel_map_add_entry(accel_path, GDK_KEY_1+i, GDK_CONTROL_MASK);
                g_free(accel_path);
                g_signal_connect (gtk_ui_manager_get_accel_group(mainwin->ui_manager), 
                        "accel-changed", G_CALLBACK (mainwin_accel_changed_cb), item);
@@ -1243,7 +1303,7 @@ static void mainwindow_tags_menu_create(MainWindow *mainwin, gboolean refresh)
        accel_path = g_strdup_printf("<ClawsTags>/ApplyTags");
        gtk_menu_item_set_accel_path(GTK_MENU_ITEM(item), accel_path);
        g_free(accel_path);
-       gtk_accel_map_add_entry("<ClawsTags>/ApplyTags", GDK_T, GDK_CONTROL_MASK|GDK_SHIFT_MASK);
+       gtk_accel_map_add_entry("<ClawsTags>/ApplyTags", GDK_KEY_T, GDK_CONTROL_MASK|GDK_SHIFT_MASK);
 
        g_slist_free(orig);
        gtk_widget_show(menu);
@@ -1265,7 +1325,7 @@ static gboolean warning_visi_notify(GtkWidget *widget,
                                       GdkEventVisibility *event,
                                       MainWindow *mainwindow)
 {
-       gdk_window_set_cursor(mainwindow->warning_btn->window, hand_cursor);
+       gdk_window_set_cursor(gtk_widget_get_window(mainwindow->warning_btn), hand_cursor);
        return FALSE;
 }
 
@@ -1273,7 +1333,7 @@ static gboolean warning_leave_notify(GtkWidget *widget,
                                      GdkEventCrossing *event,
                                      MainWindow *mainwindow)
 {
-       gdk_window_set_cursor(mainwindow->warning_btn->window, NULL);
+       gdk_window_set_cursor(gtk_widget_get_window(mainwindow->warning_btn), NULL);
        return FALSE;
 }
 
@@ -1281,7 +1341,7 @@ static gboolean warning_enter_notify(GtkWidget *widget,
                                      GdkEventCrossing *event,
                                      MainWindow *mainwindow)
 {
-       gdk_window_set_cursor(mainwindow->warning_btn->window, hand_cursor);
+       gdk_window_set_cursor(gtk_widget_get_window(mainwindow->warning_btn), hand_cursor);
        return FALSE;
 }
 #endif
@@ -1314,7 +1374,7 @@ static gboolean mainwindow_key_pressed (GtkWidget *widget, GdkEventKey *event,
        }
 
        switch (event->keyval) {
-       case GDK_Q:             /* Quit */
+       case GDK_KEY_Q:             /* Quit */
 #ifndef MAEMO
                BREAK_ON_MODIFIER_KEY();
 
@@ -1323,7 +1383,7 @@ static gboolean mainwindow_key_pressed (GtkWidget *widget, GdkEventKey *event,
                }
 #endif
                return FALSE;
-       case GDK_space:
+       case GDK_KEY_space:
                BREAK_ON_MODIFIER_KEY();
                if (gtk_window_is_active(GTK_WINDOW(mainwin->window))) {
                        if (mainwin->folderview != NULL && mainwin->summaryview != NULL
@@ -1339,14 +1399,14 @@ static gboolean mainwindow_key_pressed (GtkWidget *widget, GdkEventKey *event,
                break;
 
 #ifdef MAEMO
-       case GDK_F6:
+       case GDK_KEY_F6:
                if (maemo_mainwindow_is_fullscreen(widget)) {
                        gtk_window_unfullscreen(GTK_WINDOW(widget));
                 } else {
                        gtk_window_fullscreen(GTK_WINDOW(widget));
                 }
                break;
-       case GDK_F7:
+       case GDK_KEY_F7:
                {
                        PangoFontDescription *font_desc;
                        int size;
@@ -1370,7 +1430,7 @@ static gboolean mainwindow_key_pressed (GtkWidget *widget, GdkEventKey *event,
                        pango_font_description_free(font_desc);
                }
                break;
-       case GDK_F8:
+       case GDK_KEY_F8:
                {
                        PangoFontDescription *font_desc;
                        int size;
@@ -1394,7 +1454,7 @@ static gboolean mainwindow_key_pressed (GtkWidget *widget, GdkEventKey *event,
                        pango_font_description_free(font_desc);
                }
                break;
-       case GDK_Escape:
+       case GDK_KEY_Escape:
                if (mainwin->summaryview && 
                    mainwin->summaryview->ext_messageview && 
                    mainwin->summaryview->ext_messageview->window && 
@@ -1522,16 +1582,17 @@ MainWindow *main_window_create()
        GtkWidget *offline_pixmap;
        GtkWidget *warning_icon;
        GtkWidget *warning_btn;
-       CLAWS_TIP_DECL();
 #endif
        GtkWidget *online_switch;
        GtkWidget *offline_switch;
        FolderView *folderview;
        SummaryView *summaryview;
        MessageView *messageview;
+#if !GTK_CHECK_VERSION(3, 0, 0)
        GdkColormap *colormap;
-       GdkColor color[4];
        gboolean success[4];
+#endif
+       GdkColor color[4];
        GtkWidget *ac_menu;
        gint i;
 
@@ -1612,7 +1673,7 @@ MainWindow *main_window_create()
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "AddMailbox", "File/AddMailbox", GTK_UI_MANAGER_MENU)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File/AddMailbox", "MH", "File/AddMailbox/MH", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Separator1", "File/---", GTK_UI_MANAGER_SEPARATOR)
-       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "SortFolders", "File/SortFolders", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "SortMailboxes", "File/SortMailboxes", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Separator2", "File/---", GTK_UI_MANAGER_SEPARATOR)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "ImportMbox", "File/ImportMbox", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "ExportMbox", "File/ExportMbox", GTK_UI_MANAGER_MENUITEM)
@@ -1621,12 +1682,14 @@ MainWindow *main_window_create()
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "EmptyTrashes", "File/EmptyTrashes", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Separator4", "File/---", GTK_UI_MANAGER_SEPARATOR)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "SaveAs", "File/SaveAs", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "SavePartAs", "File/SavePartAs", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Separator5", "File/---", GTK_UI_MANAGER_SEPARATOR)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "PageSetup", "File/PageSetup", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Print", "File/Print", GTK_UI_MANAGER_MENUITEM)
-       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Separator5", "File/---", GTK_UI_MANAGER_SEPARATOR)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Separator6", "File/---", GTK_UI_MANAGER_SEPARATOR)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "OfflineMode", "File/OfflineMode", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "SynchroniseFolders", "File/SynchroniseFolders", GTK_UI_MANAGER_MENUITEM)
-       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Separator6", "File/---", GTK_UI_MANAGER_SEPARATOR)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Separator7", "File/---", GTK_UI_MANAGER_SEPARATOR)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Exit", "File/Exit", GTK_UI_MANAGER_MENUITEM)
 
 /* Edit menu */
@@ -1697,6 +1760,7 @@ MainWindow *main_window_create()
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "ThreadView", "View/ThreadView", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "ExpandThreads", "View/ExpandThreads", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "CollapseThreads", "View/CollapseThreads", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "HideReadThreads", "View/HideReadThreads", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "HideReadMessages", "View/HideReadMessages", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "HideDelMessages", "View/HideDelMessages", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Separator3", "View/---", GTK_UI_MANAGER_SEPARATOR)
@@ -1717,11 +1781,21 @@ MainWindow *main_window_create()
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "PrevLabeled", "View/Goto/PrevLabeled", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "NextLabeled", "View/Goto/NextLabeled", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "Separator5", "View/Goto/---", GTK_UI_MANAGER_SEPARATOR)
-       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "LastRead", "View/Goto/LastRead", GTK_UI_MANAGER_MENUITEM)
-       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", "PrevHistory", "View/Goto/PrevHistory", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "NextHistory", "View/Goto/NextHistory", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "Separator6", "View/Goto/---", GTK_UI_MANAGER_SEPARATOR)
+       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", "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)
+        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Scroll", "View/Scroll", GTK_UI_MANAGER_MENU)
+        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Scroll", "PrevLine", "View/Scroll/PrevLine", GTK_UI_MANAGER_MENUITEM)
+        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Scroll", "NextLine", "View/Scroll/NextLine", GTK_UI_MANAGER_MENUITEM)
+        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Scroll", "PrevPage", "View/Scroll/PrevPage", GTK_UI_MANAGER_MENUITEM)
+        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Scroll", "NextPage", "View/Scroll/NextPage", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Separator4", "View/---", GTK_UI_MANAGER_SEPARATOR)
 
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Encoding", "View/Encoding", GTK_UI_MANAGER_MENU)
@@ -1794,10 +1868,16 @@ MainWindow *main_window_create()
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "MessageSource", "View/MessageSource", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "AllHeaders", "View/AllHeaders", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Quotes", "View/Quotes", GTK_UI_MANAGER_MENU)
-       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Quotes", "FoldAll", "View/Quotes/FoldAll", GTK_UI_MANAGER_MENUITEM)
-       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Quotes", "Fold2", "View/Quotes/Fold2", GTK_UI_MANAGER_MENUITEM)
-       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Quotes", "Fold3", "View/Quotes/Fold3", GTK_UI_MANAGER_MENUITEM)
-       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Separator6", "View/---", GTK_UI_MANAGER_SEPARATOR)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Quotes", "CollapseAll", "View/Quotes/CollapseAll", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Quotes", "Collapse2", "View/Quotes/Collapse2", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Quotes", "Collapse3", "View/Quotes/Collapse3", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Part", "View/Part", GTK_UI_MANAGER_MENU)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Part", "AsText", "View/Part/AsText", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Part", "Open", "View/Part/Open", GTK_UI_MANAGER_MENUITEM)
+#ifndef G_OS_WIN32
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Part", "OpenWith", "View/Part/OpenWith", GTK_UI_MANAGER_MENUITEM)
+#endif
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Separator8", "View/---", GTK_UI_MANAGER_SEPARATOR)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "UpdateSummary", "View/UpdateSummary", GTK_UI_MANAGER_MENUITEM)
 
 /* Message menu */
@@ -1851,15 +1931,17 @@ MainWindow *main_window_create()
        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", "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", "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)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "WatchThread", "Message/Mark/WatchThread", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "UnwatchThread", "Message/Mark/UnwatchThread", 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", "Separator4", "Message/Mark/---", GTK_UI_MANAGER_SEPARATOR)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "MarkSpam", "Message/Mark/MarkSpam", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "MarkHam", "Message/Mark/MarkHam", 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", "Separator5", "Message/Mark/---", GTK_UI_MANAGER_SEPARATOR)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "Lock", "Message/Mark/Lock", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "Unlock", "Message/Mark/Unlock", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "ColorLabel", "Message/ColorLabel", GTK_UI_MANAGER_MENUITEM)
@@ -1868,6 +1950,7 @@ MainWindow *main_window_create()
 
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Reedit", "Message/Reedit", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Separator6", "Message/---", GTK_UI_MANAGER_SEPARATOR)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "CheckSignature", "Message/CheckSignature", GTK_UI_MANAGER_MENUITEM)
 
 /* Tools menu */
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "AddressBook", "Tools/AddressBook", GTK_UI_MANAGER_MENUITEM)
@@ -2067,6 +2150,7 @@ MainWindow *main_window_create()
        gtk_widget_show_all(hbox_stat);
 
        gtk_widget_hide(offline_switch);
+       gtk_widget_hide(progressbar);
        gtk_widget_hide(warning_btn);
 #else
        online_switch = gtk_button_new ();
@@ -2084,7 +2168,7 @@ MainWindow *main_window_create()
        set_log_prefs(LOG_PROTOCOL,
                        &prefs_common.logwin_width,
                        &prefs_common.logwin_height);
-       set_log_title(LOG_DEBUG_FILTERING, _("Filtering/processing debug log"));
+       set_log_title(LOG_DEBUG_FILTERING, _("Filtering/Processing debug log"));
        set_log_prefs(LOG_DEBUG_FILTERING,
                        &prefs_common.filtering_debugwin_width,
                        &prefs_common.filtering_debugwin_height);
@@ -2176,12 +2260,14 @@ MainWindow *main_window_create()
        color[2] = folderview->color_new;
        color[3] = folderview->color_op;
 
-       colormap = gdk_drawable_get_colormap(window->window);
+#if !GTK_CHECK_VERSION(3, 0, 0)
+       colormap = gdk_drawable_get_colormap(gtk_widget_get_window(window));
        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);
        }
+#endif
 
        debug_print("done.\n");
 
@@ -2249,12 +2335,6 @@ MainWindow *main_window_create()
 
        ADD_MENU_ACCEL_GROUP_TO_WINDOW(summaryview->popupmenu, mainwin->window);
        
-#ifndef GENERIC_UMPC
-#ifdef G_OS_UNIX
-       gtk_window_iconify(GTK_WINDOW(mainwin->window));
-#endif
-#endif
-
        g_signal_connect(G_OBJECT(window), "window_state_event",
                         G_CALLBACK(mainwindow_state_event_cb), mainwin);
        g_signal_connect(G_OBJECT(window), "visibility_notify_event",
@@ -2267,8 +2347,6 @@ MainWindow *main_window_create()
        }
        summary_update_unread(mainwin->summaryview, NULL);
        
-       gtk_widget_show(mainwin->window);
-
        /* initialize views */
        folderview_init(folderview);
        summary_init(summaryview);
@@ -2317,7 +2395,7 @@ void main_window_cursor_wait(MainWindow *mainwin)
 {
 
        if (mainwin->cursor_count == 0) {
-               gdk_window_set_cursor(mainwin->window->window, watch_cursor);
+               gdk_window_set_cursor(gtk_widget_get_window(mainwin->window), watch_cursor);
                textview_cursor_wait(mainwin->messageview->mimeview->textview);
        }
        
@@ -2332,7 +2410,7 @@ void main_window_cursor_normal(MainWindow *mainwin)
                mainwin->cursor_count--;
 
        if (mainwin->cursor_count == 0) {
-               gdk_window_set_cursor(mainwin->window->window, NULL);
+               gdk_window_set_cursor(gtk_widget_get_window(mainwin->window), NULL);
                textview_cursor_normal(mainwin->messageview->mimeview->textview);
        }
        gdk_flush();
@@ -2403,7 +2481,9 @@ 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
                        addressbook_reflect_prefs_pixmap_theme();
+#endif
 #ifndef GENERIC_UMPC
                        pixmap = stock_pixmap_widget(mainwin->hbox_stat, STOCK_PIXMAP_ONLINE);
                        gtk_container_remove(GTK_CONTAINER(mainwin->online_switch), 
@@ -2450,20 +2530,22 @@ void main_window_reflect_prefs_all_now(void)
 void main_window_reflect_prefs_custom_colors(MainWindow *mainwin)
 {
        GtkMenuShell *menu;
-       GList *cur;
+       GList *children, *cur;
 
        /* re-create colorlabel submenu */
        menu = GTK_MENU_SHELL(mainwin->colorlabel_menu);
        cm_return_if_fail(menu != NULL);
 
        /* clear items. get item pointers. */
-       for (cur = menu->children; cur != NULL && cur->data != NULL; cur = cur->next) {
+       children = gtk_container_get_children(GTK_CONTAINER(menu));
+       for (cur = children; cur != NULL && cur->data != NULL; cur = cur->next) {
                g_signal_handlers_disconnect_matched
                         (gtk_ui_manager_get_accel_group(mainwin->ui_manager), 
                         G_SIGNAL_MATCH_DATA|G_SIGNAL_MATCH_FUNC,
                         0, 0, NULL, mainwin_accel_changed_cb, cur->data);
                gtk_menu_item_set_submenu(GTK_MENU_ITEM(cur->data), NULL);
        }
+       g_list_free(children);
        mainwindow_colorlabel_menu_create(mainwin, TRUE);
        summary_reflect_prefs_custom_colors(mainwin->summaryview);
        folderview_reinit_fonts(mainwin->folderview);
@@ -2473,7 +2555,7 @@ static gint tags_tag = 0;
 static gboolean main_window_reflect_tags_changes_real(gpointer data)
 {
        GtkMenuShell *menu;
-       GList *cur;
+       GList *children, *cur;
        MainWindow *mainwin = (MainWindow *)data;
 
        if (summary_is_locked(mainwin->summaryview)) {
@@ -2485,9 +2567,11 @@ static gboolean main_window_reflect_tags_changes_real(gpointer data)
        cm_return_val_if_fail(menu != NULL, FALSE);
 
        /* clear items. get item pointers. */
-       for (cur = menu->children; cur != NULL && cur->data != NULL; cur = cur->next) {
+       children = gtk_container_get_children(GTK_CONTAINER(menu));
+       for (cur = children; cur != NULL && cur->data != NULL; cur = cur->next) {
                gtk_menu_item_set_submenu(GTK_MENU_ITEM(cur->data), NULL);
        }
+       g_list_free(children);
        mainwindow_tags_menu_create(mainwin, TRUE);
        summary_reflect_tags_changes(mainwin->summaryview);
        
@@ -2568,7 +2652,7 @@ static void main_window_set_account_selector_menu(MainWindow *mainwin,
 static void main_window_set_account_receive_menu(MainWindow *mainwin,
                                                 GList *account_list)
 {
-       GList *cur_ac, *cur_item;
+       GList *children, *child;
        GtkWidget *menu;
        GtkWidget *menuitem;
        PrefsAccount *ac_prefs;
@@ -2577,23 +2661,24 @@ static void main_window_set_account_receive_menu(MainWindow *mainwin,
                gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/Message/Receive")));
 
        /* search for separator */
-       for (cur_item = GTK_MENU_SHELL(menu)->children; cur_item != NULL;
-            cur_item = cur_item->next) {
-               if (cur_item->data == gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/Message/Receive/Separator1")) {
-                       cur_item = cur_item->next;
+       children = gtk_container_get_children(GTK_CONTAINER(menu));
+       for (child = children; child != NULL; child = child->next) {
+               if (child->data == gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/Message/Receive/Separator1")) {
+                       child = child->next;
                        break;
                }
        }
 
        /* destroy all previous menu item */
-       while (cur_item != NULL) {
-               GList *next = cur_item->next;
-               gtk_widget_destroy(GTK_WIDGET(cur_item->data));
-               cur_item = next;
+       while (child != NULL) {
+               gtk_widget_destroy(GTK_WIDGET(child->data));
+               child = child->next;
        }
 
-       for (cur_ac = account_list; cur_ac != NULL; cur_ac = cur_ac->next) {
-               ac_prefs = (PrefsAccount *)cur_ac->data;
+       g_list_free(children);
+
+       for (child = account_list; child != NULL; child = child->next) {
+               ac_prefs = (PrefsAccount *)child->data;
 
                if (ac_prefs->protocol == A_NONE)
                        continue;
@@ -2745,11 +2830,11 @@ static void main_window_separation_change(MainWindow *mainwin, LayoutType layout
        g_object_ref(summary_wid);
        g_object_ref(message_wid);
        gtkut_container_remove
-               (GTK_CONTAINER(folder_wid->parent), folder_wid);
+               (GTK_CONTAINER(gtk_widget_get_parent(folder_wid)), folder_wid);
        gtkut_container_remove
-               (GTK_CONTAINER(summary_wid->parent), summary_wid);
+               (GTK_CONTAINER(gtk_widget_get_parent(summary_wid)), summary_wid);
        gtkut_container_remove
-               (GTK_CONTAINER(message_wid->parent), message_wid);
+               (GTK_CONTAINER(gtk_widget_get_parent(message_wid)), message_wid);
 
        gtk_widget_hide(mainwin->window);
        main_window_set_widgets(mainwin, layout_mode);
@@ -2820,7 +2905,7 @@ void main_window_toggle_message_view(MainWindow *mainwin)
        case SMALL_LAYOUT:
                ppaned = mainwin->vpaned;
                container = mainwin->hpaned;
-               if (ppaned->parent != NULL) {
+               if (gtk_widget_get_parent(ppaned) != NULL) {
                        mainwin->messageview->visible = FALSE;
                        summaryview->displayed = NULL;
                        g_object_ref(ppaned);
@@ -2834,9 +2919,8 @@ void main_window_toggle_message_view(MainWindow *mainwin)
                }
                break;
        case WIDE_LAYOUT:
-               ppaned = mainwin->hpaned;
                container = mainwin->vpaned;
-               if (mainwin->messageview->vbox->parent != NULL) {
+               if (gtk_widget_get_parent(mainwin->messageview->vbox) != NULL) {
                        mainwin->messageview->visible = FALSE;
                        summaryview->displayed = NULL;
                        g_object_ref(mainwin->messageview->vbox);
@@ -2878,7 +2962,7 @@ void main_window_toggle_message_view(MainWindow *mainwin)
 
 void main_window_get_size(MainWindow *mainwin)
 {
-       GtkAllocation *allocation;
+       GtkAllocation allocation;
 
        if (mainwin_list == NULL || mainwin->messageview == NULL) {
                debug_print("called after messageview "
@@ -2886,41 +2970,41 @@ void main_window_get_size(MainWindow *mainwin)
                return;
        }
 
-       allocation = &(GTK_WIDGET_PTR(mainwin->summaryview)->allocation);
-       
        if (prefs_common.mainwin_fullscreen) {
                debug_print("mainwin in full screen state. "
                            "Keeping original settings\n");
        }
-       if (allocation->width > 1 && allocation->height > 1 && !prefs_common.mainwin_fullscreen) {
-               prefs_common.summaryview_width = allocation->width;
+
+       gtk_widget_get_allocation(GTK_WIDGET_PTR(mainwin->summaryview), &allocation);
+       if (allocation.width > 1 && allocation.height > 1 && !prefs_common.mainwin_fullscreen) {
+               prefs_common.summaryview_width = allocation.width;
 
                if (messageview_is_visible(mainwin->messageview))
-                       prefs_common.summaryview_height = allocation->height;
+                       prefs_common.summaryview_height = allocation.height;
 
-               prefs_common.mainview_width = allocation->width;
+               prefs_common.mainview_width = allocation.width;
        }
 
-       allocation = &mainwin->window->allocation;
-       if (allocation->width > 1 && allocation->height > 1 &&
+       gtk_widget_get_allocation(mainwin->window, &allocation);
+       if (allocation.width > 1 && allocation.height > 1 &&
            !prefs_common.mainwin_maximised && !prefs_common.mainwin_fullscreen) {
-               prefs_common.mainview_height = allocation->height;
-               prefs_common.mainwin_width   = allocation->width;
-               prefs_common.mainwin_height  = allocation->height;
+               prefs_common.mainview_height = allocation.height;
+               prefs_common.mainwin_width   = allocation.width;
+               prefs_common.mainwin_height  = allocation.height;
        }
 
-       allocation = &(GTK_WIDGET_PTR(mainwin->folderview)->allocation);
-       if (allocation->width > 1 && allocation->height > 1 &&
+       gtk_widget_get_allocation(GTK_WIDGET_PTR(mainwin->folderview), &allocation);
+       if (allocation.width > 1 && allocation.height > 1 &&
            !prefs_common.mainwin_fullscreen) {
-               prefs_common.folderview_width  = allocation->width;
-               prefs_common.folderview_height = allocation->height;
+               prefs_common.folderview_width  = allocation.width;
+               prefs_common.folderview_height = allocation.height;
        }
-
-       allocation = &(GTK_WIDGET_PTR(mainwin->messageview)->allocation);
-       if (allocation->width > 1 && allocation->height > 1 &&
+       
+       gtk_widget_get_allocation(GTK_WIDGET_PTR(mainwin->messageview), &allocation);
+       if (allocation.width > 1 && allocation.height > 1 &&
            !prefs_common.mainwin_fullscreen) {
-               prefs_common.msgview_width = allocation->width;
-               prefs_common.msgview_height = allocation->height;
+               prefs_common.msgview_width = allocation.width;
+               prefs_common.msgview_height = allocation.height;
        }
 
 /*     debug_print("summaryview size: %d x %d\n",
@@ -3054,6 +3138,10 @@ SensitiveCond main_window_get_current_state(MainWindow *mainwin)
                if ((selection == SUMMARY_NONE && item->hide_read_msgs)
                    || selection != SUMMARY_NONE)
                        state |= M_HIDE_READ_MSG;
+
+               if ((selection == SUMMARY_NONE && item->hide_read_threads)
+                   || selection != SUMMARY_NONE)
+                       state |= M_HIDE_READ_THREADS;
        }               
        if (mainwin->summaryview->threaded)
                state |= M_THREADED;
@@ -3069,6 +3157,11 @@ SensitiveCond main_window_get_current_state(MainWindow *mainwin)
                state |= M_NEWS;
        else
                state |= M_NOT_NEWS;
+       if (mainwin->summaryview->folder_item &&
+           (mainwin->summaryview->folder_item->stype != F_TRASH ||
+            !folder_has_parent_of_type(mainwin->summaryview->folder_item, F_TRASH)))
+               state |= M_NOT_TRASH;
+
        if (prefs_common.actions_list && g_slist_length(prefs_common.actions_list))
                state |= M_ACTIONS_EXIST;
 
@@ -3089,6 +3182,9 @@ SensitiveCond main_window_get_current_state(MainWindow *mainwin)
        if (cur_account)
                state |= M_HAVE_ACCOUNT;
        
+       if (cur_account && cur_account->protocol != A_NONE)
+               state |= M_HAVE_RETRIEVABLE_ACCOUNT;
+
        if (any_folder_want_synchronise())
                state |= M_WANT_SYNC;
 
@@ -3098,6 +3194,13 @@ SensitiveCond main_window_get_current_state(MainWindow *mainwin)
        if (g_list_length(account_list) > 1)
                state |= M_HAVE_MULTI_ACCOUNT;
 
+       for ( ; account_list != NULL; account_list = account_list->next) {
+               if (((PrefsAccount*)account_list->data)->protocol != A_NONE) {
+                       state |= M_HAVE_ANY_RETRIEVABLE_ACCOUNT;
+                       break;
+               }
+       }
+
        for ( ; account_list != NULL; account_list = account_list->next) {
                if (((PrefsAccount*)account_list->data)->protocol == A_NNTP) {
                        state |= M_HAVE_NEWS_ACCOUNT;
@@ -3155,14 +3258,16 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
        SummaryView *summaryview;
        gchar *menu_path;
        GtkWidget *menu;
-       GList *cur_item;
+       GList *children, *cur_item;
        gint i;
+       gboolean mimepart_selected = FALSE;
 
        static const struct {
                gchar *const entry;
                SensitiveCond cond;
        } entry[] = {
                {"Menu/File/SaveAs", M_TARGET_EXIST},
+               {"Menu/File/SavePartAs", M_SINGLE_TARGET_EXIST},
                {"Menu/File/Print"  , M_TARGET_EXIST},
                {"Menu/File/SynchroniseFolders", M_WANT_SYNC},
                {"Menu/File/Exit"      , M_UNLOCKED},
@@ -3177,6 +3282,7 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
                {"Menu/View/ThreadView"               , M_EXEC|M_SUMMARY_ISLIST},
                {"Menu/View/ExpandThreads"        , M_MSG_EXIST|M_SUMMARY_ISLIST},
                {"Menu/View/CollapseThreads"      , M_MSG_EXIST|M_SUMMARY_ISLIST},
+               {"Menu/View/HideReadThreads"       , M_HIDE_READ_THREADS|M_SUMMARY_ISLIST},
                {"Menu/View/HideReadMessages"      , M_HIDE_READ_MSG|M_SUMMARY_ISLIST},
                {"Menu/View/HideDelMessages"       , M_SUMMARY_ISLIST},
                {"Menu/View/Goto/Prev"        , M_MSG_EXIST},
@@ -3186,17 +3292,19 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
                {"Menu/View/Goto/PrevMarked" , M_MSG_EXIST},
                {"Menu/View/Goto/PrevLabeled", M_MSG_EXIST},
                {"Menu/View/Goto/NextLabeled", M_MSG_EXIST},
-               {"Menu/View/Goto/LastRead"   , M_SINGLE_TARGET_EXIST},
                {"Menu/View/Goto/ParentMessage"      , M_SINGLE_TARGET_EXIST},
+               {"Menu/View/Goto/NextPart"      , M_SINGLE_TARGET_EXIST},
+               {"Menu/View/Goto/PrevPart"      , M_SINGLE_TARGET_EXIST},
                {"Menu/View/OpenNewWindow"        , M_SINGLE_TARGET_EXIST},
                {"Menu/View/MessageSource"            , M_SINGLE_TARGET_EXIST},
+               {"Menu/View/Part"            , M_SINGLE_TARGET_EXIST},
                {"Menu/View/AllHeaders"                    , M_SINGLE_TARGET_EXIST},
                {"Menu/View/Quotes"                    , M_SINGLE_TARGET_EXIST},
 
                {"Menu/Message/Receive/CurrentAccount"
-                                                , M_HAVE_ACCOUNT|M_UNLOCKED},
+                                                , M_HAVE_ACCOUNT|M_UNLOCKED|M_HAVE_RETRIEVABLE_ACCOUNT},
                {"Menu/Message/Receive/AllAccounts"
-                                                , M_HAVE_ACCOUNT|M_UNLOCKED},
+                                                , M_HAVE_ACCOUNT|M_UNLOCKED|M_HAVE_ANY_RETRIEVABLE_ACCOUNT},
                {"Menu/Message/Receive/CancelReceiving"
                                                 , M_INC_ACTIVE},
                {"Menu/Message/SendQueue"  , M_HAVE_ACCOUNT|M_HAVE_QUEUED_MAILS},
@@ -3208,9 +3316,9 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
                {"Menu/Message/Forward"               , M_HAVE_ACCOUNT|M_TARGET_EXIST|M_SUMMARY_ISLIST},
                {"Menu/Message/ForwardAtt" , M_HAVE_ACCOUNT|M_TARGET_EXIST|M_SUMMARY_ISLIST},
                {"Menu/Message/Redirect"                  , M_HAVE_ACCOUNT|M_TARGET_EXIST|M_SUMMARY_ISLIST},
-               {"Menu/Message/Move"              , M_TARGET_EXIST|M_ALLOW_DELETE},
+               {"Menu/Message/Move"              , M_TARGET_EXIST|M_ALLOW_DELETE|M_NOT_NEWS},
                {"Menu/Message/Copy"              , M_TARGET_EXIST|M_EXEC},
-               {"Menu/Message/Trash"     , M_TARGET_EXIST|M_ALLOW_DELETE|M_NOT_NEWS},
+               {"Menu/Message/Trash"     , M_TARGET_EXIST|M_ALLOW_DELETE|M_NOT_NEWS|M_NOT_TRASH},
                {"Menu/Message/Delete"            , M_TARGET_EXIST|M_ALLOW_DELETE},
                {"Menu/Message/CancelNews" , M_TARGET_EXIST|M_ALLOW_DELETE|M_NEWS},
                {"Menu/Message/Mark"              , M_TARGET_EXIST|M_SUMMARY_ISLIST},
@@ -3223,6 +3331,7 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
                {"Menu/Message/ColorLabel"                , M_TARGET_EXIST},
                {"Menu/Message/Tags"              , M_TARGET_EXIST},
                {"Menu/Message/Reedit"               , M_HAVE_ACCOUNT|M_ALLOW_REEDIT},
+               {"Menu/Message/CheckSignature"               , M_SINGLE_TARGET_EXIST},
 
                {"Menu/Tools/AddSenderToAB"   , M_SINGLE_TARGET_EXIST},
                {"Menu/Tools/CollectAddresses"            , M_FOLDER_SELECTED},
@@ -3261,8 +3370,8 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
        menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(
                gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/Message/Receive")));
 
-       for (cur_item = GTK_MENU_SHELL(menu)->children; cur_item != NULL;
-            cur_item = cur_item->next) {
+       children = gtk_container_get_children(GTK_CONTAINER(menu));
+       for (cur_item = children; cur_item != NULL; cur_item = cur_item->next) {
                if (cur_item->data == gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/Message/Receive/Separator1")) {
                        cur_item = cur_item->next;
                        break;
@@ -3274,13 +3383,14 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
                                         (M_UNLOCKED & state) != 0);
        }
 
+       g_list_free(children);
+
        main_window_menu_callback_block(mainwin);
 
        cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/ShowHide/MessageView",
                              messageview_is_visible(mainwin->messageview));
 
        summaryview = mainwin->summaryview;
-       menu_path = "Menu/View/Sort/DontSort";
 
        switch (summaryview->sort_key) {
        case SORT_BY_NUMBER:
@@ -3335,11 +3445,35 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
        &&  mainwin->messageview->mimeview
        &&  mainwin->messageview->mimeview->textview)
                cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/AllHeaders",
-                             mainwin->messageview->mimeview->textview->show_all_headers);
+                                               prefs_common.show_all_headers);
        cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/ThreadView", (state & M_THREADED) != 0);
-       cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Quotes/FoldAll", (prefs_common.hide_quotes == 1));
-       cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Quotes/Fold2", (prefs_common.hide_quotes == 2));
-       cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Quotes/Fold3", (prefs_common.hide_quotes == 3));
+       cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/ExpandThreads", (state & M_THREADED) != 0);
+       cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/CollapseThreads", (state & M_THREADED) != 0);
+       cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/HideReadThreads", (state & M_THREADED) != 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->hide_read_msgs)
+               cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/HideReadThreads", FALSE);
+       if (mainwin->summaryview->folder_item && mainwin->summaryview->folder_item->hide_read_threads)
+               cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/HideReadMessages", FALSE);
+
+       cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/Goto/PrevHistory",
+               messageview_nav_has_prev(mainwin->messageview));
+       cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/Goto/NextHistory",
+               messageview_nav_has_next(mainwin->messageview));
+
+       if (mainwin->messageview 
+       &&  mainwin->messageview->mimeview)
+               mimepart_selected = !mimeview_tree_is_empty(mainwin->messageview->mimeview);
+
+       cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/File/SavePartAs", mimepart_selected);
+       cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/Goto/NextPart", mimepart_selected);
+       cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/Goto/PrevPart", mimepart_selected);
+       cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/Part", mimepart_selected);
+       cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/Message/CheckSignature", 
+                                  mimepart_selected && mainwin->messageview->mimeview->signed_part);
 
        main_window_menu_callback_unblock(mainwin);
 }
@@ -3413,25 +3547,25 @@ static gint mailing_list_populate_submenu (GtkWidget *menuitem, const gchar * li
        GtkWidget *item, *menu;
        const gchar *url_pt ;
        gchar url_decoded[BUFFSIZE];
-       GList *amenu, *alist;
+       GList *children, *amenu;
        gint menu_nb = 0;
        
        menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(menuitem));
        
        /* First delete old submenu */
        /* FIXME: we can optimize this, and only change/add/delete necessary items */
-       for (amenu = (GTK_MENU_SHELL(menu)->children) ; amenu; ) {
-               alist = amenu->next;
+       children = gtk_container_get_children(GTK_CONTAINER(menu));
+       for (amenu = children; amenu; amenu = amenu->next) {
                item = GTK_WIDGET (amenu->data);
                gtk_widget_destroy (item);
-               amenu = alist;
        }
+       g_list_free(children);
        if (list_header) {
                for (url_pt = list_header; url_pt && *url_pt;) {
-                       get_url_part (&url_pt, url_decoded, BUFFSIZE);
+                       get_url_part (&url_pt, url_decoded);
                        item = NULL;
                        if (!g_ascii_strncasecmp(url_decoded, "mailto:", 7)) {
-                               item = gtk_menu_item_new_with_label ((url_decoded));
+                               item = cm_menu_item_new_label_from_url ((url_decoded));
                                g_signal_connect(G_OBJECT(item), "activate",
                                                 G_CALLBACK(mailing_list_compose),
                                                 NULL);
@@ -3439,7 +3573,7 @@ static gint mailing_list_populate_submenu (GtkWidget *menuitem, const gchar * li
                        else if (!g_ascii_strncasecmp(url_decoded, "http:", 5) ||
                                 !g_ascii_strncasecmp(url_decoded, "https:",6)) {
 
-                               item = gtk_menu_item_new_with_label ((url_decoded));
+                               item = cm_menu_item_new_label_from_url ((url_decoded));
                                g_signal_connect(G_OBJECT(item), "activate",
                                                 G_CALLBACK(mailing_list_open_uri),
                                                 NULL);
@@ -3460,7 +3594,7 @@ static gint mailing_list_populate_submenu (GtkWidget *menuitem, const gchar * li
        return menu_nb;
 }
 
-static void get_url_part (const gchar **buffer, gchar *url_decoded, gint maxlen)
+static void get_url_part (const gchar **buffer, gchar *url_decoded)
 {
        gchar tmp[BUFFSIZE];
        const gchar *buf;
@@ -3483,7 +3617,9 @@ static void get_url_part (const gchar **buffer, gchar *url_decoded, gint maxlen)
                buf++;
                if (!strncmp(buf, "mailto:", strlen("mailto:")))
                        with_plus = FALSE;
-               for (i = 0; *buf != '>' && *buf != 0x00 && i<maxlen; tmp[i++] = *(buf++));
+               for (i = 0;
+                    *buf != '>' && *buf != 0x00 && i < BUFFSIZE;
+                       tmp[i++] = *(buf++));
                buf++;
        }
        else  {
@@ -3492,13 +3628,13 @@ static void get_url_part (const gchar **buffer, gchar *url_decoded, gint maxlen)
                return;
        }
        
-       tmp[i]       = 0x00;
        *url_decoded = '\0';
        *buffer = NULL;
        
-       if (i == maxlen) {
+       if (i == BUFFSIZE) {
                return;
        }
+       tmp[i] = 0x00;
        decode_uri_with_plus (url_decoded, (const gchar *)tmp, with_plus);
 
        /* Prepare the work for the next url in the list */
@@ -3564,21 +3700,18 @@ void main_window_popup(MainWindow *mainwin)
 {
        static gboolean first_start = TRUE;
 
-       if (!gtkut_widget_get_visible(GTK_WIDGET(mainwin->window)))
+       if (!gtk_widget_get_visible(GTK_WIDGET(mainwin->window)))
                main_window_show(mainwin);
 
        if (prefs_common.mainwin_maximised)
                gtk_window_maximize(GTK_WINDOW(mainwin->window));
 
        if (first_start) {
-#ifdef G_OS_UNIX
-               gtk_window_deiconify(GTK_WINDOW(mainwin->window));
-               gtkut_window_popup(mainwin->window);
-#endif
                first_start = FALSE;
        } else {
                gtkut_window_popup(mainwin->window);
        }
+
        if (prefs_common.layout_mode == SMALL_LAYOUT) {
                if (mainwin->in_folder) {
                        mainwindow_enter_folder(mainwin);
@@ -3597,7 +3730,7 @@ void main_window_show(MainWindow *mainwin)
         gtk_window_move(GTK_WINDOW(mainwin->window),
                                  prefs_common.mainwin_x,
                                  prefs_common.mainwin_y);
-
+       
        gtk_widget_set_size_request(GTK_WIDGET_PTR(mainwin->folderview),
                             prefs_common.folderview_width,
                             prefs_common.folderview_height);
@@ -3629,33 +3762,13 @@ static void main_window_set_widgets(MainWindow *mainwin, LayoutType layout_mode)
        gboolean first_set = (mainwin->hpaned == NULL);
        debug_print("Setting widgets... ");
 
-       if (layout_mode == SMALL_LAYOUT && first_set) {
-               gtk_widget_set_size_request(GTK_WIDGET_PTR(mainwin->folderview),
-                                   prefs_common.folderview_width,
-                                   prefs_common.folderview_height);
-               gtk_widget_set_size_request(GTK_WIDGET_PTR(mainwin->summaryview),
-                                   0,0);
-               gtk_widget_set_size_request(GTK_WIDGET_PTR(mainwin->messageview),
-                                   0,0);
-       } else {
-               gtk_widget_set_size_request(GTK_WIDGET_PTR(mainwin->folderview),
-                                   prefs_common.folderview_width,
-                                   prefs_common.folderview_height);
-               gtk_widget_set_size_request(GTK_WIDGET_PTR(mainwin->summaryview),
-                                   prefs_common.summaryview_width,
-                                   prefs_common.summaryview_height);
-               gtk_widget_set_size_request(GTK_WIDGET_PTR(mainwin->messageview),
-                                   prefs_common.msgview_width,
-                                   prefs_common.msgview_height);
-       }
-
 #ifndef GENERIC_UMPC
        mainwin->messageview->statusbar = mainwin->statusbar;
        mainwin->messageview->statusbar_cid = mainwin->messageview_cid;
 #endif
        /* clean top-most container */
        if (mainwin->hpaned) {
-               if (mainwin->hpaned->parent == mainwin->vpaned)
+               if (gtk_widget_get_parent(mainwin->hpaned) == mainwin->vpaned)
                        gtk_widget_destroy(mainwin->vpaned);
                else
                        gtk_widget_destroy(mainwin->hpaned);
@@ -3680,8 +3793,8 @@ static void main_window_set_widgets(MainWindow *mainwin, LayoutType layout_mode)
 
                if (messageview_is_visible(mainwin->messageview)) {
                        gtk_paned_add2(GTK_PANED(hpaned), vpaned);
-                       gtk_paned_add1(GTK_PANED(vpaned),
-                                      GTK_WIDGET_PTR(mainwin->summaryview));
+                       gtk_paned_pack1(GTK_PANED(vpaned),
+                                      GTK_WIDGET_PTR(mainwin->summaryview), TRUE, TRUE);
                } else {
                        gtk_paned_add2(GTK_PANED(hpaned),
                                       GTK_WIDGET_PTR(mainwin->summaryview));
@@ -3771,6 +3884,19 @@ static void main_window_set_widgets(MainWindow *mainwin, LayoutType layout_mode)
                                prefs_common.mainwin_width,
                                prefs_common.mainwin_height);
                gtk_paned_set_position(GTK_PANED(mainwin->hpaned), 800);
+       } else {
+               gtk_widget_set_size_request(GTK_WIDGET_PTR(mainwin->folderview),
+                                   prefs_common.folderview_width,
+                                   prefs_common.folderview_height);
+               gtk_widget_set_size_request(GTK_WIDGET_PTR(mainwin->summaryview),
+                                   prefs_common.summaryview_width,
+                                   prefs_common.summaryview_height);
+               gtk_widget_set_size_request(GTK_WIDGET_PTR(mainwin->messageview),
+                                   prefs_common.msgview_width,
+                                   prefs_common.msgview_height);
+               gtk_widget_set_size_request(GTK_WIDGET(mainwin->window),
+                                   prefs_common.mainwin_width,
+                                   prefs_common.mainwin_height);
        } 
        /* remove headerview if not in prefs */
        headerview_set_visibility(mainwin->messageview->headerview,
@@ -3846,7 +3972,7 @@ void main_window_destroy_all(void)
 {
        while (mainwin_list != NULL) {
                MainWindow *mainwin = (MainWindow*)mainwin_list->data;
-               
+
                /* free toolbar stuff */
                toolbar_clear_list(TOOLBAR_MAIN);
                TOOLBAR_DESTROY_ACTIONS(mainwin->toolbar->action_list);
@@ -4100,12 +4226,12 @@ static void toggle_col_headers_cb(GtkAction *gaction, gpointer data)
        if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (gaction))) {
                gtk_cmclist_column_titles_show(GTK_CMCLIST(folderview->ctree));
                gtk_cmclist_column_titles_show(GTK_CMCLIST(summaryview->ctree));
-               gtk_cmclist_column_titles_show(GTK_CMCLIST(mimeview->ctree));
+               gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(mimeview->ctree), TRUE);
                prefs_common.show_col_headers = TRUE;
        } else {
                gtk_cmclist_column_titles_hide(GTK_CMCLIST(folderview->ctree));
                gtk_cmclist_column_titles_hide(GTK_CMCLIST(summaryview->ctree));
-               gtk_cmclist_column_titles_hide(GTK_CMCLIST(mimeview->ctree));           
+               gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(mimeview->ctree), FALSE);               
                prefs_common.show_col_headers = FALSE;
        }
 }
@@ -4162,12 +4288,21 @@ static void set_layout_cb(GtkAction *action, GtkRadioAction *current, gpointer d
 void main_window_toggle_work_offline (MainWindow *mainwin, gboolean offline,
                                        gboolean ask_sync)
 {
+       static gboolean switching = FALSE;
+
+       if (switching)
+               return;
+
+       switching = TRUE;
+
        offline_ask_sync = ask_sync;
        if (offline)
                online_switch_clicked (GTK_BUTTON(mainwin->online_switch), mainwin);
        else
                online_switch_clicked (GTK_BUTTON(mainwin->offline_switch), mainwin);
        offline_ask_sync = TRUE;
+
+       switching = FALSE;
 }
 
 static void toggle_work_offline_cb (GtkAction *action, gpointer data)
@@ -4238,6 +4373,7 @@ static void online_switch_clicked (GtkButton *btn, gpointer data)
                        mainwindow_check_synchronise(mainwin, TRUE);
                prefs_common.work_offline = TRUE;
                imap_disconnect_all(have_connectivity);
+               nntp_disconnect_all(have_connectivity);
                hooks_invoke(OFFLINE_SWITCH_HOOKLIST, NULL);
        } else {
                /*go online */
@@ -4257,7 +4393,18 @@ static void online_switch_clicked (GtkButton *btn, gpointer data)
 
 static void addressbook_open_cb(GtkAction *action, gpointer data)
 {
+#ifndef USE_NEW_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_error_free(error);
+       }
+#endif
 }
 
 static void log_window_show_cb(GtkAction *action, gpointer data)
@@ -4324,7 +4471,7 @@ static void show_all_header_cb(GtkAction *action, gpointer data)
 {
        MainWindow *mainwin = (MainWindow *)data;
        if (mainwin->menu_lock_count) return;
-       mainwin->summaryview->messageview->all_headers = 
+       prefs_common.show_all_headers = 
                        gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
        summary_display_msg_selected(mainwin->summaryview,
                                     gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
@@ -4352,16 +4499,16 @@ static void hide_quotes_cb(GtkAction *action, gpointer data)
 
        if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) {
                const gchar *a_name = gtk_action_get_name(GTK_ACTION(action));
-               if (!strcmp(a_name, "View/Quotes/FoldAll")) prefs_common.hide_quotes = 1;
-               else if (!strcmp(a_name, "View/Quotes/Fold2")) prefs_common.hide_quotes = 2;
-               else if (!strcmp(a_name, "View/Quotes/Fold3")) prefs_common.hide_quotes = 3;
+               if (!strcmp(a_name, "View/Quotes/CollapseAll")) prefs_common.hide_quotes = 1;
+               else if (!strcmp(a_name, "View/Quotes/Collapse2")) prefs_common.hide_quotes = 2;
+               else if (!strcmp(a_name, "View/Quotes/Collapse3")) prefs_common.hide_quotes = 3;
        } else
                prefs_common.hide_quotes = 0;
 
        mainwin->menu_lock_count++;
-       cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Quotes/FoldAll", (prefs_common.hide_quotes == 1));
-       cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Quotes/Fold2", (prefs_common.hide_quotes == 2));
-       cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Quotes/Fold3", (prefs_common.hide_quotes == 3));
+       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));
        mainwin->menu_lock_count--;
 
        summary_redisplay_msg(mainwin->summaryview);
@@ -4457,7 +4604,7 @@ static void open_urls_cb(GtkAction *action, gpointer data)
        MainWindow *mainwin = (MainWindow *)data;
        if (!mainwin->summaryview->displayed && mainwin->summaryview->selected) {
                summary_display_msg_selected(mainwin->summaryview, 
-                       mainwin->messageview->mimeview->textview->show_all_headers);
+                                            prefs_common.show_all_headers);
        }
        messageview_list_urls(mainwin->messageview);
 }
@@ -4520,6 +4667,16 @@ static void hide_del_messages (GtkAction *action, gpointer data)
        summary_toggle_show_del_messages(mainwin->summaryview);
 }
 
+static void hide_read_threads (GtkAction *action, gpointer data)
+{
+       MainWindow *mainwin = (MainWindow *)data;
+       GtkWidget *menuitem = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/View/HideReadThreads");
+       if (!mainwin->summaryview->folder_item
+           || g_object_get_data(G_OBJECT(menuitem), "dont_toggle"))
+               return;
+       summary_toggle_show_read_threads(mainwin->summaryview);
+}
+
 static void thread_cb(GtkAction *action, gpointer data)
 {
        MainWindow *mainwin = (MainWindow *)data;
@@ -4758,10 +4915,33 @@ static void next_labeled_cb(GtkAction *action, gpointer data)
        summary_select_next_labeled(mainwin->summaryview);
 }
 
-static void last_read_cb(GtkAction *action, gpointer data)
+static void prev_history_cb(GtkAction *action, gpointer data)
 {
        MainWindow *mainwin = (MainWindow *)data;
-       summary_select_last_read(mainwin->summaryview);
+       MsgInfo *info = messageview_nav_get_prev(mainwin->messageview);
+       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);
+               main_window_set_menu_sensitive(mainwindow_get_mainwindow());
+               toolbar_main_set_sensitive(mainwindow_get_mainwindow());
+       }
+}
+
+static void next_history_cb(GtkAction *action, gpointer data)
+{
+       MainWindow *mainwin = (MainWindow *)data;
+       MsgInfo *info = messageview_nav_get_next(mainwin->messageview);
+       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);
+               main_window_set_menu_sensitive(mainwindow_get_mainwindow());
+               toolbar_main_set_sensitive(mainwindow_get_mainwindow());
+       }
 }
 
 static void parent_cb(GtkAction *action, gpointer data)
@@ -4787,6 +4967,30 @@ static void goto_unread_folder_cb(GtkAction *action, gpointer data)
        folderview_select_next_unread(mainwin->folderview, FALSE);
 }
 
+static void scroll_prev_line_cb(GtkAction *action, gpointer data)
+{
+        MainWindow *mainwin = (MainWindow *)data;
+        mimeview_scroll_one_line(mainwin->messageview->mimeview,TRUE);
+}
+
+static void scroll_next_line_cb(GtkAction *action, gpointer data)
+{
+        MainWindow *mainwin = (MainWindow *)data;
+        mimeview_scroll_one_line(mainwin->messageview->mimeview,FALSE);
+}
+
+static void scroll_prev_page_cb(GtkAction *action, gpointer data)
+{
+        MainWindow *mainwin = (MainWindow *)data;
+        mimeview_scroll_page(mainwin->messageview->mimeview,TRUE);
+}
+
+static void scroll_next_page_cb(GtkAction *action, gpointer data)
+{
+        MainWindow *mainwin = (MainWindow *)data;
+        mimeview_scroll_page(mainwin->messageview->mimeview,FALSE);
+}
+
 static void copy_cb(GtkAction *action, gpointer data)
 {
        MainWindow *mainwin = (MainWindow *)data;
@@ -4799,7 +5003,7 @@ static void allsel_cb(GtkAction *action, gpointer data)
        MessageView *msgview = mainwin->messageview;
 
        if (messageview_is_visible(msgview) &&
-                (gtkut_widget_has_focus(msgview->mimeview->textview->text)))
+                (gtk_widget_has_focus(msgview->mimeview->textview->text)))
                messageview_select_all(mainwin->messageview);
        else
                summary_select_all(mainwin->summaryview);
@@ -5120,6 +5324,7 @@ gboolean mainwindow_is_obscured(void)
 static void addr_harvest_cb( GtkAction *action, gpointer data)
 {
        MainWindow *mainwin = (MainWindow *)data;
+
        addressbook_harvest( mainwin->summaryview->folder_item, FALSE, NULL );
 }
 
@@ -5305,6 +5510,69 @@ void mainwindow_enter_folder(MainWindow *mainwin) {
        main_window_set_menu_sensitive(mainwin);
 }
 
+static void save_part_as_cb(GtkAction *action, gpointer data)
+{
+       MainWindow *mainwin = (MainWindow *)data;
+
+       if (mainwin->messageview 
+       &&  mainwin->messageview->mimeview)
+               mimeview_save_as(mainwin->messageview->mimeview);
+}
+
+static void view_part_as_text_cb(GtkAction *action, gpointer data)
+{
+       MainWindow *mainwin = (MainWindow *)data;
+
+       if (mainwin->messageview 
+       &&  mainwin->messageview->mimeview)
+               mimeview_display_as_text(mainwin->messageview->mimeview);
+}
+
+static void open_part_cb(GtkAction *action, gpointer data)
+{
+       MainWindow *mainwin = (MainWindow *)data;
+
+       if (mainwin->messageview 
+       &&  mainwin->messageview->mimeview)
+               mimeview_launch(mainwin->messageview->mimeview, NULL);
+}
+#ifndef G_OS_WIN32
+static void open_part_with_cb(GtkAction *action, gpointer data)
+{
+       MainWindow *mainwin = (MainWindow *)data;
+
+       if (mainwin->messageview 
+       &&  mainwin->messageview->mimeview)
+               mimeview_open_with(mainwin->messageview->mimeview);
+}
+#endif
+static void check_signature_cb(GtkAction *action, gpointer data)
+{
+       MainWindow *mainwin = (MainWindow *)data;
+
+       if (mainwin->messageview 
+       &&  mainwin->messageview->mimeview)
+               mimeview_check_signature(mainwin->messageview->mimeview);
+}
+
+static void goto_next_part_cb(GtkAction *action, gpointer data)
+{
+       MainWindow *mainwin = (MainWindow *)data;
+
+       if (mainwin->messageview 
+       &&  mainwin->messageview->mimeview)
+               mimeview_select_next_part(mainwin->messageview->mimeview);
+}
+
+static void goto_prev_part_cb(GtkAction *action, gpointer data)
+{
+       MainWindow *mainwin = (MainWindow *)data;
+
+       if (mainwin->messageview 
+       &&  mainwin->messageview->mimeview)
+               mimeview_select_prev_part(mainwin->messageview->mimeview);
+}
+
 #ifdef MAEMO
 gboolean maemo_mainwindow_is_fullscreen(GtkWidget *widget)
 {