Internal API change: split read/unread marking features from functions used
[claws.git] / src / mainwindow.c
index 07e89d666f4a285fffa53aad868e9c942d472876..64b2583a90da527bc5beca396e491abf9c5072f2 100644 (file)
@@ -1,6 +1,6 @@
 /*
    Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
-   Copyright (C) 1999-2013 Hiroyuki Yamamoto and the Claws Mail team
+   Copyright (C) 1999-2016 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
@@ -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"
@@ -230,6 +231,8 @@ static void mark_as_read_cb         (GtkAction      *action,
                                  gpointer       data);
 static void mark_all_read_cb           (GtkAction      *action,
                                  gpointer       data);
+static void mark_all_unread_cb         (GtkAction      *action,
+                                 gpointer       data);
 static void mark_as_spam_cb            (GtkAction      *action,
                                  gpointer       data);
 static void mark_as_ham_cb             (GtkAction      *action,
@@ -428,7 +431,10 @@ static void sync_cb                 ( GtkAction    *action,
 
 static void forget_session_passwords_cb        (GtkAction      *action,
                                         gpointer        data );
-
+#ifndef PASSWORD_CRYPTO_OLD
+static void forget_master_passphrase_cb        (GtkAction      *action,
+                                        gpointer        data );
+#endif
 static gboolean mainwindow_focus_in_event      (GtkWidget      *widget, 
                                                 GdkEventFocus  *focus,
                                                 gpointer        data);
@@ -590,7 +596,7 @@ static GtkActionEntry mainwin_entries[] =
        {"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/Folder",                    NULL, N_("F_older..."), "G", NULL, G_CALLBACK(goto_folder_cb) },
        /* {"View/Goto/---",                    NULL, "---", NULL, NULL, NULL }, */
        {"View/Goto/NextPart",                  NULL, N_("Next part"), "A", NULL, G_CALLBACK(goto_next_part_cb) },
        {"View/Goto/PrevPart",                  NULL, N_("Previous part"), "Z", NULL, G_CALLBACK(goto_prev_part_cb) },
@@ -696,10 +702,11 @@ static GtkActionEntry mainwin_entries[] =
        {"Message/Mark/Unmark",                 NULL, N_("_Unmark"), "U", NULL, G_CALLBACK(unmark_cb) },
        {"Message/Mark/---",                    NULL, "---", NULL, NULL, NULL },
 
-       {"Message/Mark/MarkUnread",             NULL, N_("Mark as unr_ead"), "<shift>exclam", NULL, G_CALLBACK(mark_as_unread_cb) },
        {"Message/Mark/MarkRead",               NULL, N_("Mark as rea_d"), NULL, NULL, G_CALLBACK(mark_as_read_cb) },
+       {"Message/Mark/MarkUnread",             NULL, N_("Mark as unr_ead"), "<shift>exclam", NULL, G_CALLBACK(mark_as_unread_cb) },
        /* separation */
        {"Message/Mark/MarkAllRead",            NULL, N_("Mark all read"), NULL, NULL, G_CALLBACK(mark_all_read_cb) },
+       {"Message/Mark/MarkAllUnread",          NULL, N_("Mark all unread"), NULL, NULL, G_CALLBACK(mark_all_unread_cb) },
        /* separation */
        {"Message/Mark/IgnoreThread",           NULL, N_("Ignore thread"), NULL, NULL, G_CALLBACK(ignore_thread_cb) },
        {"Message/Mark/UnignoreThread",         NULL, N_("Unignore thread"), NULL, NULL, G_CALLBACK(unignore_thread_cb) },
@@ -767,7 +774,7 @@ static GtkActionEntry mainwin_entries[] =
        {"Tools/Expunge",                       NULL, N_("Exp_unge"), "<control>E", NULL, G_CALLBACK(expunge_summary_cb) }, 
 #ifdef USE_GNUTLS
        /* {"Tools/---",                        NULL, "---", NULL, NULL, NULL }, */
-       {"Tools/SSLCertificates",               NULL, N_("SSL cer_tificates"), NULL, NULL, G_CALLBACK(ssl_manager_open_cb) }, 
+       {"Tools/SSLCertificates",               NULL, N_("SSL/TLS cer_tificates"), NULL, NULL, G_CALLBACK(ssl_manager_open_cb) }, 
 #endif
        /* {"Tools/---",                        NULL, "---", NULL, NULL, NULL }, */
 #ifndef G_OS_WIN32
@@ -776,6 +783,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/ForgetMasterPassphrase",                NULL, N_("Forget _master passphrase"), NULL, NULL, G_CALLBACK(forget_master_passphrase_cb) },
+#endif
 
 /* Configuration menu */       
        {"Configuration/ChangeAccount",         NULL, N_("C_hange current account") },
@@ -808,7 +818,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/MenuBar",               NULL, N_("Men_ubar"), "<control>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 */
@@ -1400,7 +1410,7 @@ static gboolean mainwindow_key_pressed (GtkWidget *widget, GdkEventKey *event,
                                    && mainwin->summaryview->folder_item->total_msgs == 0))) {
                                g_signal_stop_emission_by_name(G_OBJECT(widget), 
                                               "key_press_event");
-                               folderview_select_next_with_flag(mainwin->folderview, MSG_UNREAD, TRUE);
+                               folderview_select_next_with_flag(mainwin->folderview, MSG_UNREAD);
                        }
                }
                break;
@@ -1631,7 +1641,7 @@ MainWindow *main_window_create()
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "ParentMessage", "View/Goto/ParentMessage", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "Separator7", "View/Goto/---", GTK_UI_MANAGER_SEPARATOR)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "NextUnreadFolder", "View/Goto/NextUnreadFolder", GTK_UI_MANAGER_MENUITEM)
-       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "OtherFolder", "View/Goto/OtherFolder", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "Folder", "View/Goto/Folder", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "Separator8", "View/Goto/---", GTK_UI_MANAGER_SEPARATOR)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "NextPart", "View/Goto/NextPart", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "PrevPart", "View/Goto/PrevPart", GTK_UI_MANAGER_MENUITEM)
@@ -1777,10 +1787,11 @@ MainWindow *main_window_create()
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "Mark", "Message/Mark/Mark", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "Unmark", "Message/Mark/Unmark", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "Separator1", "Message/Mark/---", GTK_UI_MANAGER_SEPARATOR)
-       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "MarkUnread", "Message/Mark/MarkUnread", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "MarkRead", "Message/Mark/MarkRead", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "MarkUnread", "Message/Mark/MarkUnread", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "Separator2", "Message/Mark/---", GTK_UI_MANAGER_SEPARATOR)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "MarkAllRead", "Message/Mark/MarkAllRead", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "MarkAllUnread", "Message/Mark/MarkAllUnread", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "Separator3", "Message/Mark/---", GTK_UI_MANAGER_SEPARATOR)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "IgnoreThread", "Message/Mark/IgnoreThread", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "UnignoreThread", "Message/Mark/UnignoreThread", GTK_UI_MANAGER_MENUITEM)
@@ -1850,6 +1861,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", "ForgetMasterPassphrase", "Tools/ForgetMasterPassphrase", GTK_UI_MANAGER_MENUITEM)
+#endif
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "Separator9", "Tools/---", GTK_UI_MANAGER_SEPARATOR)
 
 /* Configuration menu */
@@ -1956,8 +1970,8 @@ MainWindow *main_window_create()
        gtk_widget_set_size_request(progressbar, 120, 1);
        gtk_box_pack_start(GTK_BOX(hbox_stat), progressbar, FALSE, FALSE, 0);
 
-       online_pixmap = stock_pixmap_widget(hbox_stat, STOCK_PIXMAP_ONLINE);
-       offline_pixmap = stock_pixmap_widget(hbox_stat, STOCK_PIXMAP_OFFLINE);
+       online_pixmap = stock_pixmap_widget(STOCK_PIXMAP_ONLINE);
+       offline_pixmap = stock_pixmap_widget(STOCK_PIXMAP_OFFLINE);
        online_switch = gtk_button_new ();
        gtkut_widget_set_can_focus(online_switch, FALSE);
        CLAWS_SET_TIP(online_switch, 
@@ -2324,13 +2338,13 @@ static gboolean reflect_prefs_timeout_cb(gpointer data)
                        addressbook_reflect_prefs_pixmap_theme();
 #endif
 #ifndef GENERIC_UMPC
-                       pixmap = stock_pixmap_widget(mainwin->hbox_stat, STOCK_PIXMAP_ONLINE);
+                       pixmap = stock_pixmap_widget(STOCK_PIXMAP_ONLINE);
                        gtk_container_remove(GTK_CONTAINER(mainwin->online_switch), 
                                             mainwin->online_pixmap);
                        gtk_container_add (GTK_CONTAINER(mainwin->online_switch), pixmap);
                        gtk_widget_show(pixmap);
                        mainwin->online_pixmap = pixmap;
-                       pixmap = stock_pixmap_widget(mainwin->hbox_stat, STOCK_PIXMAP_OFFLINE);
+                       pixmap = stock_pixmap_widget(STOCK_PIXMAP_OFFLINE);
                        gtk_container_remove(GTK_CONTAINER(mainwin->offline_switch), 
                                             mainwin->offline_pixmap);
                        gtk_container_add (GTK_CONTAINER(mainwin->offline_switch), pixmap);
@@ -2912,7 +2926,7 @@ gboolean main_window_empty_trash(MainWindow *mainwin, gboolean confirm, gboolean
 
        if (mainwin->summaryview->folder_item &&
            mainwin->summaryview->folder_item->stype == F_TRASH)
-               gtk_widget_grab_focus(mainwin->folderview->ctree);
+               folderview_grab_focus(mainwin->folderview);
        return TRUE;
 }
 
@@ -2967,7 +2981,7 @@ SensitiveCondMask main_window_get_current_state(MainWindow *mainwin)
 
        if (mainwin->lock_count == 0 && !claws_is_starting())
                UPDATE_STATE(M_UNLOCKED);
-       if (selection != SUMMARY_NONE)
+       if (selection != SUMMARY_NONE && selection != SUMMARY_SELECTED_NONE)
                UPDATE_STATE(M_MSG_EXIST);
        if (item && item->path && folder_item_parent(item) && !item->no_select) {
                UPDATE_STATE(M_EXEC);
@@ -3005,6 +3019,10 @@ SensitiveCondMask main_window_get_current_state(MainWindow *mainwin)
             !folder_has_parent_of_type(mainwin->summaryview->folder_item, F_TRASH)))
                UPDATE_STATE(M_NOT_TRASH);
 
+       if (mainwin->summaryview->folder_item
+           && mainwin->summaryview->folder_item->stype != F_DRAFT)
+               UPDATE_STATE(M_NOT_DRAFT);
+
        if (prefs_common.actions_list && g_slist_length(prefs_common.actions_list))
                UPDATE_STATE(M_ACTIONS_EXIST);
 
@@ -3091,6 +3109,12 @@ SensitiveCondMask main_window_get_current_state(MainWindow *mainwin)
                        break;
                }
        }
+
+#ifndef PASSWORD_CRYPTO_OLD
+       if (master_passphrase_is_entered()) {
+               UPDATE_STATE(M_MASTER_PASSPHRASE);
+       }
+#endif
 #undef UPDATE_STATE
 
        return state;
@@ -3131,7 +3155,7 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
        gint i;
        gboolean mimepart_selected = FALSE;
 
-#define N_ENTRIES 84
+#define N_ENTRIES 88
        static struct {
                const gchar *entry;
                SensitiveCondMask cond;
@@ -3159,14 +3183,17 @@ do { \
        FILL_TABLE("Menu/View/ThreadView", M_EXEC, M_SUMMARY_ISLIST);
        FILL_TABLE("Menu/View/ExpandThreads", M_MSG_EXIST, M_SUMMARY_ISLIST);
        FILL_TABLE("Menu/View/CollapseThreads", M_MSG_EXIST, M_SUMMARY_ISLIST);
-       FILL_TABLE("Menu/View/HideReadThreads", M_HIDE_READ_THREADS, M_SUMMARY_ISLIST);
-       FILL_TABLE("Menu/View/HideReadMessages", M_HIDE_READ_MSG, M_SUMMARY_ISLIST);
-       FILL_TABLE("Menu/View/HideDelMessages", M_SUMMARY_ISLIST);
+       FILL_TABLE("Menu/View/HideReadThreads", M_HIDE_READ_THREADS, M_SUMMARY_ISLIST, M_NOT_DRAFT);
+       FILL_TABLE("Menu/View/HideReadMessages", M_HIDE_READ_MSG, M_SUMMARY_ISLIST, M_NOT_DRAFT);
+       FILL_TABLE("Menu/View/HideDelMessages", M_SUMMARY_ISLIST, M_NOT_DRAFT);
        FILL_TABLE("Menu/View/Goto/Prev", M_MSG_EXIST);
        FILL_TABLE("Menu/View/Goto/Next", M_MSG_EXIST);
        FILL_TABLE("Menu/View/Goto/PrevUnread", M_MSG_EXIST);
+       FILL_TABLE("Menu/View/Goto/NextUnread", M_MSG_EXIST);
        FILL_TABLE("Menu/View/Goto/PrevNew", M_MSG_EXIST);
+       FILL_TABLE("Menu/View/Goto/NextNew", M_MSG_EXIST);
        FILL_TABLE("Menu/View/Goto/PrevMarked", M_MSG_EXIST);
+       FILL_TABLE("Menu/View/Goto/NextMarked", M_MSG_EXIST);
        FILL_TABLE("Menu/View/Goto/PrevLabeled", M_MSG_EXIST);
        FILL_TABLE("Menu/View/Goto/NextLabeled", M_MSG_EXIST);
        FILL_TABLE("Menu/View/Goto/ParentMessage", M_SINGLE_TARGET_EXIST);
@@ -3224,6 +3251,9 @@ do { \
        FILL_TABLE("Menu/Tools/Execute", M_DELAY_EXEC);
        FILL_TABLE("Menu/Tools/Expunge", M_DELETED_EXISTS);
        FILL_TABLE("Menu/Tools/ForgetSessionPasswords", M_SESSION_PASSWORDS);
+#ifndef PASSWORD_CRYPTO_OLD
+       FILL_TABLE("Menu/Tools/ForgetMasterPassphrase", M_MASTER_PASSPHRASE);
+#endif
        FILL_TABLE("Menu/Tools/DeleteDuplicates/SelFolder", M_MSG_EXIST, M_ALLOW_DELETE);
 
        FILL_TABLE("Menu/Configuration", M_UNLOCKED);
@@ -3326,7 +3356,7 @@ do { \
        cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/ThreadView", (state & main_window_get_mask(M_THREADED, -1)) != 0);
        cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/ExpandThreads", (state & main_window_get_mask(M_THREADED, -1)) != 0);
        cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/CollapseThreads", (state & main_window_get_mask(M_THREADED, -1)) != 0);
-       cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/HideReadThreads", (state & main_window_get_mask(M_THREADED, -1)) != 0);
+       cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/HideReadThreads", (state & main_window_get_mask(M_THREADED, -1)) != 0 && (state & main_window_get_mask(M_NOT_DRAFT, -1)) != 0);
        cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Quotes/CollapseAll", (prefs_common.hide_quotes == 1));
        cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Quotes/Collapse2", (prefs_common.hide_quotes == 2));
        cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Quotes/Collapse3", (prefs_common.hide_quotes == 3));
@@ -3648,7 +3678,7 @@ static void main_window_set_widgets(MainWindow *mainwin, LayoutType layout_mode)
        GtkWidget *vpaned;
        GtkWidget *vbox_body = mainwin->vbox_body;
        gboolean first_set = (mainwin->hpaned == NULL);
-       debug_print("Setting widgets... ");
+       debug_print("Setting widgets...\n");
 
 #ifndef GENERIC_UMPC
        mainwin->messageview->statusbar = mainwin->statusbar;
@@ -3853,7 +3883,7 @@ static void main_window_set_widgets(MainWindow *mainwin, LayoutType layout_mode)
                         mainwin);
        }
 
-       debug_print("done.\n");
+       debug_print("Setting widgets done.\n");
 }
 
 void main_window_destroy_all(void)
@@ -4435,16 +4465,16 @@ static void unmark_cb(GtkAction *action, gpointer data)
        summary_unmark(mainwin->summaryview);
 }
 
-static void mark_as_unread_cb(GtkAction *action, gpointer data)
+static void mark_as_read_cb(GtkAction *action, gpointer data)
 {
        MainWindow *mainwin = (MainWindow *)data;
-       summary_mark_as_unread(mainwin->summaryview);
+       summary_mark_as_read(mainwin->summaryview);
 }
 
-static void mark_as_read_cb(GtkAction *action, gpointer data)
+static void mark_as_unread_cb(GtkAction *action, gpointer data)
 {
        MainWindow *mainwin = (MainWindow *)data;
-       summary_mark_as_read(mainwin->summaryview);
+       summary_mark_as_unread(mainwin->summaryview);
 }
 
 static void mark_all_read_cb(GtkAction *action, gpointer data)
@@ -4453,6 +4483,12 @@ static void mark_all_read_cb(GtkAction *action, gpointer data)
        summary_mark_all_read(mainwin->summaryview);
 }
 
+static void mark_all_unread_cb(GtkAction *action, gpointer data)
+{
+       MainWindow *mainwin = (MainWindow *)data;
+       summary_mark_all_unread(mainwin->summaryview);
+}
+
 static void mark_as_spam_cb(GtkAction *action, gpointer data)
 {
        MainWindow *mainwin = (MainWindow *)data;
@@ -4752,14 +4788,9 @@ static void update_summary_cb(GtkAction *action, gpointer data)
        FolderView *folderview = mainwin->folderview;
 
        if (!mainwin->summaryview->folder_item) return;
-       if (!folderview->opened) return;
+       if ((fitem = folderview_get_opened_item(folderview)) == NULL) return;
 
        folder_update_op_count();
-
-       fitem = gtk_cmctree_node_get_row_data(GTK_CMCTREE(folderview->ctree),
-                                           folderview->opened);
-       if (!fitem) return;
-
        folder_item_scan(fitem);
        summary_show(mainwin->summaryview, fitem);
 }
@@ -4767,13 +4798,13 @@ static void update_summary_cb(GtkAction *action, gpointer data)
 static void prev_cb(GtkAction *action, gpointer data)
 {
        MainWindow *mainwin = (MainWindow *)data;
-       summary_step(mainwin->summaryview, GTK_SCROLL_STEP_BACKWARD);
+       summary_select_prev(mainwin->summaryview);
 }
 
 static void next_cb(GtkAction *action, gpointer data)
 {
        MainWindow *mainwin = (MainWindow *)data;
-       summary_step(mainwin->summaryview, GTK_SCROLL_STEP_FORWARD);
+       summary_select_next(mainwin->summaryview);
 }
 
 static void prev_unread_cb(GtkAction *action, gpointer data)
@@ -4833,7 +4864,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());
        }
@@ -4847,7 +4878,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());
        }
@@ -4873,7 +4904,7 @@ static void goto_folder_cb(GtkAction *action, gpointer data)
 static void goto_unread_folder_cb(GtkAction *action, gpointer data)
 {
        MainWindow *mainwin = (MainWindow *)data;
-       folderview_select_next_with_flag(mainwin->folderview, MSG_UNREAD, FALSE);
+       folderview_select_next_with_flag(mainwin->folderview, MSG_UNREAD);
 }
 
 static void scroll_prev_line_cb(GtkAction *action, gpointer data)
@@ -5320,6 +5351,17 @@ static void forget_session_passwords_cb(GtkAction *action, gpointer data)
                                   fgtn), fgtn, accs);  
 }
 
+#ifndef PASSWORD_CRYPTO_OLD
+static void forget_master_passphrase_cb(GtkAction *action, gpointer data)
+{
+       MainWindow *mainwin = (MainWindow *)data;
+
+       main_window_lock(mainwin);
+       master_passphrase_forget();
+       main_window_unlock(mainwin);
+}
+#endif
+
 void mainwindow_learn (MainWindow *mainwin, gboolean is_spam)
 {
        summary_mark_as_spam(mainwin->summaryview, is_spam, NULL);
@@ -5360,7 +5402,7 @@ void mainwindow_jump_to(const gchar *target, gboolean popup)
                return;
        }
        
-       msg = strrchr(tmp, G_DIR_SEPARATOR);
+       msg = strrchr(tmp, '/');
        if (msg) {
                *msg++ = '\0';
                if ((item = folder_find_item_from_identifier(tmp))) {
@@ -5392,7 +5434,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);
@@ -5409,9 +5451,9 @@ void mainwindow_jump_to(const gchar *target, gboolean popup)
 
 void mainwindow_exit_folder(MainWindow *mainwin) {
        if (prefs_common.layout_mode == SMALL_LAYOUT) {
-               folderview_close_opened(mainwin->folderview);
+               folderview_close_opened(mainwin->folderview, FALSE);
                mainwin_paned_show_first(GTK_PANED(mainwin->hpaned));
-               gtk_widget_grab_focus(mainwin->folderview->ctree);
+               folderview_grab_focus(mainwin->folderview);
        }
        mainwin->in_folder = FALSE;
        main_window_set_menu_sensitive(mainwin);