Addendum to 503cb50 (Fix build with --with-password-encryption=old)
[claws.git] / src / mainwindow.c
index 517db91516ab8c0f18832feeb1e2ac9d80687055..080d97f1ba2591972b73722d2b7a841ba15beaae 100644 (file)
@@ -46,6 +46,7 @@
 #include "import.h"
 #include "export.h"
 #include "edittags.h"
+#include "password.h"
 #include "prefs_common.h"
 #include "prefs_actions.h"
 #include "prefs_filtering.h"
@@ -55,7 +56,7 @@
 #include "prefs_template.h"
 #include "action.h"
 #include "account.h"
-#ifndef USE_NEW_ADDRBOOK
+#ifndef USE_ALT_ADDRBOOK
        #include "addressbook.h"
 #else
        #include "addressbook-dbus.h"
@@ -201,6 +202,8 @@ static void show_all_header_cb              (GtkAction      *action,
                                  gpointer       data);
 static void toggle_fullscreen_cb       (GtkAction      *action,
                                  gpointer       data);
+static void toggle_menubar_cb  (GtkAction      *action,
+                                 gpointer       data);
 
 static void hide_quotes_cb(GtkAction   *action,
                                  gpointer       data);
@@ -344,6 +347,8 @@ static void allsel_cb                (GtkAction     *action,
                                  gpointer       data);
 static void select_thread_cb    (GtkAction     *action,
                                  gpointer       data);
+static void trash_thread_cb     (GtkAction     *action,
+                                 gpointer       data);
 static void delete_thread_cb    (GtkAction     *action,
                                  gpointer       data);
 
@@ -424,7 +429,10 @@ static void sync_cb                 ( GtkAction    *action,
 
 static void forget_session_passwords_cb        (GtkAction      *action,
                                         gpointer        data );
-
+#ifndef PASSWORD_CRYPTO_OLD
+static void forget_master_password_cb  (GtkAction      *action,
+                                        gpointer        data );
+#endif
 static gboolean mainwindow_focus_in_event      (GtkWidget      *widget, 
                                                 GdkEventFocus  *focus,
                                                 gpointer        data);
@@ -538,7 +546,6 @@ static GtkActionEntry mainwin_entries[] =
        {"Edit/Copy",                           NULL, N_("_Copy"), "<control>C", NULL, G_CALLBACK(copy_cb) }, 
        {"Edit/SelectAll",                      NULL, N_("Select _all"), "<control>A", NULL, G_CALLBACK(allsel_cb) }, 
        {"Edit/SelectThread",                   NULL, N_("Select _thread"), NULL, NULL, G_CALLBACK(select_thread_cb) }, 
-       {"Edit/DeleteThread",                   NULL, N_("_Delete thread"), NULL, NULL, G_CALLBACK(delete_thread_cb) }, 
        {"Edit/---",                            NULL, "---" },
        {"Edit/Find",                           NULL, N_("_Find in current message..."), "<control>F", NULL, G_CALLBACK(search_cb) },
        {"Edit/SearchFolder",                   NULL, N_("_Search folder..."), "<shift><control>F", NULL, G_CALLBACK(search_folder_cb) },
@@ -683,6 +690,8 @@ static GtkActionEntry mainwin_entries[] =
        {"Message/Copy",                        NULL, N_("_Copy..."), "<shift><control>O", NULL, G_CALLBACK(copy_to_cb) },
        {"Message/Trash",                       NULL, N_("Move to _trash"), "<control>D", NULL, G_CALLBACK(delete_trash_cb) },
        {"Message/Delete",                      NULL, N_("_Delete..."), NULL, NULL, G_CALLBACK(delete_cb) },
+       {"Message/TrashThread",                 NULL, N_("Move thread to tr_ash"), NULL, NULL, G_CALLBACK(trash_thread_cb) }, 
+       {"Message/DeleteThread",                NULL, N_("Delete t_hread"), NULL, NULL, G_CALLBACK(delete_thread_cb) }, 
        {"Message/CancelNews",                  NULL, N_("Cancel a news message"), NULL, NULL, G_CALLBACK(cancel_cb) },
        /* separation */
        
@@ -771,6 +780,9 @@ static GtkActionEntry mainwin_entries[] =
        {"Tools/NetworkLog",                    NULL, N_("Network _Log"), "<shift><control>L", NULL, G_CALLBACK(log_window_show_cb) }, 
        /* {"Tools/---",                        NULL, "---", NULL, NULL, NULL }, */
        {"Tools/ForgetSessionPasswords",                NULL, N_("_Forget all session passwords"), NULL, NULL, G_CALLBACK(forget_session_passwords_cb) }, 
+#ifndef PASSWORD_CRYPTO_OLD
+       {"Tools/ForgetMasterPassword",          NULL, N_("Forget _master password"), NULL, NULL, G_CALLBACK(forget_master_password_cb) },
+#endif
 
 /* Configuration menu */       
        {"Configuration/ChangeAccount",         NULL, N_("C_hange current account") },
@@ -803,6 +815,7 @@ static GtkActionEntry mainwin_entries[] =
 
 static GtkToggleActionEntry mainwin_toggle_entries[] = {
        {"File/OfflineMode",                    NULL, N_("Offline _mode"), "<control>W", NULL, G_CALLBACK(toggle_work_offline_cb) }, /*toggle*/
+       {"View/ShowHide/MenuBar",               NULL, N_("Men_ubar"), "F12", NULL, G_CALLBACK(toggle_menubar_cb) }, /* toggle */
        {"View/ShowHide/MessageView",           NULL, N_("_Message view"), "V", NULL, G_CALLBACK(toggle_message_cb) }, /* toggle */
 #ifndef GENERIC_UMPC
        {"View/ShowHide/StatusBar",             NULL, N_("Status _bar"), NULL, NULL, G_CALLBACK(toggle_statusbar_cb) }, /* toggle */
@@ -879,6 +892,7 @@ static GtkRadioActionEntry mainwin_radio_enc_entries[] =
        ENC_ACTION(CS_ISO_8859_9, C_ISO_8859_9, N_("Turkish (ISO-8859-_9)")), /* RADIO set_charset_cb */
        ENC_ACTION("Cyrillic/"CS_ISO_8859_5, C_ISO_8859_5, "ISO-8859-_5"), /* RADIO set_charset_cb */
        ENC_ACTION("Cyrillic/"CS_KOI8_R, C_KOI8_R, "KOI8-_R"), /* RADIO set_charset_cb */
+       ENC_ACTION("Cyrillic/"CS_MACCYR, C_MACCYR, "_Mac-Cyrillic"), /* RADIO set_charset_cb */
        ENC_ACTION("Cyrillic/"CS_KOI8_U, C_KOI8_U, "KOI8-_U"), /* RADIO set_charset_cb */
        ENC_ACTION("Cyrillic/"CS_WINDOWS_1251, C_WINDOWS_1251, "Windows-1251"), /* RADIO set_charset_cb */
        ENC_ACTION("Japanese/"CS_ISO_2022_JP, C_ISO_2022_JP, "ISO-2022-_JP"), /* RADIO set_charset_cb */
@@ -985,7 +999,7 @@ static void mainwindow_colorlabel_menu_item_activate_item_cb(GtkMenuItem *menu_i
                        }
                }
        } else
-               g_warning("invalid number of color elements (%d)\n", n);
+               g_warning("invalid number of color elements (%d)", n);
 
        g_slist_free(sel);
        /* reset "dont_toggle" state */
@@ -1241,7 +1255,7 @@ static gint mainwin_tag_cmp_list(gconstpointer a, gconstpointer b)
                return tag_b == NULL ? 0:1;
        
        if (tag_b == NULL)
-               return tag_a == NULL ? 0:1;
+               return 1;
  
        return g_utf8_collate(tag_a, tag_b);
 }
@@ -1535,7 +1549,6 @@ MainWindow *main_window_create()
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Edit", "Copy", "Edit/Copy", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Edit", "SelectAll", "Edit/SelectAll", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Edit", "SelectThread", "Edit/SelectThread", GTK_UI_MANAGER_MENUITEM)
-       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Edit", "DeleteThread", "Edit/DeleteThread", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Edit", "Separator1", "Edit/---", GTK_UI_MANAGER_SEPARATOR)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Edit", "Find", "Edit/Find", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Edit", "SearchFolder", "Edit/SearchFolder", GTK_UI_MANAGER_MENUITEM)
@@ -1543,6 +1556,7 @@ MainWindow *main_window_create()
 
 /* View menu */
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "ShowHide", "View/ShowHide", GTK_UI_MANAGER_MENU)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/ShowHide", "MenuBar", "View/ShowHide/MenuBar", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/ShowHide", "Toolbar", "View/ShowHide/Toolbar", GTK_UI_MANAGER_MENU)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/ShowHide/Toolbar", "TextBelowIcon", "View/ShowHide/Toolbar/TextBelowIcon", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/ShowHide/Toolbar", "TextBesideIcon", "View/ShowHide/Toolbar/TextBesideIcon", GTK_UI_MANAGER_MENUITEM)
@@ -1668,6 +1682,7 @@ MainWindow *main_window_create()
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding", "Cyrillic", "View/Encoding/Cyrillic", GTK_UI_MANAGER_MENU)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Cyrillic", CS_ISO_8859_5, "View/Encoding/Cyrillic/"CS_ISO_8859_5, GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Cyrillic", CS_KOI8_R, "View/Encoding/Cyrillic/"CS_KOI8_R, GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Cyrillic", CS_MACCYR, "View/Encoding/Cyrillic/"CS_MACCYR, GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Cyrillic", CS_KOI8_U, "View/Encoding/Cyrillic/"CS_KOI8_U, GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Cyrillic", CS_WINDOWS_1251, "View/Encoding/Cyrillic/"CS_WINDOWS_1251, GTK_UI_MANAGER_MENUITEM)
 
@@ -1760,6 +1775,8 @@ MainWindow *main_window_create()
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Copy", "Message/Copy", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Trash", "Message/Trash", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Delete", "Message/Delete", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "TrashThread", "Message/TrashThread", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "DeleteThread", "Message/DeleteThread", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "CancelNews", "Message/CancelNews", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Separator4", "Message/---", GTK_UI_MANAGER_SEPARATOR)
 
@@ -1840,6 +1857,9 @@ MainWindow *main_window_create()
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "NetworkLog", "Tools/NetworkLog", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "Separator8", "Tools/---", GTK_UI_MANAGER_SEPARATOR)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "ForgetSessionPasswords", "Tools/ForgetSessionPasswords", GTK_UI_MANAGER_MENUITEM)
+#ifndef PASSWORD_CRYPTO_OLD
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "ForgetMasterPassword", "Tools/ForgetMasterPassword", GTK_UI_MANAGER_MENUITEM)
+#endif
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "Separator9", "Tools/---", GTK_UI_MANAGER_SEPARATOR)
 
 /* Configuration menu */
@@ -1874,7 +1894,10 @@ MainWindow *main_window_create()
 
 
        menubar = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu");
-       gtk_widget_show_all(menubar);
+       if (prefs_common.mainwin_menubar)
+               gtk_widget_show_all(menubar);
+       else
+               gtk_widget_hide(menubar);
        gtk_window_add_accel_group(GTK_WINDOW(window), gtk_ui_manager_get_accel_group(mainwin->ui_manager));
 
        gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, TRUE, 0);
@@ -2093,7 +2116,7 @@ MainWindow *main_window_create()
        gdk_colormap_alloc_colors(colormap, color, 4, FALSE, TRUE, success);
        for (i = 0; i < 4; i++) {
                if (success[i] == FALSE)
-                       g_warning("MainWindow: color allocation %d failed\n", i);
+                       g_warning("MainWindow: color allocation %d failed", i);
        }
 #endif
 
@@ -2206,6 +2229,9 @@ MainWindow *main_window_create()
                        "Menu/View/FullScreen",
                        TRUE);
        }
+       if (prefs_common.mainwin_menubar)
+               cm_toggle_menu_set_active_full(mainwin->ui_manager,"Menu/View/ShowHide/MenuBar", TRUE);
+       
        return mainwin;
 }
 
@@ -2304,7 +2330,7 @@ static gboolean reflect_prefs_timeout_cb(gpointer data)
                        folderview_reinit_fonts(mainwin->folderview);
                        summary_reflect_prefs_pixmap_theme(mainwin->summaryview);
                        foldersel_reflect_prefs_pixmap_theme();
-#ifndef USE_NEW_ADDRBOOK
+#ifndef USE_ALT_ADDRBOOK
                        addressbook_reflect_prefs_pixmap_theme();
 #endif
 #ifndef GENERIC_UMPC
@@ -3075,6 +3101,12 @@ SensitiveCondMask main_window_get_current_state(MainWindow *mainwin)
                        break;
                }
        }
+
+#ifndef PASSWORD_CRYPTO_OLD
+       if (master_password_is_entered()) {
+               UPDATE_STATE(M_MASTER_PASSWORD);
+       }
+#endif
 #undef UPDATE_STATE
 
        return state;
@@ -3115,7 +3147,7 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
        gint i;
        gboolean mimepart_selected = FALSE;
 
-#define N_ENTRIES 83
+#define N_ENTRIES 85
        static struct {
                const gchar *entry;
                SensitiveCondMask cond;
@@ -3134,7 +3166,6 @@ do { \
        FILL_TABLE("Menu/File/Exit", M_UNLOCKED);
 
        FILL_TABLE("Menu/Edit/SelectThread", M_TARGET_EXIST, M_SUMMARY_ISLIST);
-       FILL_TABLE("Menu/Edit/DeleteThread", M_TARGET_EXIST, M_SUMMARY_ISLIST);
        FILL_TABLE("Menu/Edit/Find", M_SINGLE_TARGET_EXIST);
        FILL_TABLE("Menu/Edit/QuickSearch", M_IN_MSGLIST);
        FILL_TABLE("Menu/Edit/SearchFolder", M_TARGET_EXIST, M_SUMMARY_ISLIST);
@@ -3180,6 +3211,8 @@ do { \
        FILL_TABLE("Menu/Message/Copy", M_TARGET_EXIST, M_EXEC);
        FILL_TABLE("Menu/Message/Trash", M_TARGET_EXIST, M_ALLOW_DELETE, M_NOT_NEWS, M_NOT_TRASH);
        FILL_TABLE("Menu/Message/Delete", M_TARGET_EXIST, M_ALLOW_DELETE);
+       FILL_TABLE("Menu/Message/TrashThread", M_TARGET_EXIST, M_SUMMARY_ISLIST);
+       FILL_TABLE("Menu/Message/DeleteThread", M_TARGET_EXIST, M_SUMMARY_ISLIST);
        FILL_TABLE("Menu/Message/CancelNews", M_TARGET_EXIST, M_ALLOW_DELETE, M_NEWS);
        FILL_TABLE("Menu/Message/Mark", M_TARGET_EXIST, M_SUMMARY_ISLIST);
        FILL_TABLE("Menu/Message/Mark/MarkSpam", M_TARGET_EXIST, M_CAN_LEARN_SPAM);
@@ -3207,6 +3240,9 @@ do { \
        FILL_TABLE("Menu/Tools/Execute", M_DELAY_EXEC);
        FILL_TABLE("Menu/Tools/Expunge", M_DELETED_EXISTS);
        FILL_TABLE("Menu/Tools/ForgetSessionPasswords", M_SESSION_PASSWORDS);
+#ifndef PASSWORD_CRYPTO_OLD
+       FILL_TABLE("Menu/Tools/ForgetMasterPassword", M_MASTER_PASSWORD);
+#endif
        FILL_TABLE("Menu/Tools/DeleteDuplicates/SelFolder", M_MSG_EXIST, M_ALLOW_DELETE);
 
        FILL_TABLE("Menu/Configuration", M_UNLOCKED);
@@ -3301,7 +3337,7 @@ do { \
                cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/Sort/Descending", FALSE);
        }
 
-       if (mainwin->messageview 
+       if (mainwin->messageview
        &&  mainwin->messageview->mimeview
        &&  mainwin->messageview->mimeview->textview)
                cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/AllHeaders",
@@ -3316,10 +3352,14 @@ do { \
 
        if (mainwin->summaryview->folder_item && !mainwin->summaryview->folder_item->threaded)
                cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/HideReadThreads", FALSE);
-       if (mainwin->summaryview->folder_item && mainwin->summaryview->folder_item->hide_read_msgs)
+       if ((mainwin->summaryview->folder_item && mainwin->summaryview->folder_item->hide_read_msgs) ||
+           quicksearch_has_sat_predicate(mainwin->summaryview->quicksearch))
                cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/HideReadThreads", FALSE);
-       if (mainwin->summaryview->folder_item && mainwin->summaryview->folder_item->hide_read_threads)
+       if ((mainwin->summaryview->folder_item && mainwin->summaryview->folder_item->hide_read_threads) ||
+           quicksearch_has_sat_predicate(mainwin->summaryview->quicksearch))
                cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/HideReadMessages", FALSE);
+       if (quicksearch_has_sat_predicate(mainwin->summaryview->quicksearch))
+               cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/HideDelMessages", FALSE);
 
        cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/Goto/PrevHistory",
                messageview_nav_has_prev(mainwin->messageview));
@@ -3482,6 +3522,11 @@ static void get_url_part (const gchar **buffer, gchar *url_decoded)
                for (i = 0;
                     *buf != '>' && *buf != 0x00 && i < BUFFSIZE;
                        tmp[i++] = *(buf++));
+               if (*buf == 0) {
+                       *buffer = NULL;
+                       *url_decoded = '\0';
+                       return;
+               }
                buf++;
        }
        else  {
@@ -4139,6 +4184,8 @@ static void set_layout_cb(GtkAction *action, GtkRadioAction *current, gpointer d
        mainwindow_reset_paned(GTK_PANED(mainwin->vpaned));
        if (old_layout_mode == SMALL_LAYOUT && layout_mode != SMALL_LAYOUT) {
                mainwindow_reset_paned(GTK_PANED(mainwin->hpaned));
+               if (layout_mode == VERTICAL_LAYOUT)
+                       mainwindow_reset_paned(GTK_PANED(mainwin->vpaned));
        }
        if (old_layout_mode != SMALL_LAYOUT && layout_mode == SMALL_LAYOUT) {
                mainwin_paned_show_first(GTK_PANED(mainwin->hpaned));
@@ -4198,7 +4245,7 @@ static void mainwindow_check_synchronise(MainWindow *mainwin, gboolean ask)
 
        if (offline_ask_sync && ask && alertpanel(_("Folder synchronisation"),
                        _("Do you want to synchronise your folders now?"),
-                       GTK_STOCK_CANCEL, _("+_Synchronise"), NULL) != G_ALERTALTERNATE)
+                       GTK_STOCK_CANCEL, g_strconcat("+", _("_Synchronise"), NULL), NULL) != G_ALERTALTERNATE)
                return;
        
        if (offline_ask_sync)
@@ -4257,15 +4304,14 @@ static void online_switch_clicked (GtkButton *btn, gpointer data)
 
 static void addressbook_open_cb(GtkAction *action, gpointer data)
 {
-#ifndef USE_NEW_ADDRBOOK
+#ifndef USE_ALT_ADDRBOOK
        addressbook_open(NULL);
 #else
        GError* error = NULL;
        
        addressbook_dbus_open(FALSE, &error);
        if (error) {
-               g_warning("Failed to open address book");
-               g_warning("%s", error->message);
+               g_warning("Failed to open address book: %s", error->message);
                g_error_free(error);
        }
 #endif
@@ -4360,6 +4406,19 @@ static void toggle_fullscreen_cb(GtkAction *action, gpointer data)
        }
 }
 
+static void toggle_menubar_cb(GtkAction *action, gpointer data)
+{
+       MainWindow *mainwin = (MainWindow *)data;
+       if (mainwin->menu_lock_count) return;
+       if (!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) {
+               gtk_widget_hide(GTK_WIDGET(mainwin->menubar));
+               prefs_common.mainwin_menubar = FALSE;
+       } else {
+               gtk_widget_show(GTK_WIDGET(mainwin->menubar));
+               prefs_common.mainwin_menubar = TRUE;
+       }
+}
+
 static void hide_quotes_cb(GtkAction *action, gpointer data)
 {
        MainWindow *mainwin = (MainWindow *)data;
@@ -4793,7 +4852,7 @@ static void prev_history_cb(GtkAction *action, gpointer data)
                        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);
+               procmsg_msginfo_free(&info);
                main_window_set_menu_sensitive(mainwindow_get_mainwindow());
                toolbar_main_set_sensitive(mainwindow_get_mainwindow());
        }
@@ -4807,7 +4866,7 @@ static void next_history_cb(GtkAction *action, gpointer data)
                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);
+               procmsg_msginfo_free(&info);
                main_window_set_menu_sensitive(mainwindow_get_mainwindow());
                toolbar_main_set_sensitive(mainwindow_get_mainwindow());
        }
@@ -4881,13 +4940,19 @@ static void allsel_cb(GtkAction *action, gpointer data)
 static void select_thread_cb(GtkAction *action, gpointer data)
 {
        MainWindow *mainwin = (MainWindow *)data;
-       summary_select_thread(mainwin->summaryview, FALSE);
+       summary_select_thread(mainwin->summaryview, FALSE, FALSE);
+}
+
+static void trash_thread_cb(GtkAction *action, gpointer data)
+{
+       MainWindow *mainwin = (MainWindow *)data;
+       summary_select_thread(mainwin->summaryview, FALSE, TRUE);
 }
 
 static void delete_thread_cb(GtkAction *action, gpointer data)
 {
        MainWindow *mainwin = (MainWindow *)data;
-       summary_select_thread(mainwin->summaryview, TRUE);
+       summary_select_thread(mainwin->summaryview, TRUE, FALSE);
 }
 
 static void create_filter_cb(GtkAction *gaction, gpointer data)
@@ -5274,6 +5339,17 @@ static void forget_session_passwords_cb(GtkAction *action, gpointer data)
                                   fgtn), fgtn, accs);  
 }
 
+#ifndef PASSWORD_CRYPTO_OLD
+static void forget_master_password_cb(GtkAction *action, gpointer data)
+{
+       MainWindow *mainwin = (MainWindow *)data;
+
+       main_window_lock(mainwin);
+       master_password_forget();
+       main_window_unlock(mainwin);
+}
+#endif
+
 void mainwindow_learn (MainWindow *mainwin, gboolean is_spam)
 {
        summary_mark_as_spam(mainwin->summaryview, is_spam, NULL);
@@ -5346,7 +5422,7 @@ void mainwindow_jump_to(const gchar *target, gboolean popup)
                                if (popup)
                                        main_window_popup(mainwin);
                                g_free(tmp);
-                               procmsg_msginfo_free(msginfo);
+                               procmsg_msginfo_free(&msginfo);
                                return;
                        } else {
                                g_print("'%s' not found\n", msg);