2011-01-06 [pawel] 3.7.8cvs33
[claws.git] / src / prefs_folder_item.c
index 5d66a893548fc80ccc72b721d04de666caac4e5f..092e3c445fe45fd08d6154f29b10e406df9bcbb5 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2007 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
@@ -61,7 +61,6 @@
        }
 
 static void prefs_folder_item_register_page    (PrefsPage      *page);
-static void prefs_folder_item_unregister_page  (PrefsPage      *page);
 
 typedef struct _FolderItemGeneralPage FolderItemGeneralPage;
 typedef struct _FolderItemComposePage FolderItemComposePage;
@@ -77,10 +76,12 @@ struct _FolderItemGeneralPage
        GtkWidget *table;
        GtkWidget *no_save_warning;
        GtkWidget *folder_type;
+#ifndef G_OS_WIN32
        GtkWidget *checkbtn_simplify_subject;
        GtkWidget *entry_simplify_subject;
        GtkWidget *entry_regexp_test_string;
        GtkWidget *entry_regexp_test_result;
+#endif
        GtkWidget *checkbtn_folder_chmod;
        GtkWidget *entry_folder_chmod;
        GtkWidget *folder_color_btn;
@@ -94,7 +95,9 @@ struct _FolderItemGeneralPage
        GtkWidget *checkbtn_remove_old_offlinesync;
        
        /* apply to sub folders */
+#ifndef G_OS_WIN32
        GtkWidget *simplify_subject_rec_checkbtn;
+#endif
        GtkWidget *folder_chmod_rec_checkbtn;
        GtkWidget *folder_color_rec_checkbtn;
        GtkWidget *enable_processing_rec_checkbtn;
@@ -120,6 +123,12 @@ struct _FolderItemComposePage
        GtkWidget *entry_default_to;
        GtkWidget *checkbtn_default_reply_to;
        GtkWidget *entry_default_reply_to;
+       GtkWidget *checkbtn_default_cc;
+       GtkWidget *entry_default_cc;
+       GtkWidget *checkbtn_default_bcc;
+       GtkWidget *entry_default_bcc;
+       GtkWidget *checkbtn_default_replyto;
+       GtkWidget *entry_default_replyto;
        GtkWidget *checkbtn_enable_default_account;
        GtkWidget *optmenu_default_account;
 #if USE_ENCHANT
@@ -134,6 +143,9 @@ struct _FolderItemComposePage
        GtkWidget *save_copy_to_folder_rec_checkbtn;
        GtkWidget *default_to_rec_checkbtn;
        GtkWidget *default_reply_to_rec_checkbtn;
+       GtkWidget *default_cc_rec_checkbtn;
+       GtkWidget *default_bcc_rec_checkbtn;
+       GtkWidget *default_replyto_rec_checkbtn;
        GtkWidget *default_account_rec_checkbtn;
 #if USE_ENCHANT
        GtkWidget *default_dictionary_rec_checkbtn;
@@ -181,9 +193,10 @@ static gint prefs_folder_item_chmod_mode           (gchar *folder_chmod);
 
 static void folder_color_set_dialog(GtkWidget *widget, gpointer data);
 static void clean_cache_cb(GtkWidget *widget, gpointer data);
+#ifndef G_OS_WIN32
 static void folder_regexp_test_cb(GtkWidget *widget, gpointer data);
 static void folder_regexp_set_subject_example_cb(GtkWidget *widget, gpointer data);
-
+#endif
 #define SAFE_STRING(str) \
        (str) ? (str) : ""
 
@@ -206,6 +219,7 @@ static void prefs_folder_item_general_create_widget_func(PrefsPage * page_,
        SpecialFolderItemType type;
        
        GtkWidget *no_save_warning = NULL;
+#ifndef G_OS_WIN32
        GtkWidget *checkbtn_simplify_subject;
        GtkWidget *entry_simplify_subject;
        GtkWidget *hbox_regexp;
@@ -213,7 +227,7 @@ static void prefs_folder_item_general_create_widget_func(PrefsPage * page_,
        GtkWidget *entry_regexp_test_string;
        GtkWidget *left_arrow;
        GtkWidget *entry_regexp_test_result;
-
+#endif
        GtkWidget *checkbtn_folder_chmod;
        GtkWidget *entry_folder_chmod;
        GtkWidget *folder_color;
@@ -227,7 +241,9 @@ static void prefs_folder_item_general_create_widget_func(PrefsPage * page_,
        GtkWidget *label_end_offlinesync;
        GtkWidget *checkbtn_remove_old_offlinesync;
 
+#ifndef G_OS_WIN32
        GtkWidget *simplify_subject_rec_checkbtn;
+#endif
        GtkWidget *folder_chmod_rec_checkbtn;
        GtkWidget *folder_color_rec_checkbtn;
        GtkWidget *enable_processing_rec_checkbtn;
@@ -248,8 +264,8 @@ static void prefs_folder_item_general_create_widget_func(PrefsPage * page_,
        if (!can_save) {
                no_save_warning = gtk_label_new(
                        _("<i>These preferences will not be saved as this folder "
-                       "is a top-level one. However you can use them to set them "
-                       "to the whole mailbox tree using \"Apply to subfolders\".</i>"));
+                       "is a top-level folder. However, you can set them for the "
+                       "whole mailbox tree by using \"Apply to subfolders\".</i>"));
                gtk_label_set_use_markup(GTK_LABEL(no_save_warning), TRUE);
                gtk_label_set_line_wrap(GTK_LABEL(no_save_warning), TRUE);
                gtk_misc_set_alignment(GTK_MISC(no_save_warning), 0.0, 0.5);
@@ -313,6 +329,7 @@ static void prefs_folder_item_general_create_widget_func(PrefsPage * page_,
 
        rowcount++;
 
+#ifndef G_OS_WIN32
        /* Simplify Subject */
        checkbtn_simplify_subject = gtk_check_button_new_with_label(_("Simplify Subject RegExp"));
        gtk_table_attach(GTK_TABLE(table), checkbtn_simplify_subject, 0, 1, 
@@ -370,7 +387,7 @@ static void prefs_folder_item_general_create_widget_func(PrefsPage * page_,
        gtk_editable_set_editable(GTK_EDITABLE(entry_regexp_test_result), FALSE);
 
        rowcount++;
-
+#endif
        /* Folder chmod */
        checkbtn_folder_chmod = gtk_check_button_new_with_label(_("Folder chmod"));
        gtk_table_attach(GTK_TABLE(table), checkbtn_folder_chmod, 0, 1, 
@@ -564,10 +581,12 @@ static void prefs_folder_item_general_create_widget_func(PrefsPage * page_,
        page->table = table;
        page->folder_type = folder_type;
        page->no_save_warning = no_save_warning;
+#ifndef G_OS_WIN32
        page->checkbtn_simplify_subject = checkbtn_simplify_subject;
        page->entry_simplify_subject = entry_simplify_subject;
        page->entry_regexp_test_string = entry_regexp_test_string;
        page->entry_regexp_test_result = entry_regexp_test_result;
+#endif
        page->checkbtn_folder_chmod = checkbtn_folder_chmod;
        page->entry_folder_chmod = entry_folder_chmod;
        page->folder_color_btn = folder_color_btn;
@@ -580,7 +599,9 @@ static void prefs_folder_item_general_create_widget_func(PrefsPage * page_,
        page->label_end_offlinesync = label_end_offlinesync;
        page->checkbtn_remove_old_offlinesync = checkbtn_remove_old_offlinesync;
 
+#ifndef G_OS_WIN32
        page->simplify_subject_rec_checkbtn  = simplify_subject_rec_checkbtn;
+#endif
        page->folder_chmod_rec_checkbtn      = folder_chmod_rec_checkbtn;
        page->folder_color_rec_checkbtn      = folder_color_rec_checkbtn;
        page->enable_processing_rec_checkbtn = enable_processing_rec_checkbtn;
@@ -590,7 +611,9 @@ static void prefs_folder_item_general_create_widget_func(PrefsPage * page_,
 
        page->page.widget = table;
 
+#ifndef G_OS_WIN32
        folder_regexp_set_subject_example_cb(NULL, page);
+#endif
 }
 
 static void prefs_folder_item_general_destroy_widget_func(PrefsPage *page_) 
@@ -613,23 +636,24 @@ static void general_save_folder_prefs(FolderItem *folder, FolderItemGeneralPage
        if (folder->path == NULL)
                return;
 
-       g_return_if_fail(prefs != NULL);
+       cm_return_if_fail(prefs != NULL);
 
        if (page->item == folder) 
                all = TRUE;
 
        type = combobox_get_active_data(GTK_COMBO_BOX(page->folder_type));
-       if (all && folder->stype != type) {
+       if (all && folder->stype != type && page->item->parent_stype == F_NORMAL) {
                folder_item_change_type(folder, type);
        }
 
+#ifndef G_OS_WIN32
        if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->simplify_subject_rec_checkbtn))) {
                prefs->enable_simplify_subject =
                        gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_simplify_subject));
                ASSIGN_STRING(prefs->simplify_subject_regexp,
                              gtk_editable_get_chars(GTK_EDITABLE(page->entry_simplify_subject), 0, -1));
        }
-       
+#endif 
        if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->folder_chmod_rec_checkbtn))) {
                prefs->enable_folder_chmod = 
                        gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_folder_chmod));
@@ -679,8 +703,8 @@ static gboolean general_save_recurse_func(GNode *node, gpointer data)
        FolderItem *item = (FolderItem *) node->data;
        FolderItemGeneralPage *page = (FolderItemGeneralPage *) data;
 
-       g_return_val_if_fail(item != NULL, TRUE);
-       g_return_val_if_fail(page != NULL, TRUE);
+       cm_return_val_if_fail(item != NULL, TRUE);
+       cm_return_val_if_fail(page != NULL, TRUE);
 
        general_save_folder_prefs(item, page);
 
@@ -688,7 +712,10 @@ static gboolean general_save_recurse_func(GNode *node, gpointer data)
           check boxes are selected - and optimise the checking by only doing
           it once */
        if ((node == page->item->node) &&
-           !(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->simplify_subject_rec_checkbtn)) ||
+           !(
+#ifndef G_OS_WIN32
+             gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->simplify_subject_rec_checkbtn)) ||
+#endif
              gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->folder_chmod_rec_checkbtn)) ||
              gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->folder_color_rec_checkbtn)) ||
              gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->enable_processing_rec_checkbtn)) ||
@@ -729,6 +756,7 @@ static void prefs_folder_item_compose_create_widget_func(PrefsPage * page_,
        FolderItemComposePage *page = (FolderItemComposePage *) page_;
        FolderItem *item = (FolderItem *) data;
        guint rowcount;
+       gchar *text = NULL;
 
        GtkWidget *table;
        GtkWidget *label;
@@ -740,6 +768,12 @@ static void prefs_folder_item_compose_create_widget_func(PrefsPage * page_,
        GtkWidget *entry_default_to = NULL;
        GtkWidget *checkbtn_default_reply_to = NULL;
        GtkWidget *entry_default_reply_to = NULL;
+       GtkWidget *checkbtn_default_cc = NULL;
+       GtkWidget *entry_default_cc = NULL;
+       GtkWidget *checkbtn_default_bcc = NULL;
+       GtkWidget *entry_default_bcc = NULL;
+       GtkWidget *checkbtn_default_replyto = NULL;
+       GtkWidget *entry_default_replyto = NULL;
        GtkWidget *checkbtn_enable_default_account = NULL;
        GtkWidget *optmenu_default_account = NULL;
        GtkListStore *optmenu_default_account_menu = NULL;
@@ -757,6 +791,9 @@ static void prefs_folder_item_compose_create_widget_func(PrefsPage * page_,
        GtkWidget *save_copy_to_folder_rec_checkbtn = NULL;
        GtkWidget *default_to_rec_checkbtn = NULL;
        GtkWidget *default_reply_to_rec_checkbtn = NULL;
+       GtkWidget *default_cc_rec_checkbtn = NULL;
+       GtkWidget *default_bcc_rec_checkbtn = NULL;
+       GtkWidget *default_replyto_rec_checkbtn = NULL;
        GtkWidget *default_account_rec_checkbtn = NULL;
 
        GList *cur_ac;
@@ -781,8 +818,8 @@ static void prefs_folder_item_compose_create_widget_func(PrefsPage * page_,
        if (!can_save) {
                no_save_warning = gtk_label_new(
                        _("<i>These preferences will not be saved as this folder "
-                       "is a top-level one. However you can use them to set them "
-                       "to the whole mailbox tree using \"Apply to subfolders\".</i>"));
+                       "is a top-level folder. However, you can set them for the "
+                       "whole mailbox tree by using \"Apply to subfolders\".</i>"));
                gtk_label_set_use_markup(GTK_LABEL(no_save_warning), TRUE);
                gtk_label_set_line_wrap(GTK_LABEL(no_save_warning), TRUE);
                gtk_misc_set_alignment(GTK_MISC(no_save_warning), 0.0, 0.5);
@@ -829,11 +866,13 @@ static void prefs_folder_item_compose_create_widget_func(PrefsPage * page_,
                rowcount++;
 
                /* Default To */
-               checkbtn_default_to = gtk_check_button_new_with_label(_("Default To:"));
+               text = g_strconcat(_("Default "), prefs_common_translated_header_name("To:"), NULL);
+               checkbtn_default_to = gtk_check_button_new_with_label(text);
                gtk_table_attach(GTK_TABLE(table), checkbtn_default_to, 0, 1, 
                                 rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
                gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_default_to), 
                                             item->prefs->enable_default_to);
+               g_free(text);
 
                entry_default_to = gtk_entry_new();
                gtk_table_attach(GTK_TABLE(table), entry_default_to, 1, 2,
@@ -850,11 +889,14 @@ static void prefs_folder_item_compose_create_widget_func(PrefsPage * page_,
                rowcount++;
 
                /* Default address to reply to */
-               checkbtn_default_reply_to = gtk_check_button_new_with_label(_("Default To: for replies"));
+               text = g_strconcat(_("Default "), prefs_common_translated_header_name("To:"),
+                                _(" for replies"), NULL);
+               checkbtn_default_reply_to = gtk_check_button_new_with_label(text);
                gtk_table_attach(GTK_TABLE(table), checkbtn_default_reply_to, 0, 1, 
                                 rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
                gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_default_reply_to), 
                                             item->prefs->enable_default_reply_to);
+               g_free(text);
 
                entry_default_reply_to = gtk_entry_new();
                gtk_table_attach(GTK_TABLE(table), entry_default_reply_to, 1, 2,
@@ -869,6 +911,75 @@ static void prefs_folder_item_compose_create_widget_func(PrefsPage * page_,
                                 rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
 
                rowcount++;
+
+               /* Default Cc */
+               text = g_strconcat(_("Default "), prefs_common_translated_header_name("Cc:"), NULL);
+               checkbtn_default_cc = gtk_check_button_new_with_label(text);
+               gtk_table_attach(GTK_TABLE(table), checkbtn_default_cc, 0, 1, 
+                                rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
+               gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_default_cc), 
+                                            item->prefs->enable_default_cc);
+               g_free(text);
+
+               entry_default_cc = gtk_entry_new();
+               gtk_table_attach(GTK_TABLE(table), entry_default_cc, 1, 2,
+                                rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
+               SET_TOGGLE_SENSITIVITY(checkbtn_default_cc, entry_default_cc);
+               gtk_entry_set_text(GTK_ENTRY(entry_default_cc), SAFE_STRING(item->prefs->default_cc));
+               address_completion_register_entry(GTK_ENTRY(entry_default_cc),
+                               TRUE);
+
+               default_cc_rec_checkbtn = gtk_check_button_new();
+               gtk_table_attach(GTK_TABLE(table), default_cc_rec_checkbtn, 2, 3, 
+                                rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
+
+               rowcount++;
+
+               /* Default Bcc */
+               text = g_strconcat(_("Default "), prefs_common_translated_header_name("Bcc:"), NULL);
+               checkbtn_default_bcc = gtk_check_button_new_with_label(text);
+               gtk_table_attach(GTK_TABLE(table), checkbtn_default_bcc, 0, 1, 
+                                rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
+               gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_default_bcc), 
+                                            item->prefs->enable_default_bcc);
+               g_free(text);
+
+               entry_default_bcc = gtk_entry_new();
+               gtk_table_attach(GTK_TABLE(table), entry_default_bcc, 1, 2,
+                                rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
+               SET_TOGGLE_SENSITIVITY(checkbtn_default_bcc, entry_default_bcc);
+               gtk_entry_set_text(GTK_ENTRY(entry_default_bcc), SAFE_STRING(item->prefs->default_bcc));
+               address_completion_register_entry(GTK_ENTRY(entry_default_bcc),
+                               TRUE);
+
+               default_bcc_rec_checkbtn = gtk_check_button_new();
+               gtk_table_attach(GTK_TABLE(table), default_bcc_rec_checkbtn, 2, 3, 
+                                rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
+
+               rowcount++;
+
+               /* Default Reply-to */
+               text = g_strconcat(_("Default "), prefs_common_translated_header_name("Reply-To:"), NULL);
+               checkbtn_default_replyto = gtk_check_button_new_with_label(text);
+               gtk_table_attach(GTK_TABLE(table), checkbtn_default_replyto, 0, 1, 
+                                rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
+               gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_default_replyto), 
+                                            item->prefs->enable_default_replyto);
+               g_free(text);
+
+               entry_default_replyto = gtk_entry_new();
+               gtk_table_attach(GTK_TABLE(table), entry_default_replyto, 1, 2,
+                                rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
+               SET_TOGGLE_SENSITIVITY(checkbtn_default_replyto, entry_default_replyto);
+               gtk_entry_set_text(GTK_ENTRY(entry_default_replyto), SAFE_STRING(item->prefs->default_replyto));
+               address_completion_register_entry(GTK_ENTRY(entry_default_replyto),
+                               TRUE);
+
+               default_replyto_rec_checkbtn = gtk_check_button_new();
+               gtk_table_attach(GTK_TABLE(table), default_replyto_rec_checkbtn, 2, 3, 
+                                rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
+
+               rowcount++;
        }
        /* Default account */
        checkbtn_enable_default_account = gtk_check_button_new_with_label(_("Default account"));
@@ -939,6 +1050,10 @@ static void prefs_folder_item_compose_create_widget_func(PrefsPage * page_,
                item->prefs->default_dictionary = tmp;
                dictionary = item->prefs->default_dictionary;
        }
+       if (item->prefs->default_dictionary &&
+           strchr(item->prefs->default_dictionary, '-')) {
+               *(strchr(item->prefs->default_dictionary, '-')) = '\0';
+       }
        if (dictionary)
                gtkaspell_set_dictionary_menu_active_item(
                        GTK_COMBO_BOX(combo_default_dictionary), dictionary);
@@ -969,6 +1084,10 @@ static void prefs_folder_item_compose_create_widget_func(PrefsPage * page_,
                item->prefs->default_alt_dictionary = tmp;
                dictionary = item->prefs->default_alt_dictionary;
        }
+       if (item->prefs->default_alt_dictionary &&
+           strchr(item->prefs->default_alt_dictionary, '-')) {
+               *(strchr(item->prefs->default_alt_dictionary, '-')) = '\0';
+       }
        if (dictionary)
                gtkaspell_set_dictionary_menu_active_item(
                        GTK_COMBO_BOX(combo_default_alt_dictionary), dictionary);
@@ -993,6 +1112,12 @@ static void prefs_folder_item_compose_create_widget_func(PrefsPage * page_,
        page->entry_default_to = entry_default_to;
        page->checkbtn_default_reply_to = checkbtn_default_reply_to;
        page->entry_default_reply_to = entry_default_reply_to;
+       page->checkbtn_default_cc = checkbtn_default_cc;
+       page->entry_default_cc = entry_default_cc;
+       page->checkbtn_default_bcc = checkbtn_default_bcc;
+       page->entry_default_bcc = entry_default_bcc;
+       page->checkbtn_default_replyto = checkbtn_default_replyto;
+       page->entry_default_replyto = entry_default_replyto;
        page->checkbtn_enable_default_account = checkbtn_enable_default_account;
        page->optmenu_default_account = optmenu_default_account;
 #ifdef USE_ENCHANT
@@ -1006,6 +1131,9 @@ static void prefs_folder_item_compose_create_widget_func(PrefsPage * page_,
        page->save_copy_to_folder_rec_checkbtn    = save_copy_to_folder_rec_checkbtn;
        page->default_to_rec_checkbtn             = default_to_rec_checkbtn;
        page->default_reply_to_rec_checkbtn       = default_reply_to_rec_checkbtn;
+       page->default_cc_rec_checkbtn             = default_cc_rec_checkbtn;
+       page->default_bcc_rec_checkbtn            = default_bcc_rec_checkbtn;
+       page->default_replyto_rec_checkbtn                = default_replyto_rec_checkbtn;
        page->default_account_rec_checkbtn        = default_account_rec_checkbtn;
 #if USE_ENCHANT
        page->default_dictionary_rec_checkbtn = default_dictionary_rec_checkbtn;
@@ -1023,6 +1151,12 @@ static void prefs_folder_item_compose_destroy_widget_func(PrefsPage *page_)
                address_completion_unregister_entry(GTK_ENTRY(page->entry_default_to));
        if (page->entry_default_reply_to)
                address_completion_unregister_entry(GTK_ENTRY(page->entry_default_reply_to));
+       if (page->entry_default_cc)
+               address_completion_unregister_entry(GTK_ENTRY(page->entry_default_cc));
+       if (page->entry_default_bcc)
+               address_completion_unregister_entry(GTK_ENTRY(page->entry_default_bcc));
+       if (page->entry_default_replyto)
+               address_completion_unregister_entry(GTK_ENTRY(page->entry_default_replyto));
 }
 
 /** \brief  Save the prefs in page to folder.
@@ -1042,7 +1176,7 @@ static void compose_save_folder_prefs(FolderItem *folder, FolderItemComposePage
        if (page->item == folder) 
                all = TRUE;
 
-       g_return_if_fail(prefs != NULL);
+       cm_return_if_fail(prefs != NULL);
 
        if (item_protocol(folder) != A_NNTP) {
                if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->request_return_receipt_rec_checkbtn))) {
@@ -1071,11 +1205,39 @@ static void compose_save_folder_prefs(FolderItem *folder, FolderItemComposePage
                        ASSIGN_STRING(prefs->default_reply_to,
                                      gtk_editable_get_chars(GTK_EDITABLE(page->entry_default_reply_to), 0, -1));
                }
+
+               if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_cc_rec_checkbtn))) {
+
+                       prefs->enable_default_cc = 
+                               gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_default_cc));
+                       ASSIGN_STRING(prefs->default_cc,
+                                     gtk_editable_get_chars(GTK_EDITABLE(page->entry_default_cc), 0, -1));
+               }
+
+               if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_bcc_rec_checkbtn))) {
+
+                       prefs->enable_default_bcc = 
+                               gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_default_bcc));
+                       ASSIGN_STRING(prefs->default_bcc,
+                                     gtk_editable_get_chars(GTK_EDITABLE(page->entry_default_bcc), 0, -1));
+               }
+
+               if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_replyto_rec_checkbtn))) {
+
+                       prefs->enable_default_replyto = 
+                               gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_default_replyto));
+                       ASSIGN_STRING(prefs->default_replyto,
+                                     gtk_editable_get_chars(GTK_EDITABLE(page->entry_default_replyto), 0, -1));
+               }
+
        } else {
                prefs->request_return_receipt = FALSE;
                prefs->save_copy_to_folder = FALSE;
                prefs->enable_default_to = FALSE;
                prefs->enable_default_reply_to = FALSE;
+               prefs->enable_default_cc = FALSE;
+               prefs->enable_default_bcc = FALSE;
+               prefs->enable_default_replyto = FALSE;
        }
 
        if (all || gtk_toggle_button_get_active(
@@ -1112,8 +1274,8 @@ static gboolean compose_save_recurse_func(GNode *node, gpointer data)
        FolderItem *item = (FolderItem *) node->data;
        FolderItemComposePage *page = (FolderItemComposePage *) data;
 
-       g_return_val_if_fail(item != NULL, TRUE);
-       g_return_val_if_fail(page != NULL, TRUE);
+       cm_return_val_if_fail(item != NULL, TRUE);
+       cm_return_val_if_fail(page != NULL, TRUE);
 
        compose_save_folder_prefs(item, page);
 
@@ -1125,11 +1287,15 @@ static gboolean compose_save_recurse_func(GNode *node, gpointer data)
              gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->save_copy_to_folder_rec_checkbtn)) ||
              gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_to_rec_checkbtn)) ||
              gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_account_rec_checkbtn)) ||
+             gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_cc_rec_checkbtn)) ||
+             gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_bcc_rec_checkbtn)) ||
+             gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_replyto_rec_checkbtn)) ||
 #if USE_ENCHANT
              gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_dictionary_rec_checkbtn)) ||
              gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_alt_dictionary_rec_checkbtn)) ||
 #endif
-             gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_reply_to_rec_checkbtn))))
+             gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_reply_to_rec_checkbtn))
+                       ))
                return TRUE;
        else if ((node == page->item->node) && item_protocol(item) == A_NNTP &&
            !(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_account_rec_checkbtn)) 
@@ -1166,6 +1332,7 @@ static void prefs_folder_item_templates_create_widget_func(PrefsPage * page_,
        GtkWidget *new_msg_format_rec_checkbtn;
        GtkWidget *reply_format_rec_checkbtn;
        GtkWidget *forward_format_rec_checkbtn;
+       GtkWidget *hbox;
 
        page->item = item;
 
@@ -1175,8 +1342,8 @@ static void prefs_folder_item_templates_create_widget_func(PrefsPage * page_,
        if (!can_save) {
                no_save_warning = gtk_label_new(
                        _("<i>These preferences will not be saved as this folder "
-                       "is a top-level one. However you can use them to set them "
-                       "to the whole mailbox tree using \"Apply to subfolders\".</i>"));
+                       "is a top-level folder. However, you can set them for the "
+                       "whole mailbox tree by using \"Apply to subfolders\".</i>"));
                gtk_label_set_use_markup(GTK_LABEL(no_save_warning), TRUE);
                gtk_label_set_line_wrap(GTK_LABEL(no_save_warning), TRUE);
                gtk_misc_set_alignment(GTK_MISC(no_save_warning), 0.0, 0.5);
@@ -1204,9 +1371,13 @@ static void prefs_folder_item_templates_create_widget_func(PrefsPage * page_,
        address_completion_register_entry(GTK_ENTRY(page->compose_override_from_format),
                        TRUE);
 
+       hbox = gtk_hbox_new (FALSE, 0);
+       gtk_box_pack_end (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
+       quotefmt_add_info_button(window, hbox);
+       
        new_msg_format_rec_checkbtn = gtk_check_button_new_with_label(
                        _("Apply to subfolders"));
-       gtk_box_pack_end (GTK_BOX(vbox), new_msg_format_rec_checkbtn, FALSE, FALSE, 0);
+       gtk_box_pack_end (GTK_BOX(hbox), new_msg_format_rec_checkbtn, FALSE, FALSE, 0);
        gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox, gtk_label_new(_("Compose")));
 
        /* reply format */
@@ -1225,9 +1396,13 @@ static void prefs_folder_item_templates_create_widget_func(PrefsPage * page_,
        address_completion_register_entry(GTK_ENTRY(page->reply_override_from_format),
                        TRUE);
 
+       hbox = gtk_hbox_new (FALSE, 0);
+       gtk_box_pack_end (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
+       quotefmt_add_info_button(window, hbox);
+
        reply_format_rec_checkbtn = gtk_check_button_new_with_label(
                        _("Apply to subfolders"));
-       gtk_box_pack_end (GTK_BOX(vbox), reply_format_rec_checkbtn, FALSE, FALSE, 0);
+       gtk_box_pack_end (GTK_BOX(hbox), reply_format_rec_checkbtn, FALSE, FALSE, 0);
        gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox, gtk_label_new(_("Reply")));
 
        /* forward format */
@@ -1246,14 +1421,15 @@ static void prefs_folder_item_templates_create_widget_func(PrefsPage * page_,
        address_completion_register_entry(GTK_ENTRY(page->forward_override_from_format),
                        TRUE);
 
+       hbox = gtk_hbox_new (FALSE, 0);
+       gtk_box_pack_end (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
+       quotefmt_add_info_button(window, hbox);
+
        forward_format_rec_checkbtn = gtk_check_button_new_with_label(
                        _("Apply to subfolders"));
-       gtk_box_pack_end (GTK_BOX(vbox), forward_format_rec_checkbtn, FALSE, FALSE, 0);
+       gtk_box_pack_end (GTK_BOX(hbox), forward_format_rec_checkbtn, FALSE, FALSE, 0);
        gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox, gtk_label_new(_("Forward")));
 
-       /* information button */
-       quotefmt_add_info_button(window, page_vbox);
-
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(page->checkbtn_compose_with_format),
                        item->prefs->compose_with_format);
        pref_set_entry_from_pref(GTK_ENTRY(page->compose_override_from_format),
@@ -1320,7 +1496,7 @@ static void templates_save_folder_prefs(FolderItem *folder, FolderItemTemplatesP
        if (page->item == folder) 
                all = TRUE;
 
-       g_return_if_fail(prefs != NULL);
+       cm_return_if_fail(prefs != NULL);
 
        /* save and check formats */
 
@@ -1378,8 +1554,8 @@ static gboolean templates_save_recurse_func(GNode *node, gpointer data)
        FolderItem *item = (FolderItem *) node->data;
        FolderItemTemplatesPage *page = (FolderItemTemplatesPage *) data;
 
-       g_return_val_if_fail(item != NULL, TRUE);
-       g_return_val_if_fail(page != NULL, TRUE);
+       cm_return_val_if_fail(item != NULL, TRUE);
+       cm_return_val_if_fail(page != NULL, TRUE);
 
        templates_save_folder_prefs(item, page);
 
@@ -1458,6 +1634,7 @@ static void clean_cache_cb(GtkWidget *widget, gpointer data)
                folderview_select(folderview,item);
 }
 
+#ifndef G_OS_WIN32
 static regex_t *summary_compile_simplify_regexp(gchar *simplify_subject_regexp)
 {
        int err;
@@ -1492,14 +1669,16 @@ static void folder_regexp_test_cb(GtkWidget *widget, gpointer data)
        if (!regexp || !regexp[0]) {
                gtk_widget_modify_base(page->entry_simplify_subject,
                                GTK_STATE_NORMAL, NULL);
-               if (test_string) {
+               if (test_string)
                        gtk_entry_set_text(GTK_ENTRY(page->entry_regexp_test_result), test_string);
-                       g_free(test_string);
-               }
+                       
+               g_free(test_string);
+               g_free(regexp);
                return;
        }
 
        if (!test_string || !test_string[0]) {
+               g_free(test_string);
                g_free(regexp);
                return;
        }
@@ -1554,7 +1733,7 @@ static void folder_regexp_set_subject_example_cb(GtkWidget *widget, gpointer dat
                }
        }
 }
-
+#endif
 static void register_general_page()
 {
        static gchar *pfi_general_path[3];
@@ -1649,8 +1828,3 @@ static void prefs_folder_item_register_page(PrefsPage *page)
 {
        prefs_pages = g_slist_append(prefs_pages, page);
 }
-
-static void prefs_folder_item_unregister_page(PrefsPage *page)
-{
-       prefs_pages = g_slist_remove(prefs_pages, page);
-}