2012-11-27 [colin] 3.9.0cvs22
[claws.git] / src / mainwindow.c
index 6d26837c7e3b3c80fa0021805d59db2138ae31e3..ac02149bd74a7dea4aa143f6bc702692c8961535 100644 (file)
@@ -1,6 +1,6 @@
 /*
    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
 #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"
@@ -437,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);
  
@@ -447,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)
@@ -507,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) },
@@ -531,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, "---" },
 
 
@@ -570,6 +583,9 @@ static GtkActionEntry mainwin_entries[] =
        /* {"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") },
@@ -603,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) },
@@ -623,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, "---" },*/
 
@@ -646,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) },
@@ -662,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) },
@@ -681,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 */
 
@@ -688,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) }, 
@@ -804,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 */
 };
 
@@ -1147,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);
@@ -1167,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);
@@ -1272,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);
@@ -1651,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 */
@@ -1755,6 +1787,9 @@ MainWindow *main_window_create()
        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)
@@ -1835,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 */
@@ -1889,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)
@@ -1906,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)
@@ -2123,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);
@@ -2874,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;
@@ -3216,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},
@@ -3247,8 +3292,11 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
                {"Menu/View/Goto/PrevLabeled", M_MSG_EXIST},
                {"Menu/View/Goto/NextLabeled", M_MSG_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},
 
@@ -3282,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},
@@ -3341,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:
@@ -3415,6 +3463,17 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
        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);
 }
 
@@ -3502,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);
@@ -3513,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);
@@ -3534,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;
@@ -3557,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  {
@@ -3566,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 */
@@ -4226,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)
@@ -5438,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)
 {