2010-11-24 [mones] 3.7.7cvs5
[claws.git] / src / mainwindow.c
index b8705740c6a18282a6e6ed1857a9b967d81d2ae0..95efa5213c1ab20ecde2aeb3b25c76b7ac2e4e0e 100644 (file)
@@ -1,6 +1,6 @@
 /*
    Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
-   Copyright (C) 1999-2008 Hiroyuki Yamamoto and the Claws Mail team
+   Copyright (C) 1999-2009 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
@@ -81,6 +81,9 @@
 #include "imap.h"
 #include "socket.h"
 #include "printing.h"
+#ifdef G_OS_WIN32
+#include "w32lib.h"
+#endif
 
 #define AC_LABEL_WIDTH 240
 
@@ -144,10 +147,8 @@ static void empty_trash_cb  (GtkAction     *action,
                                  gpointer       data);
 static void save_as_cb          (GtkAction     *action,
                                  gpointer       data);
-#if GTK_CHECK_VERSION(2,10,0) && !defined(USE_GNOMEPRINT)
 static void page_setup_cb       (GtkAction     *action,
                                  gpointer       data);
-#endif
 static void print_cb            (GtkAction     *action,
                                  gpointer       data);
 static void app_exit_cb                 (GtkAction     *action,
@@ -187,6 +188,8 @@ static void view_source_cb          (GtkAction      *action,
 
 static void show_all_header_cb         (GtkAction      *action,
                                  gpointer       data);
+static void toggle_fullscreen_cb       (GtkAction      *action,
+                                 gpointer       data);
 
 static void hide_quotes_cb(GtkAction   *action,
                                  gpointer       data);
@@ -244,6 +247,8 @@ static void set_decode_cb           (GtkAction *action, GtkRadioAction *current, gpointer
 
 static void hide_read_messages   (GtkAction    *action,
                                  gpointer       data);
+static void hide_del_messages   (GtkAction     *action,
+                                 gpointer       data);
 
 static void thread_cb           (GtkAction     *action,
                                  gpointer       data);
@@ -273,6 +278,8 @@ static void process_cb               (GtkAction     *action,
                                  gpointer       data);
 static void execute_summary_cb  (GtkAction     *action,
                                  gpointer       data);
+static void expunge_summary_cb  (GtkAction     *action,
+                                 gpointer       data);
 static void update_summary_cb   (GtkAction     *action,
                                  gpointer       data);
 
@@ -340,7 +347,7 @@ static void prefs_post_processing_open_cb (GtkAction        *action,
 
 static void prefs_filtering_open_cb    (GtkAction      *action,
                                  gpointer       data);
-#if (defined(USE_OPENSSL) || defined (USE_GNUTLS))
+#ifdef USE_GNUTLS
 static void ssl_manager_open_cb        (GtkAction      *action,
                                  gpointer       data);
 #endif
@@ -371,6 +378,11 @@ static void manual_faq_open_cb      (GtkAction     *action,
 static void legend_open_cb      (GtkAction     *action,
                                  gpointer       data);
 
+#ifdef G_OS_WIN32
+static void set_default_client_cb (GtkAction   *action,
+                                 gpointer       data);
+#endif
+
 static void scan_tree_func      (Folder        *folder,
                                  FolderItem    *item,
                                  gpointer       data);
@@ -480,9 +492,7 @@ static GtkActionEntry mainwin_entries[] =
 
        {"File/SaveAs",                         NULL, N_("_Save as..."), "<control>S", NULL, G_CALLBACK(save_as_cb) },
 
-#if GTK_CHECK_VERSION(2,10,0) && !defined(USE_GNOMEPRINT)
        {"File/PageSetup",                      NULL, N_("Page setup..."), NULL, NULL, G_CALLBACK(page_setup_cb) },
-#endif
        {"File/Print",                          NULL, N_("_Print..."), "<control>P", NULL, G_CALLBACK(print_cb) },
        /* {"File/---",                         NULL, "---" }, */
        {"File/SynchroniseFolders",             NULL, N_("Synchronise folders"), "<control><shift>S", NULL, G_CALLBACK(sync_cb) }, 
@@ -619,7 +629,7 @@ static GtkActionEntry mainwin_entries[] =
        {"Message/CancelNews",                  NULL, N_("Cancel a news message"), NULL, NULL, G_CALLBACK(cancel_cb) },
        /*{"Message/---",                       NULL, "---" },*/
        
-       {"Message/Mark",                        NULL, "_Mark" },
+       {"Message/Mark",                        NULL, N_("_Mark") },
        {"Message/Mark/Mark",                   NULL, N_("_Mark"), "<shift>asterisk", NULL, G_CALLBACK(mark_cb) },
        {"Message/Mark/Unmark",                 NULL, N_("_Unmark"), "U", NULL, G_CALLBACK(unmark_cb) },
        {"Message/Mark/---",                    NULL, "---", NULL, NULL, NULL },
@@ -633,8 +643,8 @@ static GtkActionEntry mainwin_entries[] =
        {"Message/Mark/UnwatchThread",          NULL, N_("Unwatch thread"), NULL, NULL, G_CALLBACK(unwatch_thread_cb) },
        /* separation */
 
-       {"Message/Mark/MarkSpam",               NULL, N_("Mark as spam"), NULL, NULL, G_CALLBACK(mark_as_spam_cb) },
-       {"Message/Mark/MarkHam",                NULL, N_("Mark as ham"), NULL, NULL, G_CALLBACK(mark_as_ham_cb) },
+       {"Message/Mark/MarkSpam",               NULL, N_("Mark as _spam"), NULL, NULL, G_CALLBACK(mark_as_spam_cb) },
+       {"Message/Mark/MarkHam",                NULL, N_("Mark as _ham"), NULL, NULL, G_CALLBACK(mark_as_ham_cb) },
        /* separation */
 
        {"Message/Mark/Lock",                   NULL, N_("Lock"), NULL, NULL, G_CALLBACK(lock_msgs_cb) },
@@ -687,12 +697,15 @@ static GtkActionEntry mainwin_entries[] =
        /* {"Tools/---",                        NULL, "---", NULL, NULL, NULL }, */
 
        {"Tools/Execute",                       NULL, N_("E_xecute"), "X", NULL, G_CALLBACK(execute_summary_cb) }, 
-#if (defined(USE_OPENSSL) || defined (USE_GNUTLS))
+       {"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) }, 
 #endif
        /* {"Tools/---",                        NULL, "---", NULL, NULL, NULL }, */
+#ifndef G_OS_WIN32
        {"Tools/FilteringLog",                  NULL, N_("Filtering Lo_g"), NULL, NULL, G_CALLBACK(filtering_debug_window_show_cb) }, 
+#endif
        {"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) }, 
@@ -719,6 +732,9 @@ static GtkActionEntry mainwin_entries[] =
        {"Help/Manual",                         NULL, N_("_Manual"), NULL, NULL, G_CALLBACK(manual_open_cb) }, 
        {"Help/FAQ",                            NULL, N_("_Online User-contributed FAQ"), NULL, NULL, G_CALLBACK(manual_faq_open_cb) }, 
        {"Help/IconLegend",                     NULL, N_("Icon _Legend"), NULL, NULL, G_CALLBACK(legend_open_cb) }, 
+#ifdef G_OS_WIN32
+       {"Help/SetDefault",                     NULL, N_("Set as default client"), NULL, NULL, G_CALLBACK(set_default_client_cb) }, 
+#endif
        {"Help/---",                            NULL, "---" }, 
        {"Help/About",                          NULL, N_("_About"), NULL, NULL, G_CALLBACK(about_cb) }, 
 };
@@ -732,6 +748,10 @@ static GtkToggleActionEntry mainwin_toggle_entries[] = {
        {"View/ShowHide/ColumnHeaders",         NULL, N_("Column headers"), NULL, NULL, G_CALLBACK(toggle_col_headers_cb) }, /* toggle */
        {"View/ThreadView",                     NULL, N_("Th_read view"), "<control>T", NULL, G_CALLBACK(thread_cb) }, /* toggle */
        {"View/HideReadMessages",               NULL, N_("_Hide read messages"), NULL, NULL, G_CALLBACK(hide_read_messages) }, /* toggle */
+       {"View/HideDelMessages",                NULL, N_("Hide deleted messages"), NULL, NULL, G_CALLBACK(hide_del_messages) }, /* toggle */
+#ifndef MAEMO
+       {"View/FullScreen",                     NULL, N_("_Fullscreen"), "F11", NULL, G_CALLBACK(toggle_fullscreen_cb) }, /* toggle */
+#endif
        {"View/AllHeaders",                     NULL, N_("Show all _headers"), "<control>H", NULL, G_CALLBACK(show_all_header_cb) }, /* toggle */
        {"View/Quotes/FoldAll",                 NULL, N_("_Fold all"), "<control><shift>Q", NULL, G_CALLBACK(hide_quotes_cb) }, /* 1 toggle */
        {"View/Quotes/Fold2",                   NULL, N_("Fold from level _2"), NULL, NULL, G_CALLBACK(hide_quotes_cb) }, /* 2 toggle */
@@ -781,21 +801,21 @@ static GtkRadioActionEntry mainwin_sorttype_radio_entries[] = { /* sort_summary_
 
 static GtkRadioActionEntry mainwin_radio_enc_entries[] =
 {
-       ENC_ACTION(CS_AUTO, C_AUTO, "_Automatic"), /* RADIO set_charset_cb */
-       ENC_ACTION(CS_US_ASCII, C_US_ASCII, "7bit ASCII (US-ASC_II)"), /* RADIO set_charset_cb */
-       ENC_ACTION(CS_UTF_8, C_UTF_8, "Unicode (_UTF-8)"), /* RADIO set_charset_cb */
+       ENC_ACTION(CS_AUTO, C_AUTO, N_("_Automatic")), /* RADIO set_charset_cb */
+       ENC_ACTION(CS_US_ASCII, C_US_ASCII, N_("7bit ASCII (US-ASC_II)")), /* RADIO set_charset_cb */
+       ENC_ACTION(CS_UTF_8, C_UTF_8, N_("Unicode (_UTF-8)")), /* RADIO set_charset_cb */
        ENC_ACTION("Western/"CS_ISO_8859_1, C_ISO_8859_1, "ISO-8859-_1"), /* RADIO set_charset_cb */
        ENC_ACTION("Western/"CS_ISO_8859_15, C_ISO_8859_15, "ISO-8859-15"), /* RADIO set_charset_cb */
        ENC_ACTION("Western/"CS_WINDOWS_1252, C_WINDOWS_1252, "Windows-1252"), /* RADIO set_charset_cb */
-       ENC_ACTION(CS_ISO_8859_2, C_ISO_8859_2, "Central European (ISO-8859-_2)"), /* RADIO set_charset_cb */
+       ENC_ACTION(CS_ISO_8859_2, C_ISO_8859_2, N_("Central European (ISO-8859-_2)")), /* RADIO set_charset_cb */
        ENC_ACTION("Baltic/"CS_ISO_8859_13, C_ISO_8859_13, "ISO-8859-13"), /* RADIO set_charset_cb */
        ENC_ACTION("Baltic/"CS_ISO_8859_4, C_ISO_8859_14, "ISO-8859-_4"), /* RADIO set_charset_cb */
-       ENC_ACTION(CS_ISO_8859_7, C_ISO_8859_7, "Greek (ISO-8859-_7)"), /* RADIO set_charset_cb */
+       ENC_ACTION(CS_ISO_8859_7, C_ISO_8859_7, N_("Greek (ISO-8859-_7)")), /* RADIO set_charset_cb */
        ENC_ACTION("Hebrew/"CS_ISO_8859_8, C_ISO_8859_8, "ISO-8859-_8"), /* RADIO set_charset_cb */
        ENC_ACTION("Hebrew/"CS_WINDOWS_1255, C_WINDOWS_1255, "Windows-1255"), /* RADIO set_charset_cb */
        ENC_ACTION("Arabic/"CS_ISO_8859_6, C_ISO_8859_6, "ISO-8859-_6"), /* RADIO set_charset_cb */
        ENC_ACTION("Arabic/"CS_WINDOWS_1256, C_WINDOWS_1256, "Windows-1256"), /* RADIO set_charset_cb */
-       ENC_ACTION(CS_ISO_8859_9, C_ISO_8859_9, "Turkish (ISO-8859-_9)"), /* RADIO set_charset_cb */
+       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_KOI8_U, C_KOI8_U, "KOI8-_U"), /* RADIO set_charset_cb */
@@ -804,6 +824,7 @@ static GtkRadioActionEntry mainwin_radio_enc_entries[] =
        ENC_ACTION("Japanese/"CS_ISO_2022_JP_2, C_ISO_2022_JP_2, "ISO-2022-JP-_2"), /* RADIO set_charset_cb */
        ENC_ACTION("Japanese/"CS_EUC_JP, C_EUC_JP, "_EUC-JP"), /* RADIO set_charset_cb */
        ENC_ACTION("Japanese/"CS_SHIFT_JIS, C_SHIFT_JIS, "_Shift-JIS"), /* RADIO set_charset_cb */
+       ENC_ACTION("Chinese/"CS_GB18030, C_GB18030, "_GB18030"), /* RADIO set_charset_cb */
        ENC_ACTION("Chinese/"CS_GB2312, C_GB2312, "_GB2312"), /* RADIO set_charset_cb */
        ENC_ACTION("Chinese/"CS_GBK, C_GBK, "GB_K"), /* RADIO set_charset_cb */
        ENC_ACTION("Chinese/"CS_BIG5, C_BIG5, "_Big5-JP"), /* RADIO set_charset_cb */
@@ -816,7 +837,7 @@ static GtkRadioActionEntry mainwin_radio_enc_entries[] =
 
 static GtkRadioActionEntry mainwin_radio_dec_entries[] =
 {
-       DEC_ACTION("AutoDetect", 0, "_Auto detect"),    /* set_decode_cb */
+       DEC_ACTION("AutoDetect", 0, N_("_Auto detect")),        /* set_decode_cb */
        /* --- */
        DEC_ACTION("8bit", ENC_8BIT, "_8bit"),
        DEC_ACTION("QP", ENC_QUOTED_PRINTABLE, "_Quoted printable"),
@@ -859,13 +880,13 @@ static void mainwindow_colorlabel_menu_item_activate_item_cb(GtkMenuItem *menu_i
        GSList *sel;
 
        mainwin = (MainWindow *)data;
-       g_return_if_fail(mainwin != NULL);
+       cm_return_if_fail(mainwin != NULL);
 
        sel = summary_get_selection(mainwin->summaryview);
        if (!sel) return;
 
        menu = GTK_MENU_SHELL(mainwin->colorlabel_menu);
-       g_return_if_fail(menu != NULL);
+       cm_return_if_fail(menu != NULL);
 
        Xalloca(items, (N_COLOR_LABELS + 1) * sizeof(GtkWidget *), return);
 
@@ -915,7 +936,7 @@ static void mainwindow_colorlabel_menu_item_activate_cb(GtkWidget *widget,
        MainWindow *mainwin;
 
        mainwin = g_object_get_data(G_OBJECT(widget), "mainwin");
-       g_return_if_fail(mainwin != NULL);
+       cm_return_if_fail(mainwin != NULL);
 
        /* "dont_toggle" state set? */
        if (g_object_get_data(G_OBJECT(mainwin->colorlabel_menu),
@@ -942,13 +963,13 @@ static void mainwindow_tags_menu_item_activate_item_cb(GtkMenuItem *menu_item,
                                        NULL, NULL);
        gint sel_len;
        mainwin = (MainWindow *)data;
-       g_return_if_fail(mainwin != NULL);
+       cm_return_if_fail(mainwin != NULL);
 
        sel = summary_get_selection(mainwin->summaryview);
        if (!sel) return;
 
        menu = GTK_MENU_SHELL(mainwin->tags_menu);
-       g_return_if_fail(menu != NULL);
+       cm_return_if_fail(menu != NULL);
 
        /* NOTE: don't return prematurely because we set the "dont_toggle"
         * state for check menu items */
@@ -1024,7 +1045,7 @@ static void mainwindow_tags_menu_item_activate_cb(GtkWidget *widget,
        MainWindow *mainwin;
 
        mainwin = g_object_get_data(G_OBJECT(widget), "mainwin");
-       g_return_if_fail(mainwin != NULL);
+       cm_return_if_fail(mainwin != NULL);
 
        /* "dont_toggle" state set? */
        if (g_object_get_data(G_OBJECT(mainwin->tags_menu),
@@ -1036,6 +1057,33 @@ static void mainwindow_tags_menu_item_activate_cb(GtkWidget *widget,
        summary_set_tag(mainwin->summaryview, id, NULL);
 }
 
+void mainwin_accel_changed_cb (GtkAccelGroup *accelgroup, guint keyval, GdkModifierType modifier,
+                                 GClosure *closure, GtkMenuItem *item)
+{
+       GList *closures = gtk_widget_list_accel_closures(GTK_WIDGET(item));
+       GList *cur;
+       for (cur = closures; cur; cur = cur->next) {
+               if (closure == cur->data) {
+                       GtkLabel *label = g_object_get_data(G_OBJECT(item), "accel_label");
+                       gchar *new_accel;
+                       
+                       if (keyval == GDK_BackSpace) {
+                               const gchar *accel_path;
+#if GTK_CHECK_VERSION(2,14,0)
+                               accel_path = gtk_menu_item_get_accel_path(item);
+#else
+                               accel_path = GTK_MENU_ITEM(item)->accel_path;
+#endif
+                               keyval = 0; modifier = 0;
+                               gtk_accel_map_change_entry (accel_path, keyval, modifier, TRUE);
+                       }
+                       new_accel = gtk_accelerator_get_label(keyval, modifier);
+                       gtk_label_set_text(label, new_accel);
+                       g_free(new_accel);
+               }
+       }
+}
+
 static void mainwindow_colorlabel_menu_create(MainWindow *mainwin, gboolean refresh)
 {
        GtkWidget *label_menuitem;
@@ -1087,11 +1135,15 @@ static void mainwindow_colorlabel_menu_create(MainWindow *mainwin, gboolean refr
                g_object_set_data(G_OBJECT(item), "mainwin",
                                  mainwin);
                gtk_widget_show(item);
-               accel_path = g_strdup_printf("<ClawsColorLabels>/%d", i);
+               accel_path = g_strdup_printf("<ClawsColorLabels>/%d", i+1);
                gtk_menu_item_set_accel_path(GTK_MENU_ITEM(item), accel_path);
                if (i < 9)
                        gtk_accel_map_add_entry(accel_path, GDK_1+i, GDK_CONTROL_MASK);
                g_free(accel_path);
+               g_signal_connect (gtk_ui_manager_get_accel_group(mainwin->ui_manager), 
+                       "accel-changed", G_CALLBACK (mainwin_accel_changed_cb), item);
+
+
        }
        gtk_widget_show(menu);
        gtk_menu_item_set_submenu(GTK_MENU_ITEM(label_menuitem), menu);
@@ -1104,7 +1156,7 @@ static void mainwindow_tags_menu_item_apply_tags_activate_cb(GtkWidget *widget,
        MainWindow *mainwin;
 
        mainwin = g_object_get_data(G_OBJECT(widget), "mainwin");
-       g_return_if_fail(mainwin != NULL);
+       cm_return_if_fail(mainwin != NULL);
 
        /* "dont_toggle" state set? */
        if (g_object_get_data(G_OBJECT(mainwin->tags_menu),
@@ -1263,14 +1315,18 @@ static gboolean mainwindow_key_pressed (GtkWidget *widget, GdkEventKey *event,
 
        switch (event->keyval) {
        case GDK_Q:             /* Quit */
+#ifndef MAEMO
                BREAK_ON_MODIFIER_KEY();
 
-               app_exit_cb(NULL, mainwin);
+               if (gtk_window_is_active(GTK_WINDOW(mainwin->window))) {
+                       app_exit_cb(NULL, mainwin);
+               }
+#endif
                return FALSE;
        case GDK_space:
                BREAK_ON_MODIFIER_KEY();
                if (gtk_window_is_active(GTK_WINDOW(mainwin->window))) {
-                       if (mainwin->folderview && mainwin->summaryview
+                       if (mainwin->folderview != NULL && mainwin->summaryview != NULL
                            && ((!mainwin->summaryview->displayed
                                && !mainwin->summaryview->selected) 
                                || (mainwin->summaryview->folder_item
@@ -1281,6 +1337,7 @@ static gboolean mainwindow_key_pressed (GtkWidget *widget, GdkEventKey *event,
                        }
                }
                break;
+
 #ifdef MAEMO
        case GDK_F6:
                if (maemo_mainwindow_is_fullscreen(widget)) {
@@ -1541,7 +1598,7 @@ MainWindow *main_window_create()
 #ifndef MAEMO
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/", "Menu", NULL, GTK_UI_MANAGER_MENUBAR)
 #else
-       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/", "Menu", NULL, GTK_UI_MANAGER_MENU)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/", "Menu", NULL, GTK_UI_MANAGER_POPUP)
 #endif
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu", "File", "File", GTK_UI_MANAGER_MENU)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu", "Edit", "Edit", GTK_UI_MANAGER_MENU)
@@ -1564,9 +1621,7 @@ MainWindow *main_window_create()
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "EmptyTrashes", "File/EmptyTrashes", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Separator4", "File/---", GTK_UI_MANAGER_SEPARATOR)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "SaveAs", "File/SaveAs", GTK_UI_MANAGER_MENUITEM)
-#if GTK_CHECK_VERSION(2,10,0) && !defined(USE_GNOMEPRINT)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "PageSetup", "File/PageSetup", GTK_UI_MANAGER_MENUITEM)
-#endif
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Print", "File/Print", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Separator5", "File/---", GTK_UI_MANAGER_SEPARATOR)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "OfflineMode", "File/OfflineMode", GTK_UI_MANAGER_MENUITEM)
@@ -1604,6 +1659,9 @@ MainWindow *main_window_create()
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/SetColumns", "Messagelist", "View/SetColumns/Messagelist", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Separator1", "View/---", GTK_UI_MANAGER_SEPARATOR)
 
+#ifndef MAEMO
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "FullScreen", "View/FullScreen", GTK_UI_MANAGER_MENUITEM)
+#endif
 #ifndef GENERIC_UMPC
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Layout", "View/Layout", GTK_UI_MANAGER_MENU)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Layout", "Standard", "View/Layout/Standard", GTK_UI_MANAGER_MENUITEM)
@@ -1640,6 +1698,7 @@ MainWindow *main_window_create()
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "ExpandThreads", "View/ExpandThreads", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "CollapseThreads", "View/CollapseThreads", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "HideReadMessages", "View/HideReadMessages", GTK_UI_MANAGER_MENUITEM)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "HideDelMessages", "View/HideDelMessages", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Separator3", "View/---", GTK_UI_MANAGER_SEPARATOR)
 
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Goto", "View/Goto", GTK_UI_MANAGER_MENU)
@@ -1708,6 +1767,7 @@ MainWindow *main_window_create()
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Japanese", CS_SHIFT_JIS, "View/Encoding/Japanese/"CS_SHIFT_JIS, GTK_UI_MANAGER_MENUITEM)
 
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding", "Chinese", "View/Encoding/Chinese", GTK_UI_MANAGER_MENU)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Chinese", CS_GB18030, "View/Encoding/Chinese/"CS_GB18030, GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Chinese", CS_GB2312, "View/Encoding/Chinese/"CS_GB2312, GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Chinese", CS_GBK, "View/Encoding/Chinese/"CS_GBK, GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Chinese", CS_BIG5, "View/Encoding/Chinese/"CS_BIG5, GTK_UI_MANAGER_MENUITEM)
@@ -1847,12 +1907,15 @@ MainWindow *main_window_create()
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "Separator5", "Tools/---", GTK_UI_MANAGER_SEPARATOR)
 
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "Execute", "Tools/Execute", GTK_UI_MANAGER_MENUITEM)
-#if (defined(USE_OPENSSL) || defined (USE_GNUTLS))
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "Expunge", "Tools/Expunge", GTK_UI_MANAGER_MENUITEM)
+#ifdef USE_GNUTLS
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "Separator6", "Tools/---", GTK_UI_MANAGER_SEPARATOR)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "SSLCertificates", "Tools/SSLCertificates", GTK_UI_MANAGER_MENUITEM)
 #endif
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "Separator7", "Tools/---", GTK_UI_MANAGER_SEPARATOR)
+#ifndef G_OS_WIN32
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "FilteringLog", "Tools/FilteringLog", GTK_UI_MANAGER_MENUITEM)
+#endif
        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)
@@ -1881,7 +1944,11 @@ MainWindow *main_window_create()
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Help", "Manual", "Help/Manual", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Help", "FAQ", "Help/FAQ", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Help", "IconLegend", "Help/IconLegend", GTK_UI_MANAGER_MENUITEM)
+#ifdef G_OS_WIN32
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Help", "Separator1", "Help/---", GTK_UI_MANAGER_SEPARATOR)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Help", "SetDefault", "Help/SetDefault", GTK_UI_MANAGER_MENUITEM)
+#endif
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Help", "Separator2", "Help/---", GTK_UI_MANAGER_SEPARATOR)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Help", "About", "Help/About", GTK_UI_MANAGER_MENUITEM)
 
 
@@ -1895,7 +1962,6 @@ MainWindow *main_window_create()
        hildon_window_set_menu(HILDON_WINDOW(window), GTK_MENU(menubar));
 #endif
 
-
        if (prefs_common.toolbar_detachable) {
                handlebox = gtk_handle_box_new();
                gtk_widget_show(handlebox);
@@ -1946,8 +2012,6 @@ MainWindow *main_window_create()
        g_signal_connect(G_OBJECT(warning_btn), "button-press-event", 
                         G_CALLBACK(warning_icon_pressed),
                         (gpointer) mainwin);
-       g_signal_connect(G_OBJECT(warning_btn), "visibility-notify-event",
-                        G_CALLBACK(warning_visi_notify), mainwin);
        g_signal_connect(G_OBJECT(warning_btn), "motion-notify-event",
                         G_CALLBACK(warning_visi_notify), mainwin);
        g_signal_connect(G_OBJECT(warning_btn), "leave-notify-event",
@@ -1971,6 +2035,7 @@ MainWindow *main_window_create()
        online_pixmap = stock_pixmap_widget(hbox_stat, STOCK_PIXMAP_ONLINE);
        offline_pixmap = stock_pixmap_widget(hbox_stat, STOCK_PIXMAP_OFFLINE);
        online_switch = gtk_button_new ();
+       gtkut_widget_set_can_focus(online_switch, FALSE);
        CLAWS_SET_TIP(online_switch, 
                             _("You are online. Click the icon to go offline"));
        offline_switch = gtk_button_new ();
@@ -1990,7 +2055,7 @@ MainWindow *main_window_create()
 
        ac_button = gtk_button_new();
        CLAWS_SET_TIP(ac_button, _("Select account"));
-       GTK_WIDGET_UNSET_FLAGS(ac_button, GTK_CAN_FOCUS);
+       gtkut_widget_set_can_focus(ac_button, FALSE);
        gtk_widget_set_size_request(ac_button, -1, 0);
        gtk_box_pack_end(GTK_BOX(hbox_stat), ac_button, FALSE, FALSE, 0);
        g_signal_connect(G_OBJECT(ac_button), "button_press_event",
@@ -2011,7 +2076,7 @@ MainWindow *main_window_create()
 #endif
        /* create views */
        mainwin->folderview  = folderview  = folderview_create();
-       mainwin->summaryview = summaryview = summary_create();
+       mainwin->summaryview = summaryview = summary_create(mainwin);
        mainwin->messageview = messageview = messageview_create(mainwin);
 
        /* init log instances data before creating log views */
@@ -2150,6 +2215,9 @@ MainWindow *main_window_create()
        }
        gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE);
 
+       toolbar_set_style(mainwin->toolbar->toolbar, 
+                         mainwin->handlebox, 
+                         prefs_common.toolbar_style);
 #ifndef GENERIC_UMPC
        gtk_widget_hide(mainwin->hbox_stat);
        menuitem = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/View/ShowHide/StatusBar");
@@ -2181,8 +2249,6 @@ MainWindow *main_window_create()
 
        ADD_MENU_ACCEL_GROUP_TO_WINDOW(summaryview->popupmenu, mainwin->window);
        
-/* FIXME       menu_connect_identical_items(); */
-
 #ifndef GENERIC_UMPC
        gtk_window_iconify(GTK_WINDOW(mainwin->window));
 #endif
@@ -2205,7 +2271,7 @@ MainWindow *main_window_create()
        folderview_init(folderview);
        summary_init(summaryview);
        messageview_init(messageview);
-#if (defined(USE_OPENSSL) || defined (USE_GNUTLS))
+#ifdef USE_GNUTLS
        sslcertwindow_register_hook();
 #endif
        mainwin->lock_count = 0;
@@ -2229,6 +2295,13 @@ MainWindow *main_window_create()
 
 #ifdef MAEMO
        main_window_install_maemo_hooks(mainwin);
+#endif
+#ifndef MAEMO
+       if (prefs_common.mainwin_fullscreen) {
+               cm_toggle_menu_set_active_full(mainwin->ui_manager, 
+                       "Menu/View/FullScreen",
+                       TRUE);
+       }
 #endif
        return mainwin;
 }
@@ -2325,8 +2398,10 @@ static gboolean reflect_prefs_timeout_cb(gpointer data)
                        toolbar_update(TOOLBAR_MAIN, mainwin);
                        messageview_reflect_prefs_pixmap_theme();
                        compose_reflect_prefs_pixmap_theme();
-                       folderview_reflect_prefs_pixmap_theme(mainwin->folderview);
+                       folderview_reinit_fonts(mainwin->folderview);
                        summary_reflect_prefs_pixmap_theme(mainwin->summaryview);
+                       foldersel_reflect_prefs_pixmap_theme();
+                       addressbook_reflect_prefs_pixmap_theme();
 #ifndef GENERIC_UMPC
                        pixmap = stock_pixmap_widget(mainwin->hbox_stat, STOCK_PIXMAP_ONLINE);
                        gtk_container_remove(GTK_CONTAINER(mainwin->online_switch), 
@@ -2377,15 +2452,19 @@ void main_window_reflect_prefs_custom_colors(MainWindow *mainwin)
 
        /* re-create colorlabel submenu */
        menu = GTK_MENU_SHELL(mainwin->colorlabel_menu);
-       g_return_if_fail(menu != NULL);
+       cm_return_if_fail(menu != NULL);
 
        /* clear items. get item pointers. */
        for (cur = menu->children; cur != NULL && cur->data != NULL; cur = cur->next) {
+               g_signal_handlers_disconnect_matched
+                        (gtk_ui_manager_get_accel_group(mainwin->ui_manager), 
+                        G_SIGNAL_MATCH_DATA|G_SIGNAL_MATCH_FUNC,
+                        0, 0, NULL, mainwin_accel_changed_cb, cur->data);
                gtk_menu_item_set_submenu(GTK_MENU_ITEM(cur->data), NULL);
        }
        mainwindow_colorlabel_menu_create(mainwin, TRUE);
        summary_reflect_prefs_custom_colors(mainwin->summaryview);
-
+       folderview_reinit_fonts(mainwin->folderview);
 }
 
 static gint tags_tag = 0;
@@ -2401,7 +2480,7 @@ static gboolean main_window_reflect_tags_changes_real(gpointer data)
        }
        /* re-create tags submenu */
        menu = GTK_MENU_SHELL(mainwin->tags_menu);
-       g_return_val_if_fail(menu != NULL, FALSE);
+       cm_return_val_if_fail(menu != NULL, FALSE);
 
        /* clear items. get item pointers. */
        for (cur = menu->children; cur != NULL && cur->data != NULL; cur = cur->next) {
@@ -2732,7 +2811,7 @@ void main_window_toggle_message_view(MainWindow *mainwin)
        SummaryView *summaryview = mainwin->summaryview;
        GtkWidget *ppaned = NULL;
        GtkWidget *container = NULL;
-       
+
        switch (prefs_common.layout_mode) {
        case NORMAL_LAYOUT:
        case VERTICAL_LAYOUT:
@@ -2806,8 +2885,12 @@ void main_window_get_size(MainWindow *mainwin)
        }
 
        allocation = &(GTK_WIDGET_PTR(mainwin->summaryview)->allocation);
-
-       if (allocation->width > 1 && allocation->height > 1) {
+       
+       if (prefs_common.mainwin_fullscreen) {
+               debug_print("mainwin in full screen state. "
+                           "Keeping original settings\n");
+       }
+       if (allocation->width > 1 && allocation->height > 1 && !prefs_common.mainwin_fullscreen) {
                prefs_common.summaryview_width = allocation->width;
 
                if (messageview_is_visible(mainwin->messageview))
@@ -2818,20 +2901,22 @@ void main_window_get_size(MainWindow *mainwin)
 
        allocation = &mainwin->window->allocation;
        if (allocation->width > 1 && allocation->height > 1 &&
-           !prefs_common.mainwin_maximised) {
+           !prefs_common.mainwin_maximised && !prefs_common.mainwin_fullscreen) {
                prefs_common.mainview_height = allocation->height;
                prefs_common.mainwin_width   = allocation->width;
                prefs_common.mainwin_height  = allocation->height;
        }
 
        allocation = &(GTK_WIDGET_PTR(mainwin->folderview)->allocation);
-       if (allocation->width > 1 && allocation->height > 1) {
+       if (allocation->width > 1 && allocation->height > 1 &&
+           !prefs_common.mainwin_fullscreen) {
                prefs_common.folderview_width  = allocation->width;
                prefs_common.folderview_height = allocation->height;
        }
 
        allocation = &(GTK_WIDGET_PTR(mainwin->messageview)->allocation);
-       if (allocation->width > 1 && allocation->height > 1) {
+       if (allocation->width > 1 && allocation->height > 1 &&
+           !prefs_common.mainwin_fullscreen) {
                prefs_common.msgview_width = allocation->width;
                prefs_common.msgview_height = allocation->height;
        }
@@ -2851,7 +2936,7 @@ void main_window_get_position(MainWindow *mainwin)
 {
        gint x, y;
 
-       if (prefs_common.mainwin_maximised)
+       if (prefs_common.mainwin_maximised || prefs_common.mainwin_fullscreen)
                return;
 
        gtkut_widget_get_uposition(mainwin->window, &x, &y);
@@ -2875,7 +2960,7 @@ void main_window_progress_off(MainWindow *mainwin)
        gtk_progress_bar_set_text(GTK_PROGRESS_BAR(mainwin->progressbar), "");
 }
 
-static gboolean main_window_empty_trash(MainWindow *mainwin, gboolean confirm, gboolean for_quit)
+gboolean main_window_empty_trash(MainWindow *mainwin, gboolean confirm, gboolean for_quit)
 {
        if (confirm && procmsg_have_trashed_mails_fast()) {
                AlertValue val;
@@ -3034,6 +3119,9 @@ SensitiveCond main_window_get_current_state(MainWindow *mainwin)
        if (imap_cancel_all_enabled())
                state |= M_INC_ACTIVE;
 
+       if (mainwin->summaryview->deleted > 0)
+               state |= M_DELETED_EXISTS;
+
        if (mainwin->summaryview->deleted > 0 ||
            mainwin->summaryview->moved > 0 ||
            mainwin->summaryview->copied > 0)
@@ -3045,15 +3133,11 @@ SensitiveCond main_window_get_current_state(MainWindow *mainwin)
        if (prefs_common.layout_mode != SMALL_LAYOUT || mainwin->in_folder)
                state |= M_IN_MSGLIST;
 
-       if (prefs_common.session_passwords) {
-               GList *list = NULL;
-
-               for (list = account_get_list(); list != NULL; list = list->next) {
-                       PrefsAccount *account = list->data;
-                       if (account->session_passwd || account->session_smtp_passwd) {
-                               state |= M_SESSION_PASSWORDS;
-                               break;
-                       }
+       for (account_list = account_get_list(); account_list != NULL; account_list = account_list->next) {
+               PrefsAccount *account = account_list->data;
+               if (account->session_passwd || account->session_smtp_passwd) {
+                       state |= M_SESSION_PASSWORDS;
+                       break;
                }
        }
 
@@ -3092,6 +3176,7 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
                {"Menu/View/ExpandThreads"        , M_MSG_EXIST|M_SUMMARY_ISLIST},
                {"Menu/View/CollapseThreads"      , M_MSG_EXIST|M_SUMMARY_ISLIST},
                {"Menu/View/HideReadMessages"      , M_HIDE_READ_MSG|M_SUMMARY_ISLIST},
+               {"Menu/View/HideDelMessages"       , M_SUMMARY_ISLIST},
                {"Menu/View/Goto/Prev"        , M_MSG_EXIST},
                {"Menu/View/Goto/Next"        , M_MSG_EXIST},
                {"Menu/View/Goto/PrevUnread" , M_MSG_EXIST},
@@ -3151,6 +3236,7 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
                {"Menu/Tools/ListUrls"                 , M_TARGET_EXIST},
                {"Menu/Tools/Actions"                      , M_TARGET_EXIST|M_ACTIONS_EXIST},
                {"Menu/Tools/Execute"                      , M_DELAY_EXEC},
+               {"Menu/Tools/Expunge"                      , M_DELETED_EXISTS},
                {"Menu/Tools/ForgetSessionPasswords"       , M_SESSION_PASSWORDS},
                {"Menu/Tools/DeleteDuplicates/SelFolder"   , M_MSG_EXIST|M_ALLOW_DELETE},
 
@@ -3435,10 +3521,19 @@ static void get_url_part (const gchar **buffer, gchar *url_decoded, gint maxlen)
 static void mailing_list_compose (GtkWidget *w, gpointer *data)
 {
        const gchar *mailto;
+       PrefsAccount *account = NULL;
+       FolderItem   *folder_item = NULL;
 
        mailto = gtk_label_get_text(GTK_LABEL (gtk_bin_get_child(GTK_BIN((w)))));
+       if (mainwindow_get_mainwindow()) {
+               folder_item = mainwindow_get_mainwindow()->summaryview->folder_item;
+               if (folder_item && folder_item->prefs && folder_item->prefs->enable_default_account)
+                       account = account_find_from_id(folder_item->prefs->default_account);
+               if (folder_item && !account)
+                       account = account_find_from_item(folder_item);
+       }
        if (mailto)
-               compose_new(NULL, mailto+7, NULL);
+               compose_new_with_folderitem(account, folder_item, mailto+7);
 }
  
  static void mailing_list_open_uri (GtkWidget *w, gpointer *data)
@@ -3467,7 +3562,7 @@ void main_window_popup(MainWindow *mainwin)
 {
        static gboolean first_start = TRUE;
 
-       if (!GTK_WIDGET_VISIBLE(GTK_WIDGET(mainwin->window)))
+       if (!gtkut_widget_get_visible(GTK_WIDGET(mainwin->window)))
                main_window_show(mainwin);
 
        if (prefs_common.mainwin_maximised)
@@ -3900,7 +3995,6 @@ static void print_cb(GtkAction *action, gpointer data)
        summary_print(mainwin->summaryview);
 }
 
-#if GTK_CHECK_VERSION(2,10,0) && !defined(USE_GNOMEPRINT)
 static void page_setup_cb(GtkAction *action, gpointer data)
 {
        MainWindow *mainwin = (MainWindow *)data;
@@ -3910,7 +4004,6 @@ static void page_setup_cb(GtkAction *action, gpointer data)
 
        printing_page_setup(win);
 }
-#endif
 
 static void app_exit_cb(GtkAction *action, gpointer data)
 {
@@ -3984,10 +4077,10 @@ static void main_window_reply_cb(GtkAction *gaction, gpointer data)
        DO_ACTION("Message/Redirect", COMPOSE_REDIRECT);
        DO_ACTION("Message/FollowupReply", COMPOSE_FOLLOWUP_AND_REPLY_TO);
 
-       g_return_if_fail(msgview != NULL);
+       cm_return_if_fail(msgview != NULL);
 
        msginfo_list = summary_get_selection(mainwin->summaryview);
-       g_return_if_fail(msginfo_list != NULL);
+       cm_return_if_fail(msginfo_list != NULL);
        compose_reply_from_messageview(msgview, msginfo_list, action);
        g_slist_free(msginfo_list);
 }
@@ -3997,14 +4090,17 @@ static void toggle_col_headers_cb(GtkAction *gaction, gpointer data)
        MainWindow *mainwin = (MainWindow *)data;
        FolderView *folderview = mainwin->folderview;
        SummaryView *summaryview = mainwin->summaryview;
+       MimeView *mimeview = mainwin->messageview->mimeview;
 
        if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (gaction))) {
                gtk_cmclist_column_titles_show(GTK_CMCLIST(folderview->ctree));
                gtk_cmclist_column_titles_show(GTK_CMCLIST(summaryview->ctree));
+               gtk_cmclist_column_titles_show(GTK_CMCLIST(mimeview->ctree));
                prefs_common.show_col_headers = TRUE;
        } else {
                gtk_cmclist_column_titles_hide(GTK_CMCLIST(folderview->ctree));
                gtk_cmclist_column_titles_hide(GTK_CMCLIST(summaryview->ctree));
+               gtk_cmclist_column_titles_hide(GTK_CMCLIST(mimeview->ctree));           
                prefs_common.show_col_headers = FALSE;
        }
 }
@@ -4110,7 +4206,7 @@ static void online_switch_clicked (GtkButton *btn, gpointer data)
        MainWindow *mainwin;
        gboolean have_connectivity;
 
-#ifdef HAVE_NETWORKMANAGER
+#ifdef HAVE_NETWORKMANAGER_SUPPORT
        have_connectivity = networkmanager_is_online(NULL); 
 #else
        have_connectivity = TRUE;
@@ -4118,7 +4214,7 @@ static void online_switch_clicked (GtkButton *btn, gpointer data)
 
        mainwin = (MainWindow *) data;
        
-       g_return_if_fail(mainwin != NULL);
+       cm_return_if_fail(mainwin != NULL);
        
        if (btn == GTK_BUTTON(mainwin->online_switch)) {
 #ifndef GENERIC_UMPC
@@ -4136,7 +4232,7 @@ static void online_switch_clicked (GtkButton *btn, gpointer data)
                if(have_connectivity)
                        mainwindow_check_synchronise(mainwin, TRUE);
                prefs_common.work_offline = TRUE;
-               imap_disconnect_all();
+               imap_disconnect_all(have_connectivity);
                hooks_invoke(OFFLINE_SWITCH_HOOKLIST, NULL);
        } else {
                /*go online */
@@ -4229,6 +4325,20 @@ static void show_all_header_cb(GtkAction *action, gpointer data)
                                     gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
 }
 
+static void toggle_fullscreen_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_window_unfullscreen(GTK_WINDOW(mainwin->window));
+               prefs_common.mainwin_fullscreen = FALSE;
+       }
+       else {
+               prefs_common.mainwin_fullscreen = TRUE;
+               gtk_window_fullscreen(GTK_WINDOW(mainwin->window));
+       }
+}
+
 static void hide_quotes_cb(GtkAction *action, gpointer data)
 {
        MainWindow *mainwin = (MainWindow *)data;
@@ -4395,6 +4505,16 @@ static void hide_read_messages (GtkAction *action, gpointer data)
        summary_toggle_show_read_messages(mainwin->summaryview);
 }
 
+static void hide_del_messages (GtkAction *action, gpointer data)
+{
+       MainWindow *mainwin = (MainWindow *)data;
+       GtkWidget *menuitem = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu/View/HideDelMessages");
+       if (!mainwin->summaryview->folder_item
+           || g_object_get_data(G_OBJECT(menuitem), "dont_toggle"))
+               return;
+       summary_toggle_show_del_messages(mainwin->summaryview);
+}
+
 static void thread_cb(GtkAction *action, gpointer data)
 {
        MainWindow *mainwin = (MainWindow *)data;
@@ -4535,7 +4655,7 @@ static void process_cb(GtkAction *action, gpointer data)
 {
        MainWindow *mainwin = (MainWindow *)data;
        FolderItem *item = mainwin->summaryview->folder_item;   
-       g_return_if_fail(item != NULL);
+       cm_return_if_fail(item != NULL);
 
        item->processing_pending = TRUE;
        folder_item_apply_processing(item);     
@@ -4548,6 +4668,12 @@ static void execute_summary_cb(GtkAction *action, gpointer data)
        summary_execute(mainwin->summaryview);
 }
 
+static void expunge_summary_cb(GtkAction *action, gpointer data)
+{
+       MainWindow *mainwin = (MainWindow *)data;
+       summary_expunge(mainwin->summaryview);
+}
+
 static void update_summary_cb(GtkAction *action, gpointer data)
 {
        MainWindow *mainwin = (MainWindow *)data;
@@ -4668,7 +4794,7 @@ static void allsel_cb(GtkAction *action, gpointer data)
        MessageView *msgview = mainwin->messageview;
 
        if (messageview_is_visible(msgview) &&
-                (GTK_WIDGET_HAS_FOCUS(msgview->mimeview->textview->text)))
+                (gtkut_widget_has_focus(msgview->mimeview->textview->text)))
                messageview_select_all(mainwin->messageview);
        else
                summary_select_all(mainwin->summaryview);
@@ -4753,7 +4879,7 @@ static void prefs_tags_open_cb(GtkAction *action, gpointer data)
        GSList * list = summary_get_selected_msg_list(mainwin->summaryview);
        tag_apply_open(list);
 }
-#if (defined(USE_OPENSSL) || defined (USE_GNUTLS))
+#ifdef USE_GNUTLS
 static void ssl_manager_open_cb(GtkAction *action, gpointer data)
 {
        MainWindow *mainwin = (MainWindow *)data;
@@ -4837,6 +4963,84 @@ static void legend_open_cb(GtkAction *action, gpointer data)
        legend_show();
 }
 
+#ifdef G_OS_WIN32
+static void set_default_client_cb(GtkAction *action, gpointer data)
+{
+       char exename[MAX_PATH];
+       gchar *binary_icon = NULL;
+       gchar *binary_compose = NULL;
+       gchar *binary_run = NULL;
+       int r = 0;
+       if ( !GetModuleFileNameA (0, exename, sizeof (exename)) ) {
+               alertpanel_error(_("Can not register as default client: impossible to get executable path."));
+               return;
+       }
+       binary_icon = g_strconcat(exename, ",0", NULL);
+       binary_compose = g_strconcat(exename, " --compose %1", NULL);
+       binary_run = g_strconcat(exename, NULL);
+
+       /* Try to set the Mail Start menu item to Claws. It may fail if we're not root; we don't care */
+       r = write_w32_registry_string("HKLM", "Software\\Clients\\Mail", 
+                       "", "Claws Mail");
+       
+       r = write_w32_registry_string("HKCU", "Software\\Clients\\Mail\\Claws Mail", 
+                               "", "Claws Mail");
+       if (!r)
+               r = write_w32_registry_string("HKCU", "Software\\Clients\\Mail\\Claws Mail", 
+                               "DLLPath", "");
+       if (!r)
+               r = write_w32_registry_string("HKCU", "Software\\Clients\\Mail\\Claws Mail\\Protocols\\mailto", 
+                               "", "URL:MailTo-Protocol");
+       if (!r)
+               r = write_w32_registry_string("HKCU", "Software\\Clients\\Mail\\Claws Mail\\Protocols\\mailto", 
+                               "URL Protocol", "");
+       if (!r)
+               r = write_w32_registry_dword ("HKCU", "Software\\Clients\\Mail\\Claws Mail\\Protocols\\mailto", 
+                               "EditFlags", 2);
+       if (!r)
+               r = write_w32_registry_string ("HKCU", "Software\\Clients\\Mail\\Claws Mail\\Protocols\\mailto", 
+                               "FriendlyTypeName", "Claws-Mail URL");
+       if (!r)
+               r = write_w32_registry_string("HKCU", "Software\\Clients\\Mail\\Claws Mail\\Protocols\\mailto\\DefaultIcon", 
+                               "", binary_icon);
+       if (!r)
+               r = write_w32_registry_string("HKCU", "Software\\Clients\\Mail\\Claws Mail\\Protocols\\mailto\\shell\\open\\command", 
+                               "", binary_compose);
+       if (!r)
+               r = write_w32_registry_string("HKCU", "Software\\Clients\\Mail\\Claws Mail\\shell\\open\\command", 
+                               "", binary_run);
+       
+       if (!r)
+               r = write_w32_registry_string("HKCU", "Software\\Classes\\mailto", 
+                               "", "URL:MailTo-Protocol");
+       if (!r)
+               r = write_w32_registry_string("HKCU", "Software\\Classes\\mailto", 
+                               "URL Protocol", "");
+       if (!r)
+               r = write_w32_registry_dword ("HKCU", "Software\\Classes\\mailto", 
+                               "EditFlags", 2);
+       if (!r)
+               r = write_w32_registry_string("HKCU", "Software\\Classes\\mailto", 
+                               "FriendlyTypeName", "Claws-Mail URL");
+       if (!r)
+               r = write_w32_registry_string("HKCU", "Software\\Classes\\mailto\\DefaultIcon", 
+                               "", binary_icon);
+       if (!r)
+               r = write_w32_registry_string("HKCU", "Software\\Classes\\mailto\\shell\\open\\command", 
+                               "", binary_compose);
+       
+       if (!r) {
+               SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM)"Software\\Clients\\Mail");
+               alertpanel_notice(_("Claws Mail has been registered as default client."));
+       } else {
+               alertpanel_error(_("Can not register as default client: impossible to write to the registry."));
+       }
+       g_free(binary_icon);
+       g_free(binary_compose);
+       g_free(binary_run);
+}
+#endif
+
 static void scan_tree_func(Folder *folder, FolderItem *item, gpointer data)
 {
        MainWindow *mainwin = (MainWindow *)data;
@@ -4861,11 +5065,11 @@ static gboolean mainwindow_focus_in_event(GtkWidget *widget, GdkEventFocus *focu
 {
        SummaryView *summary;
 
-       g_return_val_if_fail(data, FALSE);
+       cm_return_val_if_fail(data, FALSE);
        if (!g_list_find(mainwin_list, data))
                return TRUE;
        summary = ((MainWindow *)data)->summaryview;
-       g_return_val_if_fail(summary, FALSE);
+       cm_return_val_if_fail(summary, FALSE);
 
        if (GTK_CMCLIST(summary->ctree)->selection && 
            g_list_length(GTK_CMCLIST(summary->ctree)->selection) > 1)