2012-11-27 [colin] 3.9.0cvs22
[claws.git] / src / mainwindow.c
index 7e1a24dac120198be0e7b417de2695a8e1fead2a..ac02149bd74a7dea4aa143f6bc702692c8961535 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"
@@ -306,7 +312,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);
@@ -431,7 +439,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);
  
@@ -441,6 +449,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)
@@ -501,7 +518,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) },
@@ -525,8 +544,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, "---" },
 
 
@@ -557,14 +576,19 @@ 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/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",                         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) },
@@ -595,6 +619,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) },
@@ -615,9 +648,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, "---" },*/
 
@@ -638,14 +671,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) },
@@ -654,7 +687,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) },
@@ -673,6 +708,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 */
 
@@ -680,8 +718,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) }, 
@@ -796,20 +834,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 */
 };
 
@@ -1020,7 +1058,6 @@ static void mainwindow_tags_menu_item_activate_item_cb(GtkMenuItem *menu_item,
        for (; sel != NULL; sel = sel->next) {
                MsgInfo *msginfo;
                GSList *tags = NULL;
-               gint id;
                GtkCheckMenuItem *item;
                msginfo = (MsgInfo *)sel->data;
                sel_len++;
@@ -1031,7 +1068,6 @@ 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 && !gtk_check_menu_item_get_active(item)) {
                                        gtk_check_menu_item_set_active
@@ -1141,7 +1177,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);
@@ -1161,7 +1197,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);
@@ -1266,7 +1302,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);
@@ -1645,12 +1681,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 */
@@ -1742,11 +1780,16 @@ 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)
@@ -1827,7 +1870,13 @@ MainWindow *main_window_create()
        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", "Separator6", "View/---", GTK_UI_MANAGER_SEPARATOR)
+       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 */
@@ -1881,15 +1930,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)
@@ -1898,6 +1949,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)
@@ -2115,7 +2167,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);
@@ -2428,7 +2480,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), 
@@ -2864,7 +2918,6 @@ void main_window_toggle_message_view(MainWindow *mainwin)
                }
                break;
        case WIDE_LAYOUT:
-               ppaned = mainwin->hpaned;
                container = mainwin->vpaned;
                if (gtk_widget_get_parent(mainwin->messageview->vbox) != NULL) {
                        mainwin->messageview->visible = FALSE;
@@ -3128,6 +3181,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;
 
@@ -3137,6 +3193,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;
@@ -3196,12 +3259,14 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
        GtkWidget *menu;
        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},
@@ -3226,17 +3291,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},
@@ -3263,6 +3330,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},
@@ -3322,7 +3390,6 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
                              messageview_is_visible(mainwin->messageview));
 
        summaryview = mainwin->summaryview;
-       menu_path = "Menu/View/Sort/DontSort";
 
        switch (summaryview->sort_key) {
        case SORT_BY_NUMBER:
@@ -3390,7 +3457,23 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
                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);
 }
 
@@ -3478,10 +3561,10 @@ static gint mailing_list_populate_submenu (GtkWidget *menuitem, const gchar * li
        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);
@@ -3489,7 +3572,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);
@@ -3510,7 +3593,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;
@@ -3533,7 +3616,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  {
@@ -3542,13 +3627,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 */
@@ -3707,8 +3792,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));
@@ -3886,7 +3971,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);
@@ -4202,12 +4287,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)
@@ -4297,7 +4391,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)
@@ -4808,10 +4913,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;
+       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;
-       summary_select_last_read(mainwin->summaryview);
+       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)
@@ -5194,6 +5322,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 );
 }
 
@@ -5379,6 +5508,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)
 {