2006-02-01 [paul] 2.0.0cvs4
[claws.git] / src / mainwindow.c
index b2ae49058d94f7676309bb953c78fe5df60e918c..04f623b6e14210c871ffa083eded72c4bd9faf94 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2005 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2006 Hiroyuki Yamamoto and the Sylpheed-Claws 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
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
 #include "defs.h"
@@ -65,6 +65,7 @@
 #include "prefs_filtering.h"
 #include "prefs_account.h"
 #include "prefs_summary_column.h"
+#include "prefs_folder_column.h"
 #include "prefs_template.h"
 #include "action.h"
 #include "account.h"
@@ -90,6 +91,7 @@
 #include "filtering.h"
 #include "folderutils.h"
 #include "foldersort.h"
+#include "icon_legend.h"
 
 #define AC_LABEL_WIDTH 240
 
@@ -122,8 +124,6 @@ static void toolbar_child_detached          (GtkWidget      *widget,
 static gboolean ac_label_button_pressed                (GtkWidget      *widget,
                                                 GdkEventButton *event,
                                                 gpointer        data);
-static void ac_menu_popup_closed               (GtkMenuShell   *menu_shell,
-                                                gpointer        data);
 
 static gint main_window_close_cb               (GtkWidget      *widget,
                                                 GdkEventAny    *event,
@@ -229,6 +229,9 @@ static void copy_to_cb                      (MainWindow     *mainwin,
 static void delete_cb                  (MainWindow     *mainwin,
                                         guint           action,
                                         GtkWidget      *widget);
+static void delete_trash_cb                    (MainWindow     *mainwin,
+                                        guint           action,
+                                        GtkWidget      *widget);
 
 static void cancel_cb                   (MainWindow     *mainwin,
                                         guint           action,
@@ -281,7 +284,10 @@ static void collapse_threads_cb     (MainWindow    *mainwin,
                                  guint          action,
                                  GtkWidget     *widget);
 
-static void set_display_item_cb         (MainWindow    *mainwin,
+static void set_summary_display_item_cb         (MainWindow    *mainwin,
+                                 guint          action,
+                                 GtkWidget     *widget);
+static void set_folder_display_item_cb  (MainWindow    *mainwin,
                                  guint          action,
                                  GtkWidget     *widget);
 static void sort_summary_cb     (MainWindow    *mainwin,
@@ -363,9 +369,6 @@ static void create_processing_cb (MainWindow        *mainwin,
                                  guint          action,
                                  GtkWidget     *widget);
 
-static void prefs_common_open_cb       (MainWindow     *mainwin,
-                                        guint           action,
-                                        GtkWidget      *widget);
 static void prefs_template_open_cb     (MainWindow     *mainwin,
                                         guint           action,
                                         GtkWidget      *widget);
@@ -413,6 +416,9 @@ static void manual_open_cb   (MainWindow    *mainwin,
                                  guint          action,
                                  GtkWidget     *widget);
 
+static void legend_open_cb      (GtkMenuItem   *menuitem,
+                                 gpointer       data);
+
 static void scan_tree_func      (Folder        *folder,
                                  FolderItem    *item,
                                  gpointer       data);
@@ -426,6 +432,9 @@ static void addr_harvest_cb  ( MainWindow  *mainwin,
 static void addr_harvest_msg_cb         ( MainWindow  *mainwin,
                                   guint       action,
                                   GtkWidget   *widget );
+static void sync_cb             ( MainWindow *mainwin, 
+                                  guint action, 
+                                  GtkWidget *widget );
 
 static gboolean mainwindow_focus_in_event      (GtkWidget      *widget, 
                                                 GdkEventFocus  *focus,
@@ -436,6 +445,9 @@ void main_window_reply_cb                   (MainWindow     *mainwin,
 gboolean mainwindow_progressindicator_hook     (gpointer        source,
                                                 gpointer        userdata);
 #define  SEPARATE_ACTION 500 
+static void mainwindow_quicksearch             (MainWindow     *mainwin, 
+                                                guint           action, 
+                                                GtkWidget      *widget);
 
 static GtkItemFactoryEntry mainwin_entries[] =
 {
@@ -443,7 +455,7 @@ static GtkItemFactoryEntry mainwin_entries[] =
        {N_("/_File/_Add mailbox"),             NULL, NULL, 0, "<Branch>"},
        {N_("/_File/_Add mailbox/MH..."),       NULL, add_mailbox_cb, 0, NULL},
        {N_("/_File/---"),                      NULL, NULL, 0, "<Separator>"},
-       {N_("/_File/Change folder order"),      NULL, foldersort_cb,  0, NULL},
+       {N_("/_File/Change folder order..."),   NULL, foldersort_cb,  0, NULL},
        {N_("/_File/---"),                      NULL, NULL, 0, "<Separator>"},
        {N_("/_File/_Import mbox file..."),     NULL, import_mbox_cb, 0, NULL},
        {N_("/_File/_Export to mbox file..."),  NULL, export_mbox_cb, 0, NULL},
@@ -453,9 +465,10 @@ static GtkItemFactoryEntry mainwin_entries[] =
        {N_("/_File/Empty all _Trash folders"), "<shift>D", empty_trash_cb, 0, NULL},
        {N_("/_File/---"),                      NULL, NULL, 0, "<Separator>"},
        {N_("/_File/_Save as..."),              "<control>S", save_as_cb, 0, NULL},
-       {N_("/_File/_Print..."),                NULL, print_cb, 0, NULL},
+       {N_("/_File/_Print..."),                "<control>P", print_cb, 0, NULL},
        {N_("/_File/---"),                      NULL, NULL, 0, "<Separator>"},
        {N_("/_File/_Work offline"),            "<control>W", toggle_work_offline_cb, 0, "<ToggleItem>"},
+       {N_("/_File/Synchronise folders"),      "<control><shift>S", sync_cb, 0, NULL},
        {N_("/_File/---"),                      NULL, NULL, 0, "<Separator>"},
        /* {N_("/_File/_Close"),                "<alt>W", app_exit_cb, 0, NULL}, */
        {N_("/_File/E_xit"),                    "<control>Q", app_exit_cb, 0, NULL},
@@ -468,6 +481,7 @@ static GtkItemFactoryEntry mainwin_entries[] =
        {N_("/_Edit/_Find in current message..."),
                                                "<control>F", search_cb, 0, NULL},
        {N_("/_Edit/_Search folder..."),        "<shift><control>F", search_cb, 1, NULL},
+       {N_("/_Edit/_Quick search"),            "slash", mainwindow_quicksearch, 0, NULL},
        {N_("/_View"),                          NULL, NULL, 0, "<Branch>"},
        {N_("/_View/Show or hi_de"),            NULL, NULL, 0, "<Branch>"},
        {N_("/_View/Show or hi_de/_Folder tree"),
@@ -476,14 +490,16 @@ static GtkItemFactoryEntry mainwin_entries[] =
                                                "V", toggle_message_cb, 0, "<ToggleItem>"},
        {N_("/_View/Show or hi_de/_Toolbar"),
                                                NULL, NULL, 0, "<Branch>"},
-       {N_("/_View/Show or hi_de/_Toolbar/Icon _and text"),
+       {N_("/_View/Show or hi_de/_Toolbar/Text _below icons"),
                                                NULL, toggle_toolbar_cb, TOOLBAR_BOTH, "<RadioItem>"},
-       {N_("/_View/Show or hi_de/_Toolbar/_Icon"),
-                                               NULL, toggle_toolbar_cb, TOOLBAR_ICON, "/View/Show or hide/Toolbar/Icon and text"},
-       {N_("/_View/Show or hi_de/_Toolbar/_Text"),
-                                               NULL, toggle_toolbar_cb, TOOLBAR_TEXT, "/View/Show or hide/Toolbar/Icon and text"},
-       {N_("/_View/Show or hi_de/_Toolbar/_None"),
-                                               NULL, toggle_toolbar_cb, TOOLBAR_NONE, "/View/Show or hide/Toolbar/Icon and text"},
+       {N_("/_View/Show or hi_de/_Toolbar/Text be_side icons"),
+                                               NULL, toggle_toolbar_cb, TOOLBAR_BOTH_HORIZ, "/View/Show or hide/Toolbar/Text below icons"},
+       {N_("/_View/Show or hi_de/_Toolbar/_Icons only"),
+                                               NULL, toggle_toolbar_cb, TOOLBAR_ICON, "/View/Show or hide/Toolbar/Text below icons"},
+       {N_("/_View/Show or hi_de/_Toolbar/_Text only"),
+                                               NULL, toggle_toolbar_cb, TOOLBAR_TEXT, "/View/Show or hide/Toolbar/Text below icons"},
+       {N_("/_View/Show or hi_de/_Toolbar/_Hide"),
+                                               NULL, toggle_toolbar_cb, TOOLBAR_NONE, "/View/Show or hide/Toolbar/Text below icons"},
        {N_("/_View/Show or hi_de/Status _bar"),
                                                NULL, toggle_statusbar_cb, 0, "<ToggleItem>"},
        {N_("/_View/---"),                      NULL, NULL, 0, "<Separator>"},
@@ -492,11 +508,11 @@ static GtkItemFactoryEntry mainwin_entries[] =
        {N_("/_View/---"),                      NULL, NULL, 0, "<Separator>"},
        {N_("/_View/_Sort"),                    NULL, NULL, 0, "<Branch>"},
        {N_("/_View/_Sort/by _number"),         NULL, sort_summary_cb, SORT_BY_NUMBER, "<RadioItem>"},
-       {N_("/_View/_Sort/by s_ize"),           NULL, sort_summary_cb, SORT_BY_SIZE, "/View/Sort/by number"},
-       {N_("/_View/_Sort/by _date"),           NULL, sort_summary_cb, SORT_BY_DATE, "/View/Sort/by number"},
-       {N_("/_View/_Sort/by _from"),           NULL, sort_summary_cb, SORT_BY_FROM, "/View/Sort/by number"},
-       {N_("/_View/_Sort/by _recipient"),      NULL, sort_summary_cb, SORT_BY_TO, "/View/Sort/by number"},
-       {N_("/_View/_Sort/by _subject"),        NULL, sort_summary_cb, SORT_BY_SUBJECT, "/View/Sort/by number"},
+       {N_("/_View/_Sort/by S_ize"),           NULL, sort_summary_cb, SORT_BY_SIZE, "/View/Sort/by number"},
+       {N_("/_View/_Sort/by _Date"),           NULL, sort_summary_cb, SORT_BY_DATE, "/View/Sort/by number"},
+       {N_("/_View/_Sort/by _From"),           NULL, sort_summary_cb, SORT_BY_FROM, "/View/Sort/by number"},
+       {N_("/_View/_Sort/by _To"),             NULL, sort_summary_cb, SORT_BY_TO, "/View/Sort/by number"},
+       {N_("/_View/_Sort/by S_ubject"),        NULL, sort_summary_cb, SORT_BY_SUBJECT, "/View/Sort/by number"},
        {N_("/_View/_Sort/by _color label"),
                                                NULL, sort_summary_cb, SORT_BY_LABEL, "/View/Sort/by number"},
        {N_("/_View/_Sort/by _mark"),           NULL, sort_summary_cb, SORT_BY_MARK, "/View/Sort/by number"},
@@ -516,27 +532,29 @@ static GtkItemFactoryEntry mainwin_entries[] =
        {N_("/_View/E_xpand all threads"),      NULL, expand_threads_cb, 0, NULL},
        {N_("/_View/Co_llapse all threads"),    NULL, collapse_threads_cb, 0, NULL},
        {N_("/_View/_Hide read messages"),      NULL, hide_read_messages, 0, "<ToggleItem>"},
-       {N_("/_View/Set displayed _items..."),  NULL, set_display_item_cb, 0, NULL},
+       {N_("/_View/Set displayed _columns"),   NULL, NULL, 0, "<Branch>"},
+       {N_("/_View/Set displayed _columns/in _Folder list..."),        NULL, set_folder_display_item_cb, 0, NULL},
+       {N_("/_View/Set displayed _columns/in _Message list..."),NULL, set_summary_display_item_cb, 0, NULL},
 
        {N_("/_View/---"),                      NULL, NULL, 0, "<Separator>"},
        {N_("/_View/_Go to"),                   NULL, NULL, 0, "<Branch>"},
-       {N_("/_View/_Go to/_Prev message"),     "P", prev_cb, 0, NULL},
+       {N_("/_View/_Go to/_Previous message"), "P", prev_cb, 0, NULL},
        {N_("/_View/_Go to/_Next message"),     "N", next_cb, 0, NULL},
        {N_("/_View/_Go to/---"),               NULL, NULL, 0, "<Separator>"},
-       {N_("/_View/_Go to/P_rev unread message"),
+       {N_("/_View/_Go to/P_revious unread message"),
                                                "<shift>P", prev_unread_cb, 0, NULL},
        {N_("/_View/_Go to/N_ext unread message"),
                                                "<shift>N", next_unread_cb, 0, NULL},
        {N_("/_View/_Go to/---"),               NULL, NULL, 0, "<Separator>"},
-       {N_("/_View/_Go to/Prev ne_w message"), NULL, prev_new_cb, 0, NULL},
+       {N_("/_View/_Go to/Previous ne_w message"),     NULL, prev_new_cb, 0, NULL},
        {N_("/_View/_Go to/Ne_xt new message"), NULL, next_new_cb, 0, NULL},
        {N_("/_View/_Go to/---"),               NULL, NULL, 0, "<Separator>"},
-       {N_("/_View/_Go to/Prev _marked message"),
+       {N_("/_View/_Go to/Previous _marked message"),
                                                NULL, prev_marked_cb, 0, NULL},
        {N_("/_View/_Go to/Next m_arked message"),
                                                NULL, next_marked_cb, 0, NULL},
        {N_("/_View/_Go to/---"),               NULL, NULL, 0, "<Separator>"},
-       {N_("/_View/_Go to/Prev _labeled message"),
+       {N_("/_View/_Go to/Previous _labeled message"),
                                                NULL, prev_labeled_cb, 0, NULL},
        {N_("/_View/_Go to/Next la_beled message"),
                                                NULL, next_labeled_cb, 0, NULL},
@@ -563,6 +581,8 @@ static GtkItemFactoryEntry mainwin_entries[] =
         ENC_ACTION(C_ISO_8859_1)},
        {N_("/_View/Character _encoding/Western European (ISO-8859-15)"),
         ENC_ACTION(C_ISO_8859_15)},
+       {N_("/_View/Character _encoding/Western European (Windows-1252)"),
+        ENC_ACTION(C_WINDOWS_1252)},
        ENC_SEPARATOR,
 
        {N_("/_View/Character _encoding/Central European (ISO-8859-_2)"),
@@ -579,6 +599,18 @@ static GtkItemFactoryEntry mainwin_entries[] =
         ENC_ACTION(C_ISO_8859_7)},
        ENC_SEPARATOR,
 
+       {N_("/_View/Character _encoding/Hebrew (ISO-8859-_8)"),
+        ENC_ACTION(C_ISO_8859_8)},
+       {N_("/_View/Character _encoding/Hebrew (Windows-1255)"),
+        ENC_ACTION(C_CP1255)},
+       ENC_SEPARATOR,
+
+       {N_("/_View/Character _encoding/Arabic (ISO-8859-_6)"),
+        ENC_ACTION(C_ISO_8859_6)},
+       {N_("/_View/Character _encoding/Arabic (Windows-1256)"),
+        ENC_ACTION(C_CP1256)},
+       ENC_SEPARATOR,
+
        {N_("/_View/Character _encoding/Turkish (ISO-8859-_9)"),
         ENC_ACTION(C_ISO_8859_9)},
        ENC_SEPARATOR,
@@ -673,12 +705,14 @@ static GtkItemFactoryEntry mainwin_entries[] =
                                                "<control>L", main_window_reply_cb, COMPOSE_REPLY_TO_LIST, NULL},
        {N_("/_Message/Follow-up and reply to"),NULL, main_window_reply_cb, COMPOSE_FOLLOWUP_AND_REPLY_TO, NULL},
        {N_("/_Message/---"),                   NULL, NULL, 0, "<Separator>"},
-       {N_("/_Message/_Forward"),              "<control><alt>F", main_window_reply_cb, COMPOSE_FORWARD, NULL},
+       {N_("/_Message/_Forward"),              "<control><alt>F", main_window_reply_cb, COMPOSE_FORWARD_INLINE, NULL},
+       {N_("/_Message/For_ward as attachment"),        NULL, main_window_reply_cb, COMPOSE_FORWARD_AS_ATTACH, NULL},
        {N_("/_Message/Redirect"),              NULL, main_window_reply_cb, COMPOSE_REDIRECT, NULL},
        {N_("/_Message/---"),                   NULL, NULL, 0, "<Separator>"},
        {N_("/_Message/M_ove..."),              "<control>O", move_to_cb, 0, NULL},
        {N_("/_Message/_Copy..."),              "<shift><control>O", copy_to_cb, 0, NULL},
-       {N_("/_Message/_Delete"),               "<control>D", delete_cb,  0, NULL},
+       {N_("/_Message/Move to _trash"),        "<control>D", delete_trash_cb,  0, NULL},
+       {N_("/_Message/_Delete..."),            NULL, delete_cb,  0, NULL},
        {N_("/_Message/Cancel a news message"), "", cancel_cb,  0, NULL},
        {N_("/_Message/---"),                   NULL, NULL, 0, "<Separator>"},
        {N_("/_Message/_Mark"),                 NULL, NULL, 0, "<Branch>"},
@@ -768,18 +802,16 @@ static GtkItemFactoryEntry mainwin_entries[] =
        {N_("/_Configuration/Plu_gins..."),     NULL, plugins_open_cb, 0, NULL},
 
        {N_("/_Help"),                          NULL, NULL, 0, "<Branch>"},
-       {N_("/_Help/_Manual (Local)"),          NULL, manual_open_cb, MANUAL_MANUAL_LOCAL, NULL},
-       {N_("/_Help/Ma_nual (Sylpheed Doc Homepage)"),
-                                               NULL, manual_open_cb, MANUAL_MANUAL_SYLDOC, NULL},
-       {N_("/_Help/_FAQ (Local)"),             NULL, manual_open_cb, MANUAL_FAQ_LOCAL, NULL},
-       {N_("/_Help/FA_Q (Sylpheed Doc Homepage)"),
-                                               NULL, manual_open_cb, MANUAL_FAQ_SYLDOC, NULL},
-       {N_("/_Help/_Claws FAQ (Claws Documentation)"),
+       {N_("/_Help/_Manual"),                  NULL, manual_open_cb, MANUAL_MANUAL_LOCAL, NULL},
+       {N_("/_Help/_Online User-contributed FAQ"),     
                                                NULL, manual_open_cb, MANUAL_FAQ_CLAWS, NULL},
+       {N_("/_Help/Icon _Legend"),             NULL, legend_open_cb, 0, NULL},
        {N_("/_Help/---"),                      NULL, NULL, 0, "<Separator>"},
        {N_("/_Help/_About"),                   NULL, about_show, 0, NULL}
 };
 
+static gboolean offline_ask_sync = TRUE;
+
 static gboolean main_window_accel_activate (GtkAccelGroup *accelgroup,
                                             GObject *arg1,
                                             guint value,
@@ -831,7 +863,6 @@ MainWindow *main_window_create(SeparateType type)
        GtkWidget *menuitem;
        gint i;
        guint n_menu_entries;
-       gboolean hide_messageview = FALSE;
 
        static GdkGeometry geometry;
 
@@ -877,17 +908,21 @@ MainWindow *main_window_create(SeparateType type)
        gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, TRUE, 0);
        ifactory = gtk_item_factory_from_widget(menubar);
 
-       menu_set_sensitive(ifactory, "/Help/Manual (Local)", manual_available(MANUAL_MANUAL_LOCAL));
-       menu_set_sensitive(ifactory, "/Help/FAQ (Local)", manual_available(MANUAL_FAQ_LOCAL));
-
-       handlebox = gtk_handle_box_new();
-       gtk_widget_show(handlebox);
-       gtk_box_pack_start(GTK_BOX(vbox), handlebox, FALSE, FALSE, 0);
-       g_signal_connect(G_OBJECT(handlebox), "child_attached",
-                        G_CALLBACK(toolbar_child_attached), mainwin);
-       g_signal_connect(G_OBJECT(handlebox), "child_detached",
-                        G_CALLBACK(toolbar_child_detached), mainwin);
+       menu_set_sensitive(ifactory, "/Help/Manual", manual_available(MANUAL_MANUAL_LOCAL));
 
+       if (prefs_common.toolbar_detachable) {
+               handlebox = gtk_handle_box_new();
+               gtk_widget_show(handlebox);
+               gtk_box_pack_start(GTK_BOX(vbox), handlebox, FALSE, FALSE, 0);
+               g_signal_connect(G_OBJECT(handlebox), "child_attached",
+                                G_CALLBACK(toolbar_child_attached), mainwin);
+               g_signal_connect(G_OBJECT(handlebox), "child_detached",
+                                G_CALLBACK(toolbar_child_detached), mainwin);
+       } else {
+               handlebox = gtk_hbox_new(FALSE, 0);
+               gtk_widget_show(handlebox);
+               gtk_box_pack_start(GTK_BOX(vbox), handlebox, FALSE, FALSE, 0);
+       }
        /* link window to mainwin->window to avoid gdk warnings */
        mainwin->window       = window;
        
@@ -939,7 +974,6 @@ MainWindow *main_window_create(SeparateType type)
        ac_button = gtk_button_new();
        gtk_tooltips_set_tip(GTK_TOOLTIPS(sel_ac_tip),
                             ac_button, _("Select account"), NULL);
-       gtk_button_set_relief(GTK_BUTTON(ac_button), GTK_RELIEF_NONE);
        GTK_WIDGET_UNSET_FLAGS(ac_button, GTK_CAN_FOCUS);
        gtk_widget_set_size_request(ac_button, -1, 0);
        gtk_box_pack_end(GTK_BOX(hbox_stat), ac_button, FALSE, FALSE, 0);
@@ -1017,7 +1051,7 @@ MainWindow *main_window_create(SeparateType type)
        color[2] = folderview->color_new;
        color[3] = folderview->color_op;
 
-       colormap = gdk_window_get_colormap(window->window);
+       colormap = gdk_drawable_get_colormap(window->window);
        gdk_colormap_alloc_colors(colormap, color, 4, FALSE, TRUE, success);
        for (i = 0; i < 4; i++) {
                if (success[i] == FALSE)
@@ -1027,8 +1061,7 @@ MainWindow *main_window_create(SeparateType type)
        debug_print("done.\n");
 
        messageview->visible = prefs_common.msgview_visible;
-       hide_messageview = !messageview->visible;
-       
+
        main_window_set_widgets(mainwin, type);
 
        g_signal_connect(G_OBJECT(window), "size_allocate",
@@ -1043,19 +1076,24 @@ MainWindow *main_window_create(SeparateType type)
        switch (prefs_common.toolbar_style) {
        case TOOLBAR_NONE:
                menuitem = gtk_item_factory_get_item
-                       (ifactory, "/View/Show or hide/Toolbar/None");
+                       (ifactory, "/View/Show or hide/Toolbar/Hide");
                break;
        case TOOLBAR_ICON:
                menuitem = gtk_item_factory_get_item
-                       (ifactory, "/View/Show or hide/Toolbar/Icon");
+                       (ifactory, "/View/Show or hide/Toolbar/Icons only");
                break;
        case TOOLBAR_TEXT:
                menuitem = gtk_item_factory_get_item
-                       (ifactory, "/View/Show or hide/Toolbar/Text");
+                       (ifactory, "/View/Show or hide/Toolbar/Text only");
                break;
        case TOOLBAR_BOTH:
                menuitem = gtk_item_factory_get_item
-                       (ifactory, "/View/Show or hide/Toolbar/Icon and text");
+                       (ifactory, "/View/Show or hide/Toolbar/Text below icons");
+               break;
+       case TOOLBAR_BOTH_HORIZ:
+               menuitem = gtk_item_factory_get_item
+                       (ifactory,
+                        "/View/Show or hide/Toolbar/Text beside icons");
        }
        gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE);
 
@@ -1068,8 +1106,6 @@ MainWindow *main_window_create(SeparateType type)
        /* set account selection menu */
        ac_menu = gtk_item_factory_get_widget
                (ifactory, "/Configuration/Change current account");
-       g_signal_connect(G_OBJECT(ac_menu), "selection_done",
-                        G_CALLBACK(ac_menu_popup_closed), mainwin);
        mainwin->ac_menu = ac_menu;
 
        toolbar_main_set_sensitive(mainwin);
@@ -1094,8 +1130,8 @@ MainWindow *main_window_create(SeparateType type)
        menu_connect_identical_items();
 
 
-       
-       /* show main window */
+       gtk_window_iconify(GTK_WINDOW(mainwin->window));
+
        gtk_widget_show(mainwin->window);
 
        /* initialize views */
@@ -1124,9 +1160,6 @@ MainWindow *main_window_create(SeparateType type)
        if (prefs_common.work_offline)
                online_switch_clicked (GTK_BUTTON(online_switch), mainwin);
 
-       if (mainwin->type == SEPARATE_NONE && hide_messageview)
-               main_window_toggle_message_view(mainwin);
-
        return mainwin;
 }
 
@@ -1202,13 +1235,16 @@ static void main_window_menu_callback_unblock(MainWindow *mainwin)
                mainwin->menu_lock_count--;
 }
 
+static guint prefs_tag = 0;
+
 void main_window_reflect_prefs_all(void)
 {
        main_window_reflect_prefs_all_real(FALSE);
 }
 
-void main_window_reflect_prefs_all_real(gboolean pixmap_theme_changed)
+static gboolean reflect_prefs_timeout_cb(gpointer data) 
 {
+       gboolean pixmap_theme_changed = GPOINTER_TO_INT(data);
        GList *cur;
        MainWindow *mainwin;
        GtkWidget *pixmap;
@@ -1242,9 +1278,23 @@ void main_window_reflect_prefs_all_real(gboolean pixmap_theme_changed)
                        mainwin->offline_pixmap = pixmap;
                }
                
-               summary_redisplay_msg(mainwin->summaryview);
+               headerview_set_font(mainwin->messageview->headerview);
                headerview_set_visibility(mainwin->messageview->headerview,
                                          prefs_common.display_header_pane);
+               textview_reflect_prefs(mainwin->messageview->mimeview->textview);
+               folderview_reflect_prefs();
+               summary_reflect_prefs();
+               summary_redisplay_msg(mainwin->summaryview);
+       }
+       prefs_tag = 0;
+       return FALSE;
+}
+
+void main_window_reflect_prefs_all_real(gboolean pixmap_theme_changed)
+{
+       if (prefs_tag == 0 || pixmap_theme_changed) {
+               prefs_tag = g_timeout_add(500, reflect_prefs_timeout_cb, 
+                                               GINT_TO_POINTER(pixmap_theme_changed));
        }
 }
 
@@ -1259,6 +1309,17 @@ void main_window_set_summary_column(void)
        }
 }
 
+void main_window_set_folder_column(void)
+{
+       GList *cur;
+       MainWindow *mainwin;
+
+       for (cur = mainwin_list; cur != NULL; cur = cur->next) {
+               mainwin = (MainWindow *)cur->data;
+               folderview_set_column_order(mainwin->folderview);
+       }
+}
+
 static void main_window_set_account_selector_menu(MainWindow *mainwin,
                                                  GList *account_list)
 {
@@ -1329,6 +1390,42 @@ static void main_window_set_account_receive_menu(MainWindow *mainwin,
        }
 }
 
+static void main_window_set_toolbar_combo_receive_menu(MainWindow *mainwin,
+                                                      GList *account_list)
+{
+       GList *cur_ac, *cur_item;
+       GtkWidget *menuitem;
+       PrefsAccount *ac_prefs;
+       GtkWidget *menu = NULL;
+
+       if (mainwin->toolbar->getall_btn == NULL
+       ||  mainwin->toolbar->getall_combo == NULL) /* button doesn't exist */
+               return;
+
+       menu = mainwin->toolbar->getall_combo->menu;
+
+       /* destroy all previous menu item */
+       cur_item = GTK_MENU_SHELL(menu)->children;
+       while (cur_item != NULL) {
+               GList *next = cur_item->next;
+               gtk_widget_destroy(GTK_WIDGET(cur_item->data));
+               cur_item = next;
+       }
+
+       for (cur_ac = account_list; cur_ac != NULL; cur_ac = cur_ac->next) {
+               ac_prefs = (PrefsAccount *)cur_ac->data;
+
+               menuitem = gtk_menu_item_new_with_label
+                       (ac_prefs->account_name
+                        ? ac_prefs->account_name : _("Untitled"));
+               gtk_widget_show(menuitem);
+               gtk_menu_append(GTK_MENU(menu), menuitem);
+               g_signal_connect(G_OBJECT(menuitem), "activate",
+                                G_CALLBACK(account_receive_menu_cb),
+                                ac_prefs);
+       }
+}
+
 void main_window_set_account_menu(GList *account_list)
 {
        GList *cur;
@@ -1338,6 +1435,18 @@ void main_window_set_account_menu(GList *account_list)
                mainwin = (MainWindow *)cur->data;
                main_window_set_account_selector_menu(mainwin, account_list);
                main_window_set_account_receive_menu(mainwin, account_list);
+               main_window_set_toolbar_combo_receive_menu(mainwin, account_list);
+       }
+}
+
+void main_window_set_account_menu_only_toolbar(GList *account_list)
+{
+       GList *cur;
+       MainWindow *mainwin;
+
+       for (cur = mainwin_list; cur != NULL; cur = cur->next) {
+               mainwin = (MainWindow *)cur->data;
+               main_window_set_toolbar_combo_receive_menu(mainwin, account_list);
        }
 }
 
@@ -1610,23 +1719,11 @@ void main_window_progress_set(MainWindow *mainwin, gint cur, gint total)
 
 void main_window_empty_trash(MainWindow *mainwin, gboolean confirm)
 {
-       GList *list;
-       guint has_trash;
-       Folder *folder;
-
-       for (has_trash = 0, list = folder_get_list(); list != NULL; list = list->next) {
-               folder = FOLDER(list->data);
-               if (folder && folder->trash && folder->trash->total_msgs > 0)
-                       has_trash++;
-       }
-
-       if (!has_trash) return;
-       
        if (confirm) {
                if (alertpanel(_("Empty trash"),
-                              _("Empty all messages in trash?"),
-                              GTK_STOCK_YES, GTK_STOCK_NO, NULL)
-                   != G_ALERTDEFAULT)
+                              _("Delete all messages in trash folders?"),
+                              GTK_STOCK_CANCEL, _("+_Empty trash"), NULL)
+                   != G_ALERTALTERNATE)
                        return;
                manage_window_focus_in(mainwin->window, NULL, NULL);
        }
@@ -1650,7 +1747,7 @@ void main_window_add_mailbox(MainWindow *mainwin)
                            "Mail");
        if (!path) return;
        if (folder_find_from_path(path)) {
-               alertpanel_error(_("The mailbox `%s' already exists."), path);
+               alertpanel_error(_("The mailbox '%s' already exists."), path);
                g_free(path);
                return;
        }
@@ -1668,7 +1765,7 @@ void main_window_add_mailbox(MainWindow *mainwin)
 
        folder_add(folder);
        folder_set_ui_func(folder, scan_tree_func, mainwin);
-       folder_scan_tree(folder);
+       folder_scan_tree(folder, TRUE);
        folder_set_ui_func(folder, NULL, NULL);
 }
 
@@ -1714,8 +1811,9 @@ SensitiveCond main_window_get_current_state(MainWindow *mainwin)
                state |= M_NOT_NEWS;
        if (selection == SUMMARY_SELECTED_SINGLE &&
            (item &&
-            (item->stype == F_OUTBOX || item->stype == F_DRAFT ||
-             item->stype == F_QUEUE)))
+            (folder_has_parent_of_type(item, F_DRAFT) ||
+             folder_has_parent_of_type(item, F_OUTBOX) ||
+             folder_has_parent_of_type(item, F_QUEUE))))
                state |= M_ALLOW_REEDIT;
        if (cur_account)
                state |= M_HAVE_ACCOUNT;
@@ -1730,6 +1828,11 @@ SensitiveCond main_window_get_current_state(MainWindow *mainwin)
        if (inc_is_active())
                state |= M_INC_ACTIVE;
 
+       if (mainwin->summaryview->deleted > 0 ||
+           mainwin->summaryview->moved > 0 ||
+           mainwin->summaryview->copied > 0)
+               state |= M_DELAY_EXEC;
+
        return state;
 }
 
@@ -1751,17 +1854,8 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
                gchar *const entry;
                SensitiveCond cond;
        } entry[] = {
-               {"/File/Add mailbox"                          , M_UNLOCKED},
-
-                {"/File/Add mailbox/MH..."                   , M_UNLOCKED},
-               {"/File/Change folder order"                  , M_UNLOCKED},
-               {"/File/Export to mbox file..."               , M_UNLOCKED},
-               {"/File/Empty all Trash folders"              , M_UNLOCKED},
-               {"/File/Work offline"                         , M_UNLOCKED},
-
-               {"/File/Save as...", M_TARGET_EXIST|M_UNLOCKED},
-               {"/File/Print..."  , M_TARGET_EXIST|M_UNLOCKED},
-               /* {"/File/Close"  , M_UNLOCKED}, */
+               {"/File/Save as...", M_TARGET_EXIST},
+               {"/File/Print..."  , M_TARGET_EXIST},
                {"/File/Exit"      , M_UNLOCKED},
 
                {"/Edit/Select thread"             , M_SINGLE_TARGET_EXIST},
@@ -1771,13 +1865,13 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
                {"/View/Expand all threads"        , M_MSG_EXIST},
                {"/View/Collapse all threads"      , M_MSG_EXIST},
                {"/View/Hide read messages"        , M_HIDE_READ_MSG},
-               {"/View/Go to/Prev message"        , M_MSG_EXIST},
+               {"/View/Go to/Previous message"        , M_MSG_EXIST},
                {"/View/Go to/Next message"        , M_MSG_EXIST},
-               {"/View/Go to/Prev unread message" , M_MSG_EXIST},
-               {"/View/Go to/Prev new message"    , M_MSG_EXIST},
-               {"/View/Go to/Prev marked message" , M_MSG_EXIST},
+               {"/View/Go to/Previous unread message" , M_MSG_EXIST},
+               {"/View/Go to/Previous new message"    , M_MSG_EXIST},
+               {"/View/Go to/Previous marked message" , M_MSG_EXIST},
                {"/View/Go to/Next marked message" , M_MSG_EXIST},
-               {"/View/Go to/Prev labeled message", M_MSG_EXIST},
+               {"/View/Go to/Previous labeled message", M_MSG_EXIST},
                {"/View/Go to/Next labeled message", M_MSG_EXIST},
                {"/View/Open in new window"        , M_SINGLE_TARGET_EXIST},
                {"/View/Show all headers"          , M_SINGLE_TARGET_EXIST},
@@ -1792,25 +1886,31 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
 
                {"/Message/Compose a news message", M_HAVE_NEWS_ACCOUNT},
                {"/Message/Reply"                 , M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST},
-               {"/Message/Reply to"             , M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST},
+               {"/Message/Reply to"              , M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST},
                {"/Message/Follow-up and reply to", M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST|M_NEWS},
                {"/Message/Forward"               , M_HAVE_ACCOUNT|M_TARGET_EXIST},
+               {"/Message/Forward as attachment" , M_HAVE_ACCOUNT|M_TARGET_EXIST},
                {"/Message/Redirect"              , M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST},
-               {"/Message/Move..."               , M_TARGET_EXIST|M_ALLOW_DELETE|M_UNLOCKED},
-               {"/Message/Copy..."               , M_TARGET_EXIST|M_EXEC|M_UNLOCKED},
-               {"/Message/Delete"                , M_TARGET_EXIST|M_ALLOW_DELETE|M_UNLOCKED|M_NOT_NEWS},
-               {"/Message/Cancel a news message" , M_TARGET_EXIST|M_ALLOW_DELETE|M_UNLOCKED|M_NEWS},
+               {"/Message/Move..."               , M_TARGET_EXIST|M_ALLOW_DELETE},
+               {"/Message/Copy..."               , M_TARGET_EXIST|M_EXEC},
+               {"/Message/Move to trash"         , M_TARGET_EXIST|M_ALLOW_DELETE|M_NOT_NEWS},
+               {"/Message/Delete..."             , M_TARGET_EXIST|M_ALLOW_DELETE},
+               {"/Message/Cancel a news message" , M_TARGET_EXIST|M_ALLOW_DELETE|M_NEWS},
                {"/Message/Mark"                  , M_TARGET_EXIST},
-               {"/Message/Re-edit"              , M_HAVE_ACCOUNT|M_ALLOW_REEDIT},
+               {"/Message/Re-edit"               , M_HAVE_ACCOUNT|M_ALLOW_REEDIT},
 
                {"/Tools/Add sender to address book"   , M_SINGLE_TARGET_EXIST},
-               {"/Tools/Harvest addresses"            , M_UNLOCKED},
-               {"/Tools/Filter all messages in folder", M_MSG_EXIST|M_EXEC|M_UNLOCKED},
-               {"/Tools/Filter selected messages"     , M_TARGET_EXIST|M_EXEC|M_UNLOCKED},
+               {"/Tools/Harvest addresses/from Folder..."       
+                                                      , M_MSG_EXIST},
+               {"/Tools/Harvest addresses/from Messages..."
+                                                      , M_MSG_EXIST|M_TARGET_EXIST},
+               {"/Tools/Filter all messages in folder", M_MSG_EXIST|M_EXEC},
+               {"/Tools/Filter selected messages"     , M_TARGET_EXIST|M_EXEC},
                {"/Tools/Create filter rule"           , M_SINGLE_TARGET_EXIST|M_UNLOCKED},
-               {"/Tools/Actions"                      , M_TARGET_EXIST|M_UNLOCKED},
+               {"/Tools/Create processing rule"       , M_SINGLE_TARGET_EXIST|M_UNLOCKED},
+               {"/Tools/Actions"                      , M_TARGET_EXIST},
                {"/Tools/Execute"                      , M_DELAY_EXEC},
-               {"/Tools/Delete duplicated messages/In selected folder"   , M_MSG_EXIST|M_ALLOW_DELETE|M_UNLOCKED},
+               {"/Tools/Delete duplicated messages/In selected folder"   , M_MSG_EXIST|M_ALLOW_DELETE},
 
                {"/Configuration", M_UNLOCKED},
 
@@ -1858,15 +1958,15 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
        case SORT_BY_NUMBER:
                menu_path = "/View/Sort/by number"; break;
        case SORT_BY_SIZE:
-               menu_path = "/View/Sort/by size"; break;
+               menu_path = "/View/Sort/by Size"; break;
        case SORT_BY_DATE:
-               menu_path = "/View/Sort/by date"; break;
+               menu_path = "/View/Sort/by Date"; break;
        case SORT_BY_FROM:
-               menu_path = "/View/Sort/by from"; break;
+               menu_path = "/View/Sort/by From"; break;
        case SORT_BY_TO:
-               menu_path = "/View/Sort/by recipient"; break;
+               menu_path = "/View/Sort/by To"; break;
        case SORT_BY_SUBJECT:
-               menu_path = "/View/Sort/by subject"; break;
+               menu_path = "/View/Sort/by Subject"; break;
        case SORT_BY_LABEL:
                menu_path = "/View/Sort/by color label"; break;
        case SORT_BY_MARK:
@@ -1899,7 +1999,10 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
                menu_set_sensitive(ifactory, "/View/Sort/Descending", FALSE);
        }
 
-       SET_CHECK_MENU_ACTIVE("/View/Show all headers",
+       if (mainwin->messageview 
+       &&  mainwin->messageview->mimeview
+       &&  mainwin->messageview->mimeview->textview)
+               SET_CHECK_MENU_ACTIVE("/View/Show all headers",
                              mainwin->messageview->mimeview->textview->show_all_headers);
        SET_CHECK_MENU_ACTIVE("/View/Thread view", (state & M_THREADED) != 0);
 
@@ -1937,13 +2040,13 @@ void main_window_show(MainWindow *mainwin)
                                  prefs_common.mainwin_x,
                                  prefs_common.mainwin_y);
 
-       gtk_widget_set_usize(GTK_WIDGET_PTR(mainwin->folderview),
+       gtk_widget_set_size_request(GTK_WIDGET_PTR(mainwin->folderview),
                             prefs_common.folderview_width,
                             prefs_common.folderview_height);
-       gtk_widget_set_usize(GTK_WIDGET_PTR(mainwin->summaryview),
+       gtk_widget_set_size_request(GTK_WIDGET_PTR(mainwin->summaryview),
                             prefs_common.summaryview_width,
                             prefs_common.summaryview_height);
-       gtk_widget_set_usize(GTK_WIDGET_PTR(mainwin->messageview),
+       gtk_widget_set_size_request(GTK_WIDGET_PTR(mainwin->messageview),
                             prefs_common.msgview_width,
                             prefs_common.msgview_height);
 
@@ -2008,35 +2111,63 @@ static void main_window_set_widgets(MainWindow *mainwin, SeparateType type)
 
        /* create separated window(s) if needed */
        if (type & SEPARATE_FOLDER) {
+               static GdkGeometry folderwin_geometry;
+               
                folderwin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
                gtk_window_set_title(GTK_WINDOW(folderwin),
-                                    _("Sylpheed - Folder View"));
-               gtk_window_set_resizable(GTK_WINDOW(folderwin), TRUE);
-               gtk_window_move(GTK_WINDOW(folderwin), prefs_common.folderwin_x,
+                                    _("Sylpheed-Claws - Folder View"));
+
+               gtk_window_move(GTK_WINDOW(folderwin),
+                               prefs_common.folderwin_x,
                                prefs_common.folderwin_y);
+
+               if (!folderwin_geometry.min_height) {
+                       folderwin_geometry.min_width = 320;
+                       folderwin_geometry.min_height = 200;
+               }
+               gtk_window_set_geometry_hints(GTK_WINDOW(folderwin), NULL,
+                                             &folderwin_geometry, GDK_HINT_MIN_SIZE);
+                               
+               gtk_widget_set_size_request(folderwin,
+                                           prefs_common.folderview_width,
+                                           prefs_common.folderview_height);
+
                gtk_container_set_border_width(GTK_CONTAINER(folderwin),
                                               BORDER_WIDTH);
+
                g_signal_connect(G_OBJECT(folderwin), "delete_event",
                                 G_CALLBACK(folder_window_close_cb),
                                   mainwin);
                gtk_container_add(GTK_CONTAINER(folderwin),
                                  GTK_WIDGET_PTR(mainwin->folderview));
                gtk_widget_realize(folderwin);
+
                if (prefs_common.folderview_visible)
                        gtk_widget_show(folderwin);
        }
 
        if (type & SEPARATE_MESSAGE) {
+               static GdkGeometry msgwin_geometry;
+               
                messagewin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
                gtk_window_set_title(GTK_WINDOW(messagewin),
-                                    _("Sylpheed - Message View"));
-               gtk_window_set_resizable(GTK_WINDOW(messagewin), TRUE);
+                                    _("Sylpheed-Claws - Message View"));
+                                    
                gtk_window_move(GTK_WINDOW(messagewin), 
                                prefs_common.main_msgwin_x,
                                prefs_common.main_msgwin_y);
+
+               if (!msgwin_geometry.min_height) {
+                       msgwin_geometry.min_width = 320;
+                       msgwin_geometry.min_height = 200;
+               }
+               gtk_window_set_geometry_hints(GTK_WINDOW(messagewin), NULL,
+                                             &msgwin_geometry, GDK_HINT_MIN_SIZE);
+               
                gtk_widget_set_size_request(messagewin, 
                                            prefs_common.msgwin_width,
                                            prefs_common.msgwin_height);
+
                gtk_container_set_border_width(GTK_CONTAINER(messagewin),
                                               BORDER_WIDTH);
                g_signal_connect(G_OBJECT(messagewin), "delete_event",
@@ -2261,13 +2392,13 @@ static gboolean toolbar_account_button_pressed(GtkWidget *widget,
 static void toolbar_child_attached(GtkWidget *widget, GtkWidget *child,
                                   gpointer data)
 {
-       gtk_widget_set_usize(child, 1, -1);
+       gtk_widget_set_size_request(child, 1, -1);
 }
 
 static void toolbar_child_detached(GtkWidget *widget, GtkWidget *child,
                                   gpointer data)
 {
-       gtk_widget_set_usize(child, -1, -1);
+       gtk_widget_set_size_request(child, -1, -1);
 }
 
 static gboolean ac_label_button_pressed(GtkWidget *widget, GdkEventButton *event,
@@ -2288,18 +2419,6 @@ static gboolean ac_label_button_pressed(GtkWidget *widget, GdkEventButton *event
        return TRUE;
 }
 
-static void ac_menu_popup_closed(GtkMenuShell *menu_shell, gpointer data)
-{
-       MainWindow *mainwin = (MainWindow *)data;
-       GtkWidget *button;
-
-       button = g_object_get_data(G_OBJECT(menu_shell), "menu_button");
-       if (!button) return;
-       gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
-       g_object_set_data(G_OBJECT(mainwin->ac_menu), "menu_button", NULL);
-       manage_window_focus_in(mainwin->window, NULL, NULL);
-}
-
 static gint main_window_close_cb(GtkWidget *widget, GdkEventAny *event,
                                 gpointer data)
 {
@@ -2423,9 +2542,9 @@ static void print_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
 static void app_exit_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
 {
        if (prefs_common.confirm_on_exit) {
-               if (alertpanel(_("Exit"), _("Exit this program?"),
-                              GTK_STOCK_OK, GTK_STOCK_CANCEL, NULL)
-                   != G_ALERTDEFAULT)
+               if (alertpanel(_("Exit"), _("Exit Sylpheed-Claws?"),
+                              GTK_STOCK_CANCEL, GTK_STOCK_OK,  NULL)
+                   != G_ALERTALTERNATE)
                        return;
                manage_window_focus_in(mainwin->window, NULL, NULL);
        }
@@ -2441,6 +2560,12 @@ static void search_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
                message_search(mainwin->messageview);
 }
 
+static void mainwindow_quicksearch(MainWindow *mainwin, guint action, GtkWidget *widget)
+{
+       prefs_common.show_searchbar = TRUE;
+       summaryview_activate_quicksearch(mainwin->summaryview);
+}
+
 static void toggle_folder_cb(MainWindow *mainwin, guint action,
                             GtkWidget *widget)
 {
@@ -2536,17 +2661,45 @@ static void separate_widget_cb(MainWindow *mainwin, guint action,
        prefs_common.sep_msg    = (type & SEPARATE_MESSAGE) != 0;
 }
 
-void main_window_toggle_work_offline (MainWindow *mainwin, gboolean offline)
+void main_window_toggle_work_offline (MainWindow *mainwin, gboolean offline,
+                                       gboolean ask_sync)
 {
+       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;
 }
 
 static void toggle_work_offline_cb (MainWindow *mainwin, guint action, GtkWidget *widget)
 {
-       main_window_toggle_work_offline(mainwin, GTK_CHECK_MENU_ITEM(widget)->active);
+       main_window_toggle_work_offline(mainwin, GTK_CHECK_MENU_ITEM(widget)->active, TRUE);
+}
+
+static void mainwindow_check_synchronise(MainWindow *mainwin, gboolean ask)
+{
+       GList *folderlist = folder_get_list();
+       gboolean found = FALSE;
+
+       /* see if there are synchronised folders */
+       for (; folderlist; folderlist = folderlist->next) {
+               Folder *folder = (Folder *)folderlist->data;
+               if (folder_want_synchronise(folder)) {
+                       found = TRUE;
+                       break;
+               }
+       }
+       
+       if (!found)
+               return;
+               
+       if (offline_ask_sync && ask && alertpanel(_("Folder synchronisation"),
+                       _("Do you want to synchronise your folders now?"),
+                       GTK_STOCK_CANCEL, _("+_Synchronise"), NULL) != G_ALERTALTERNATE)
+               return;
+
+       folder_synchronise(NULL);
 }
 
 static void online_switch_clicked (GtkButton *btn, gpointer data) 
@@ -2565,6 +2718,7 @@ static void online_switch_clicked (GtkButton *btn, gpointer data)
        
        if (btn == GTK_BUTTON(mainwin->online_switch)) {
                /* go offline */
+               mainwindow_check_synchronise(mainwin, TRUE);
                gtk_widget_hide (mainwin->online_switch);
                gtk_widget_show (mainwin->offline_switch);
                menuitem->active = TRUE;
@@ -2612,6 +2766,11 @@ static void delete_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
        summary_delete(mainwin->summaryview);
 }
 
+static void delete_trash_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
+{
+       summary_delete_trash(mainwin->summaryview);
+}
+
 static void cancel_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
 {
        summary_cancel(mainwin->summaryview);
@@ -2632,6 +2791,8 @@ static void show_all_header_cb(MainWindow *mainwin, guint action,
                               GtkWidget *widget)
 {
        if (mainwin->menu_lock_count) return;
+       mainwin->summaryview->messageview->all_headers = 
+                       GTK_CHECK_MENU_ITEM(widget)->active;
        summary_display_msg_selected(mainwin->summaryview,
                                     GTK_CHECK_MENU_ITEM(widget)->active);
 }
@@ -2740,12 +2901,18 @@ static void collapse_threads_cb(MainWindow *mainwin, guint action,
        summary_collapse_threads(mainwin->summaryview);
 }
 
-static void set_display_item_cb(MainWindow *mainwin, guint action,
+static void set_summary_display_item_cb(MainWindow *mainwin, guint action,
                                GtkWidget *widget)
 {
        prefs_summary_column_open();
 }
 
+static void set_folder_display_item_cb(MainWindow *mainwin, guint action,
+                               GtkWidget *widget)
+{
+       prefs_folder_column_open();
+}
+
 static void sort_summary_cb(MainWindow *mainwin, guint action,
                            GtkWidget *widget)
 {
@@ -2824,7 +2991,9 @@ static void delete_duplicated_all_cb(MainWindow *mainwin, guint action,
        struct DelDupsData data = {0, 0};
 
        folder_func_to_all_folders(deldup_all, &data);
-       alertpanel_notice(_("Deleted %d duplicate message(s) in %d folders.\n"),
+       alertpanel_notice(ngettext("Deleted %d duplicate message in %d folders.\n",
+                                  "Deleted %d duplicate messages in %d folders.\n",
+                                  data.dups),
                          data.dups, data.folders);
 }
 
@@ -2959,12 +3128,6 @@ static void create_processing_cb(MainWindow *mainwin, guint action,
        summary_filter_open(mainwin->summaryview, (PrefsFilterType)action, 1);
 }
 
-static void prefs_common_open_cb(MainWindow *mainwin, guint action,
-                                GtkWidget *widget)
-{
-       /* prefs_common_open(); */
-}
-
 static void prefs_pre_processing_open_cb(MainWindow *mainwin, guint action,
                                         GtkWidget *widget)
 {
@@ -3026,8 +3189,23 @@ static void new_account_cb(MainWindow *mainwin, guint action,
 
 static void account_selector_menu_cb(GtkMenuItem *menuitem, gpointer data)
 {
+       FolderItem *item = NULL;
        cur_account = (PrefsAccount *)data;
-       main_window_reflect_prefs_all();
+       
+       if (!mainwindow_get_mainwindow())
+               return;
+       main_window_show_cur_account(mainwindow_get_mainwindow());
+       toolbar_update(TOOLBAR_MAIN, mainwindow_get_mainwindow());
+       main_window_set_menu_sensitive(mainwindow_get_mainwindow());
+       toolbar_main_set_sensitive(mainwindow_get_mainwindow());
+       item = folderview_get_selected_item(
+                       mainwindow_get_mainwindow()->folderview);
+       if (item) {
+               toolbar_set_compose_button
+                       (mainwindow_get_mainwindow()->toolbar,
+                        FOLDER_TYPE(item->folder) == F_NEWS ? 
+                        COMPOSEBUTTON_NEWS : COMPOSEBUTTON_MAIL);
+       }
 }
 
 static void account_receive_menu_cb(GtkMenuItem *menuitem, gpointer data)
@@ -3054,6 +3232,11 @@ static void manual_open_cb(MainWindow *mainwin, guint action,
        manual_open((ManualType)action);
 }
 
+static void legend_open_cb(GtkMenuItem *menuitem, gpointer data)
+{
+       legend_show();
+}
+
 static void scan_tree_func(Folder *folder, FolderItem *item, gpointer data)
 {
        MainWindow *mainwin = (MainWindow *)data;
@@ -3181,6 +3364,11 @@ gboolean mainwindow_progressindicator_hook(gpointer source, gpointer userdata)
        return FALSE;
 }
 
+static void sync_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
+{
+       mainwindow_check_synchronise(mainwin, FALSE);
+}
+
 /*
 * End of Source.
 */