2004-10-21 [paul] 0.9.12cvs130.2
authorPaul Mangan <paul@claws-mail.org>
Thu, 21 Oct 2004 07:30:24 +0000 (07:30 +0000)
committerPaul Mangan <paul@claws-mail.org>
Thu, 21 Oct 2004 07:30:24 +0000 (07:30 +0000)
* src/prefs_folder_item.c
sync with HEAD (Apply to subfolders)

ChangeLog-gtk2.claws
PATCHSETS
configure.ac
src/prefs_folder_item.c

index a29e23f..cb5299c 100644 (file)
@@ -1,3 +1,8 @@
+2004-10-21 [paul]      0.9.12cvs130.2
+
+       * src/prefs_folder_item.c
+               sync with HEAD (Apply to subfolders)
+
 2004-10-19 [colin]     0.9.12cvs130.1
 
        * ChangeLog.claws
index afd5c40..46bc9c7 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.65.2.13 -r 1.65.2.15 src/codeconv.c; cvs diff -u -r 1.96.2.21 -r 1.96.2.22 src/textview.c; ) > 0.9.12cvs126.2.patchset
 ( cvs diff -u -r 1.22.2.1 -r 1.22.2.2 src/addrbook.c; cvs diff -u -r 1.15.2.1 -r 1.15.2.2 src/addrcache.c; cvs diff -u -r 1.60.2.11 -r 1.60.2.12 src/addressbook.c; cvs diff -u -r 1.65.2.15 -r 1.65.2.16 src/codeconv.c; cvs diff -u -r 1.382.2.51 -r 1.382.2.52 src/compose.c; cvs diff -u -r 1.5.2.2 -r 1.5.2.3 src/customheader.c; cvs diff -u -r 1.14.2.2 -r 1.14.2.3 src/editaddress.c; cvs diff -u -r 1.11.2.2 -r 1.11.2.3 src/editgroup.c; cvs diff -u -r 1.5 -r 1.6 src/exporthtml.c; cvs diff -u -r 1.213.2.17 -r 1.213.2.18 src/folder.c; cvs diff -u -r 1.207.2.18 -r 1.207.2.19 src/folderview.c; cvs diff -u -r 1.179.2.8 -r 1.179.2.9 src/imap.c; cvs diff -u -r 1.18.2.2 -r 1.18.2.3 src/jpilot.c; cvs diff -u -r 1.115.2.20 -r 1.115.2.21 src/main.c; cvs diff -u -r 1.25.2.4 -r 1.25.2.5 src/matcher_parser_parse.y; cvs diff -u -r 1.28.2.1 -r 1.28.2.2 src/mbox.c; cvs diff -u -r 1.56.2.25 -r 1.56.2.26 src/pop.c; cvs diff -u -r 1.105.2.9 -r 1.105.2.10 src/prefs_account.c; cvs diff -u -r 1.10.2.6 -r 1.10.2.7 src/prefs_gtk.c; cvs diff -u -r 1.1.2.4 -r 1.1.2.5 src/prefs_msg_colors.c; cvs diff -u -r 1.47.2.9 -r 1.47.2.10 src/procheader.c; cvs diff -u -r 1.49.2.10 -r 1.49.2.11 src/procmime.c; cvs diff -u -r 1.17.2.5 -r 1.17.2.6 src/procmime.h; cvs diff -u -r 1.150.2.10 -r 1.150.2.11 src/procmsg.c; cvs diff -u -r 1.395.2.35 -r 1.395.2.36 src/summaryview.c; cvs diff -u -r 1.96.2.22 -r 1.96.2.23 src/textview.c; cvs diff -u -r 1.1.4.1 -r 1.1.4.2 src/common/base64.c; cvs diff -u -r 1.1.2.4 -r 1.1.2.5 src/common/partial_download.c; cvs diff -u -r 1.13.2.9 -r 1.13.2.10 src/common/socket.c; cvs diff -u -r 1.7.2.2 -r 1.7.2.3 src/common/sylpheed.c; cvs diff -u -r 1.36.2.8 -r 1.36.2.9 src/common/utils.c; cvs diff -u -r 1.20.2.7 -r 1.20.2.8 src/common/utils.h; cvs diff -u -r 1.5.2.5 -r 1.5.2.6 src/gtk/pluginwindow.c; cvs diff -u -r 1.1.2.11 -r 1.1.2.12 src/gtk/quicksearch.c; cvs diff -u -r 1.13.2.3 -r 1.13.2.4 src/plugins/clamav/clamav_plugin.c; cvs diff -u -r 1.3 -r 1.4 src/plugins/clamav/clamav_plugin.h; cvs diff -u -r 1.9.2.4 -r 1.9.2.5 src/plugins/clamav/clamav_plugin_gtk.c; cvs diff -u -r 1.1.2.1 -r 1.1.2.2 src/plugins/pgpmime/passphrase.c; cvs diff -u -r 1.1.2.5 -r 1.1.2.6 src/plugins/pgpmime/pgpmime.c; cvs diff -u -r 1.1.2.4 -r 1.1.2.5 src/plugins/pgpmime/plugin.c; cvs diff -u -r 1.1.2.1 -r 1.1.2.2 src/plugins/pgpmime/prefs_gpg.c; cvs diff -u -r 1.1.2.1 -r 1.1.2.2 src/plugins/pgpmime/prefs_gpg.h; cvs diff -u -r 1.1.2.1 -r 1.1.2.2 src/plugins/pgpmime/select-keys.c; cvs diff -u -r 1.1.2.3 -r 1.1.2.4 src/plugins/pgpmime/sgpgme.c; cvs diff -u -r 1.4.2.2 -r 1.4.2.3 src/plugins/spamassassin/libspamc.c; cvs diff -u -r 1.18.2.3 -r 1.18.2.4 src/plugins/spamassassin/spamassassin.c; cvs diff -u -r 1.4.2.1 -r 1.4.2.2 src/plugins/spamassassin/spamassassin.h; cvs diff -u -r 1.23.2.5 -r 1.23.2.6 src/plugins/spamassassin/spamassassin_gtk.c; cvs diff -u -r 1.14.2.11 -r 1.14.2.12 src/plugins/trayicon/trayicon.c; cvs diff -u -r 1.1.4.1 -r 1.1.4.2 src/plugins/trayicon/libeggtrayicon/gtkplugxembed.c; ) > 0.9.12cvs128.1.patchset
 ( cvs diff -u -r 1.2504.2.24 -r 1.2504.2.25 ChangeLog.claws; cvs diff -u -r 1.382.2.52 -r 1.382.2.53 src/compose.c; cvs diff -u -r 1.36.2.9 -r 1.36.2.10 src/common/utils.c; cvs diff -u -r 1.5.2.11 -r 1.5.2.12 src/gtk/menu.c; ) > 0.9.12cvs130.1.patchset
+( cvs diff -u -r 1.52.2.6 -r 1.52.2.7 src/prefs_folder_item.c; ) > 0.9.12cvs130.2.patchset
index 2780606..0d62e55 100644 (file)
@@ -13,7 +13,7 @@ INTERFACE_AGE=0
 BINARY_AGE=0
 EXTRA_VERSION=130
 EXTRA_RELEASE=
-EXTRA_GTK2_VERSION=.1
+EXTRA_GTK2_VERSION=.2
 
 if test \( $EXTRA_VERSION -eq 0 \) -o \( "x$EXTRA_RELEASE" != "x" \); then
     VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}${EXTRA_RELEASE}${EXTRA_GTK2_VERSION}
index b854d6a..ea2f95e 100644 (file)
                string = (value); \
        }
 
-struct FolderItemGeneralPage
+typedef struct _FolderItemGeneralPage FolderItemGeneralPage;
+typedef struct _FolderItemComposePage FolderItemComposePage;
+
+struct _FolderItemGeneralPage
 {
        PrefsPage page;
 
@@ -68,10 +71,17 @@ struct FolderItemGeneralPage
        GtkWidget *checkbtn_enable_processing;
        GtkWidget *checkbtn_newmailcheck;
 
+       /* appy to sub folders */
+       GtkWidget *simplify_subject_rec_checkbtn;
+       GtkWidget *folder_chmod_rec_checkbtn;
+       GtkWidget *folder_color_rec_checkbtn;
+       GtkWidget *enable_processing_rec_checkbtn;
+       GtkWidget *newmailcheck_rec_checkbtn;
+
        gint       folder_color;
 };
 
-struct FolderItemComposePage
+struct _FolderItemComposePage
 {
        PrefsPage page;
 
@@ -91,9 +101,26 @@ struct FolderItemComposePage
        GtkWidget *checkbtn_enable_default_dictionary;
        GtkWidget *optmenu_default_dictionary;
 #endif
+
+       /* apply to sub folders */
+       GtkWidget *request_return_receipt_rec_checkbtn;
+       GtkWidget *save_copy_to_folder_rec_checkbtn;
+       GtkWidget *default_to_rec_checkbtn;
+       GtkWidget *default_reply_to_rec_checkbtn;
+       GtkWidget *default_account_rec_checkbtn;
+#if USE_ASPELL
+       GtkWidget *default_dictionary_rec_checkbtn;
+#endif
+
 };
 
 
+static void general_save_folder_prefs(FolderItem *folder, FolderItemGeneralPage *page);
+static void compose_save_folder_prefs(FolderItem *folder, FolderItemComposePage *page);
+
+static gboolean general_save_recurse_func(GNode *node, gpointer data);
+static gboolean compose_save_recurse_func(GNode *node, gpointer data);
+
 gint prefs_folder_item_chmod_mode              (gchar *folder_chmod);
 
 static void folder_color_set_dialog(GtkWidget *widget, gpointer data);
@@ -105,12 +132,13 @@ void prefs_folder_item_general_create_widget_func(PrefsPage * page_,
                                                   GtkWindow * window,
                                                   gpointer data)
 {
-       struct FolderItemGeneralPage *page = (struct FolderItemGeneralPage *) page_;
+       FolderItemGeneralPage *page = (FolderItemGeneralPage *) page_;
        FolderItem *item = (FolderItem *) data;
        guint rowcount;
 
        GtkWidget *table;
        GtkWidget *hbox;
+       GtkWidget *label;
        
        GtkWidget *checkbtn_simplify_subject;
        GtkWidget *entry_simplify_subject;
@@ -121,36 +149,49 @@ void prefs_folder_item_general_create_widget_func(PrefsPage * page_,
        GtkWidget *checkbtn_enable_processing;
        GtkWidget *checkbtn_newmailcheck;
 
+       GtkWidget *simplify_subject_rec_checkbtn;
+       GtkWidget *folder_chmod_rec_checkbtn;
+       GtkWidget *folder_color_rec_checkbtn;
+       GtkWidget *enable_processing_rec_checkbtn;
+       GtkWidget *newmailcheck_rec_checkbtn;
+       
        page->item         = item;
 
        /* Table */
        table = gtk_table_new(5, 2, FALSE);
-       gtk_widget_show(table);
        gtk_table_set_row_spacings(GTK_TABLE(table), 4);
        gtk_table_set_col_spacings(GTK_TABLE(table), 4);
        rowcount = 0;
 
+       /* Apply to subfolders */
+       label = gtk_label_new(_("Apply to\nsubfolders"));
+       gtk_misc_set_alignment(GTK_MISC(label), 0.5, 0.5);
+       gtk_table_attach(GTK_TABLE(table), label, 2, 3,
+                        rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
+       rowcount++;
+
        /* Simplify Subject */
        checkbtn_simplify_subject = gtk_check_button_new_with_label(_("Simplify Subject RegExp: "));
-       gtk_widget_show(checkbtn_simplify_subject);
        gtk_table_attach(GTK_TABLE(table), checkbtn_simplify_subject, 0, 1, 
                         rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0);
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_simplify_subject), 
                                     item->prefs->enable_simplify_subject);
 
        entry_simplify_subject = gtk_entry_new();
-       gtk_widget_show(entry_simplify_subject);
        gtk_table_attach(GTK_TABLE(table), entry_simplify_subject, 1, 2, 
                         rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
        SET_TOGGLE_SENSITIVITY(checkbtn_simplify_subject, entry_simplify_subject);
        gtk_entry_set_text(GTK_ENTRY(entry_simplify_subject), 
                           SAFE_STRING(item->prefs->simplify_subject_regexp));
 
+       simplify_subject_rec_checkbtn = gtk_check_button_new();
+       gtk_table_attach(GTK_TABLE(table), simplify_subject_rec_checkbtn, 2, 3, 
+                        rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
+
        rowcount++;
 
        /* Folder chmod */
        checkbtn_folder_chmod = gtk_check_button_new_with_label(_("Folder chmod: "));
-       gtk_widget_show(checkbtn_folder_chmod);
        gtk_table_attach(GTK_TABLE(table), checkbtn_folder_chmod, 0, 1, 
                         rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0);
 
@@ -158,7 +199,6 @@ void prefs_folder_item_general_create_widget_func(PrefsPage * page_,
                                     item->prefs->enable_folder_chmod);
 
        entry_folder_chmod = gtk_entry_new();
-       gtk_widget_show(entry_folder_chmod);
        gtk_table_attach(GTK_TABLE(table), entry_folder_chmod, 1, 2, 
                         rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
        SET_TOGGLE_SENSITIVITY(checkbtn_folder_chmod, entry_folder_chmod);
@@ -170,17 +210,19 @@ void prefs_folder_item_general_create_widget_func(PrefsPage * page_,
                g_free(buf);
        }
        
+       folder_chmod_rec_checkbtn = gtk_check_button_new();
+       gtk_table_attach(GTK_TABLE(table), folder_chmod_rec_checkbtn, 2, 3, 
+                        rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
+
        rowcount++;
        
        /* Folder color */
        folder_color = gtk_label_new(_("Folder color: "));
        gtk_misc_set_alignment(GTK_MISC(folder_color), 0, 0.5);
-       gtk_widget_show(folder_color);
        gtk_table_attach(GTK_TABLE(table), folder_color, 0, 1, 
                         rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0);
 
        hbox = gtk_hbox_new(FALSE, 0);
-       gtk_widget_show(hbox);
        gtk_table_attach(GTK_TABLE(table), hbox, 1, 2, 
                         rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
 
@@ -196,30 +238,41 @@ void prefs_folder_item_general_create_widget_func(PrefsPage * page_,
 
        gtkut_set_widget_bgcolor_rgb(folder_color_btn, item->prefs->color);
 
+       folder_color_rec_checkbtn = gtk_check_button_new();
+       gtk_table_attach(GTK_TABLE(table), folder_color_rec_checkbtn, 2, 3, 
+                        rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
+
        rowcount++;
 
        /* Enable processing at startup */
        checkbtn_enable_processing = gtk_check_button_new_with_label(_("Process at startup"));
-       gtk_widget_show(checkbtn_enable_processing);
        gtk_table_attach(GTK_TABLE(table), checkbtn_enable_processing, 0, 2, 
                         rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
 
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_enable_processing), 
                                     item->prefs->enable_processing);
 
+       enable_processing_rec_checkbtn = gtk_check_button_new();
+       gtk_table_attach(GTK_TABLE(table), enable_processing_rec_checkbtn, 2, 3, 
+                        rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
+       
        rowcount++;
 
        /* Check folder for new mail */
        checkbtn_newmailcheck = gtk_check_button_new_with_label(_("Scan for new mail"));
-       gtk_widget_show(checkbtn_newmailcheck);
        gtk_table_attach(GTK_TABLE(table), checkbtn_newmailcheck, 0, 2,
                         rowcount, rowcount+1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
        
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_newmailcheck),
                                                                 item->prefs->newmailcheck);
-       
+       newmailcheck_rec_checkbtn = gtk_check_button_new();
+       gtk_table_attach(GTK_TABLE(table), newmailcheck_rec_checkbtn, 2, 3, 
+                        rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
+
        rowcount++;
 
+       gtk_widget_show_all(table);
+
        page->table = table;
        page->checkbtn_simplify_subject = checkbtn_simplify_subject;
        page->entry_simplify_subject = entry_simplify_subject;
@@ -229,66 +282,115 @@ void prefs_folder_item_general_create_widget_func(PrefsPage * page_,
        page->checkbtn_enable_processing = checkbtn_enable_processing;
        page->checkbtn_newmailcheck = checkbtn_newmailcheck;
 
+       page->simplify_subject_rec_checkbtn  = simplify_subject_rec_checkbtn;
+       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;
+       page->newmailcheck_rec_checkbtn      = newmailcheck_rec_checkbtn;
+
        page->page.widget = table;
 }
 
 void prefs_folder_item_general_destroy_widget_func(PrefsPage *page_) 
 {
-       /* struct FolderItemGeneralPage *page = (struct FolderItemGeneralPage *) page_; */
+       /* FolderItemGeneralPage *page = (FolderItemGeneralPage *) page_; */
 }
 
-void prefs_folder_item_general_save_func(PrefsPage *page_) 
+/** \brief  Save the prefs in page to folder.
+ *
+ *  If the folder is not the one  specified in page->item, then only those properties 
+ *  that have the relevant 'appy to sub folders' button checked are saved
+ */
+static void general_save_folder_prefs(FolderItem *folder, FolderItemGeneralPage *page)
 {
+       FolderItemPrefs *prefs = folder->prefs;
        gchar *buf;
-       struct FolderItemGeneralPage *page = (struct FolderItemGeneralPage *) page_;
-       FolderItemPrefs *prefs = page->item->prefs;
+       gboolean all = FALSE;
 
        g_return_if_fail(prefs != NULL);
 
-       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));
+       if (page->item == folder) 
+               all = TRUE;
+
+       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));
+       }
        
-/*
-       if (page->item == page->folderview->summaryview->folder_item &&
-           (prefs->enable_simplify_subject != old_simplify_val ||  
-           0 != strcmp2(prefs->simplify_subject_regexp, old_simplify_str))) {
-               summary_clear_all(page->folderview->summaryview);
-               page->folderview->opened = NULL;
-               page->folderview->selected = NULL;
-               folderview_select(page->folderview, page->item);
+       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));
+               buf = gtk_editable_get_chars(GTK_EDITABLE(page->entry_folder_chmod), 0, -1);
+               prefs->folder_chmod = prefs_folder_item_chmod_mode(buf);
+               g_free(buf);
        }
-*/
-       prefs->enable_folder_chmod = 
-           gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_folder_chmod));
-       buf = gtk_editable_get_chars(GTK_EDITABLE(page->entry_folder_chmod), 0, -1);
-       prefs->folder_chmod = prefs_folder_item_chmod_mode(buf);
-       g_free(buf);
 
-       prefs->color = page->folder_color;
-       /* update folder view */
-       if (prefs->color > 0)
-               folder_item_update(page->item, F_ITEM_UPDATE_MSGCNT);
+       if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->folder_color_rec_checkbtn))) {
+               prefs->color = page->folder_color;
+       
+               /* update folder view */
+               if (prefs->color > 0)
+                       folder_item_update(folder, F_ITEM_UPDATE_MSGCNT);
+       }
 
-       prefs->enable_processing = 
-           gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_enable_processing));
+       if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->enable_processing_rec_checkbtn))) {
+               prefs->enable_processing = 
+                       gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_enable_processing));
+       }
 
-       prefs->newmailcheck = 
-           gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_newmailcheck));
+       if (all ||  gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->newmailcheck_rec_checkbtn))) {
+               prefs->newmailcheck = 
+                       gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_newmailcheck));
+       }
+
+       folder_item_prefs_save_config(folder);
+}      
+
+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);
+
+       general_save_folder_prefs(item, page);
+
+       /* optimise by not continuing if none of the 'apply to sub folders'
+          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)) ||
+             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)) ||
+             gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->newmailcheck_rec_checkbtn))))
+               return TRUE;
+       else 
+               return FALSE;
+}
+
+void prefs_folder_item_general_save_func(PrefsPage *page_) 
+{
+       FolderItemGeneralPage *page = (FolderItemGeneralPage *) page_;
+
+       g_node_traverse(page->item->node, G_PRE_ORDER, G_TRAVERSE_ALL,
+                       -1, general_save_recurse_func, page);
 
-       folder_item_prefs_save_config(page->item);
 }
 
 void prefs_folder_item_compose_create_widget_func(PrefsPage * page_,
                                                   GtkWindow * window,
                                                   gpointer data)
 {
-       struct FolderItemComposePage *page = (struct FolderItemComposePage *) page_;
+       FolderItemComposePage *page = (FolderItemComposePage *) page_;
        FolderItem *item = (FolderItem *) data;
        guint rowcount;
 
        GtkWidget *table;
+       GtkWidget *label;
        
        GtkWidget *checkbtn_request_return_receipt;
        GtkWidget *checkbtn_save_copy_to_folder;
@@ -304,6 +406,15 @@ void prefs_folder_item_compose_create_widget_func(PrefsPage * page_,
        GtkWidget *checkbtn_enable_default_dictionary;
        GtkWidget *optmenu_default_dictionary;
 #endif
+       GtkWidget *request_return_receipt_rec_checkbtn;
+       GtkWidget *save_copy_to_folder_rec_checkbtn;
+       GtkWidget *default_to_rec_checkbtn;
+       GtkWidget *default_reply_to_rec_checkbtn;
+       GtkWidget *default_account_rec_checkbtn;
+#if USE_ASPELL
+       GtkWidget *default_dictionary_rec_checkbtn;
+#endif
+
        GList *cur_ac;
        GList *account_list;
 #if USE_ASPELL
@@ -324,80 +435,94 @@ void prefs_folder_item_compose_create_widget_func(PrefsPage * page_,
 # define TABLEHEIGHT 5
 #endif
        table = gtk_table_new(TABLEHEIGHT, 2, FALSE);
-       gtk_widget_show(table);
-       gtk_table_set_row_spacings(GTK_TABLE(table), 4);
        gtk_table_set_row_spacings(GTK_TABLE(table), 4);
+       gtk_table_set_col_spacings(GTK_TABLE(table), 4);
        rowcount = 0;
 
+       /* Apply to subfolders */
+       label = gtk_label_new(_("Apply to\nsubfolders"));
+       gtk_misc_set_alignment(GTK_MISC(label), 0.5, 0.5);
+       gtk_table_attach(GTK_TABLE(table), label, 2, 3,
+                        rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
+       rowcount++;
+
        /* Request Return Receipt */
        checkbtn_request_return_receipt = gtk_check_button_new_with_label
                (_("Request Return Receipt"));
-       gtk_widget_show(checkbtn_request_return_receipt);
        gtk_table_attach(GTK_TABLE(table), checkbtn_request_return_receipt, 
                         0, 2, rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, 
                         GTK_FILL, 0, 0);
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_request_return_receipt),
                                     item->ret_rcpt ? TRUE : FALSE);
 
+       request_return_receipt_rec_checkbtn = gtk_check_button_new();
+       gtk_table_attach(GTK_TABLE(table), request_return_receipt_rec_checkbtn, 2, 3, 
+                        rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
+       
        rowcount++;
 
        /* Save Copy to Folder */
        checkbtn_save_copy_to_folder = gtk_check_button_new_with_label
                (_("Save copy of outgoing messages to this folder instead of Sent"));
-       gtk_widget_show(checkbtn_save_copy_to_folder);
        gtk_table_attach(GTK_TABLE(table), checkbtn_save_copy_to_folder, 0, 2, 
                         rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0);
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_save_copy_to_folder),
                                     item->prefs->save_copy_to_folder ? TRUE : FALSE);
 
+       save_copy_to_folder_rec_checkbtn = gtk_check_button_new();
+       gtk_table_attach(GTK_TABLE(table), save_copy_to_folder_rec_checkbtn, 2, 3, 
+                        rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
+       
        rowcount++;
 
        /* Default To */
        checkbtn_default_to = gtk_check_button_new_with_label(_("Default To: "));
-       gtk_widget_show(checkbtn_default_to);
        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);
 
        entry_default_to = gtk_entry_new();
-       gtk_widget_show(entry_default_to);
        gtk_table_attach(GTK_TABLE(table), entry_default_to, 1, 2,
                         rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
        SET_TOGGLE_SENSITIVITY(checkbtn_default_to, entry_default_to);
        gtk_entry_set_text(GTK_ENTRY(entry_default_to), SAFE_STRING(item->prefs->default_to));
        address_completion_register_entry(GTK_ENTRY(entry_default_to));
 
+       default_to_rec_checkbtn = gtk_check_button_new();
+       gtk_table_attach(GTK_TABLE(table), default_to_rec_checkbtn, 2, 3, 
+                        rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
+       
        rowcount++;
 
        /* Default address to reply to */
        checkbtn_default_reply_to = gtk_check_button_new_with_label(_("Send replies to: "));
-       gtk_widget_show(checkbtn_default_reply_to);
        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);
 
        entry_default_reply_to = gtk_entry_new();
-       gtk_widget_show(entry_default_reply_to);
        gtk_table_attach(GTK_TABLE(table), entry_default_reply_to, 1, 2,
                         rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
        SET_TOGGLE_SENSITIVITY(checkbtn_default_reply_to, entry_default_reply_to);
        gtk_entry_set_text(GTK_ENTRY(entry_default_reply_to), SAFE_STRING(item->prefs->default_reply_to));
        address_completion_register_entry(GTK_ENTRY(entry_default_reply_to));
 
+       default_reply_to_rec_checkbtn = gtk_check_button_new();
+       gtk_table_attach(GTK_TABLE(table), default_reply_to_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: "));
-       gtk_widget_show(checkbtn_enable_default_account);
        gtk_table_attach(GTK_TABLE(table), checkbtn_enable_default_account, 0, 1, 
                         rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_enable_default_account), 
                                     item->prefs->enable_default_account);
 
        optmenu_default_account = gtk_option_menu_new ();
-       gtk_widget_show (optmenu_default_account);
        gtk_table_attach(GTK_TABLE(table), optmenu_default_account, 1, 2, 
                         rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
        optmenu_default_account_menu = gtk_menu_new ();
@@ -427,19 +552,21 @@ void prefs_folder_item_compose_create_widget_func(PrefsPage * page_,
 
        SET_TOGGLE_SENSITIVITY(checkbtn_enable_default_account, optmenu_default_account);
 
+       default_account_rec_checkbtn = gtk_check_button_new();
+       gtk_table_attach(GTK_TABLE(table), default_account_rec_checkbtn, 2, 3, 
+                        rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
+       
        rowcount++;
 
 #if USE_ASPELL
        /* Default dictionary */
        checkbtn_enable_default_dictionary = gtk_check_button_new_with_label(_("Default dictionary: "));
-       gtk_widget_show(checkbtn_enable_default_dictionary);
        gtk_table_attach(GTK_TABLE(table), checkbtn_enable_default_dictionary, 0, 1,
                         rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_enable_default_dictionary),
                                     item->prefs->enable_default_dictionary);
 
        optmenu_default_dictionary = gtk_option_menu_new();
-       gtk_widget_show(optmenu_default_dictionary);
        gtk_table_attach(GTK_TABLE(table), optmenu_default_dictionary, 1, 2,
                         rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
 
@@ -459,9 +586,15 @@ void prefs_folder_item_compose_create_widget_func(PrefsPage * page_,
 
        SET_TOGGLE_SENSITIVITY(checkbtn_enable_default_dictionary, optmenu_default_dictionary);
 
+       default_dictionary_rec_checkbtn = gtk_check_button_new();
+       gtk_table_attach(GTK_TABLE(table), default_dictionary_rec_checkbtn, 2, 3, 
+                        rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
+       
        rowcount++;
 #endif
 
+       gtk_widget_show_all(table);
+
        page->window = GTK_WIDGET(window);
        page->table = table;
        page->checkbtn_request_return_receipt = checkbtn_request_return_receipt;
@@ -477,6 +610,15 @@ void prefs_folder_item_compose_create_widget_func(PrefsPage * page_,
        page->optmenu_default_dictionary = optmenu_default_dictionary;
 #endif
 
+       page->request_return_receipt_rec_checkbtn = request_return_receipt_rec_checkbtn;
+       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_account_rec_checkbtn        = default_account_rec_checkbtn;
+#if USE_ASPELL
+       page->default_dictionary_rec_checkbtn = default_dictionary_rec_checkbtn;
+#endif
+
        address_completion_start(page->window);
 
        page->page.widget = table;
@@ -484,55 +626,113 @@ void prefs_folder_item_compose_create_widget_func(PrefsPage * page_,
 
 void prefs_folder_item_compose_destroy_widget_func(PrefsPage *page_) 
 {
-       struct FolderItemComposePage *page = (struct FolderItemComposePage *) page_;
+       FolderItemComposePage *page = (FolderItemComposePage *) page_;
 
        address_completion_unregister_entry(GTK_ENTRY(page->entry_default_to));
        address_completion_unregister_entry(GTK_ENTRY(page->entry_default_reply_to));
        address_completion_end(page->window);
 }
 
-void prefs_folder_item_compose_save_func(PrefsPage *page_) 
+/** \brief  Save the prefs in page to folder.
+ *
+ *  If the folder is not the one  specified in page->item, then only those properties 
+ *  that have the relevant 'appy to sub folders' button checked are saved
+ */
+static void compose_save_folder_prefs(FolderItem *folder, FolderItemComposePage *page)
 {
-       struct FolderItemComposePage *page = (struct FolderItemComposePage *) page_;
-       FolderItemPrefs *prefs = page->item->prefs;
+       FolderItemPrefs *prefs = folder->prefs;
        GtkWidget *menu;
        GtkWidget *menuitem;
+       gboolean all = FALSE;
+
+       if (page->item == folder) 
+               all = TRUE;
 
        g_return_if_fail(prefs != NULL);
 
-       prefs->request_return_receipt = 
-           gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_request_return_receipt));
-       /* MIGRATION */    
-       page->item->ret_rcpt = prefs->request_return_receipt;
+       if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->request_return_receipt_rec_checkbtn))) {
+               prefs->request_return_receipt = 
+                       gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_request_return_receipt));
+               /* MIGRATION */    
+               folder->ret_rcpt = prefs->request_return_receipt;
+       }
 
-       prefs->save_copy_to_folder = 
-           gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_save_copy_to_folder));
+       if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->save_copy_to_folder_rec_checkbtn))) {
+               prefs->save_copy_to_folder = 
+                       gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_save_copy_to_folder));
+       }
 
-       prefs->enable_default_to = 
-           gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_default_to));
-       ASSIGN_STRING(prefs->default_to,
-           gtk_editable_get_chars(GTK_EDITABLE(page->entry_default_to), 0, -1));
+       if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_to_rec_checkbtn))) {
+
+               prefs->enable_default_to = 
+                       gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_default_to));
+               ASSIGN_STRING(prefs->default_to,
+                             gtk_editable_get_chars(GTK_EDITABLE(page->entry_default_to), 0, -1));
+       }
 
-       prefs->enable_default_reply_to = 
-           gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_default_reply_to));
-       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_reply_to_rec_checkbtn))) {
+               prefs->enable_default_reply_to = 
+                       gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_default_reply_to));
+               ASSIGN_STRING(prefs->default_reply_to,
+                             gtk_editable_get_chars(GTK_EDITABLE(page->entry_default_reply_to), 0, -1));
+       }
 
-       prefs->enable_default_account = 
-           gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_enable_default_account));
-       menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(page->optmenu_default_account));
-       menuitem = gtk_menu_get_active(GTK_MENU(menu));
-       prefs->default_account = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(menuitem), MENU_VAL_ID));
+       if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_account_rec_checkbtn))) {
+               prefs->enable_default_account = 
+                       gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_enable_default_account));
+               menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(page->optmenu_default_account));
+               menuitem = gtk_menu_get_active(GTK_MENU(menu));
+               prefs->default_account = GPOINTER_TO_INT(gtk_object_get_user_data(GTK_OBJECT(menuitem)));
+       }
 
 #if USE_ASPELL
-       prefs->enable_default_dictionary =
-           gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_enable_default_dictionary));
-       menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(page->optmenu_default_dictionary));
-       ASSIGN_STRING(prefs->default_dictionary,
-           gtkaspell_get_dictionary_menu_active_item(menu));
+       if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_dictionary_rec_checkbtn))) {
+               prefs->enable_default_dictionary =
+                       gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_enable_default_dictionary));
+               menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(page->optmenu_default_dictionary));
+               ASSIGN_STRING(prefs->default_dictionary,
+                             gtkaspell_get_dictionary_menu_active_item(menu));
+       }
 #endif
 
-       folder_item_prefs_save_config(page->item);
+       folder_item_prefs_save_config(folder);
+}      
+
+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);
+
+       compose_save_folder_prefs(item, page);
+
+       /* optimise by not continuing if none of the 'apply to sub folders'
+          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->request_return_receipt_rec_checkbtn)) ||
+             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_reply_to_rec_checkbtn)) ||
+             gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_account_rec_checkbtn)) 
+#if USE_ASPELL
+             || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_dictionary_rec_checkbtn))
+#endif
+                   ))
+               return TRUE;
+       else 
+               return FALSE;
+}
+
+void prefs_folder_item_compose_save_func(PrefsPage *page_) 
+{
+       FolderItemComposePage *page = (FolderItemComposePage *) page_;
+
+       g_node_traverse(page->item->node, G_PRE_ORDER, G_TRAVERSE_ALL,
+                       -1, compose_save_recurse_func, page);
+
 }
 
 gint prefs_folder_item_chmod_mode(gchar *folder_chmod) 
@@ -551,7 +751,7 @@ gint prefs_folder_item_chmod_mode(gchar *folder_chmod)
 
 static void folder_color_set_dialog(GtkWidget *widget, gpointer data)
 {
-       struct FolderItemGeneralPage *page = (struct FolderItemGeneralPage *) data;
+       FolderItemGeneralPage *page = (FolderItemGeneralPage *) data;
        gint rgbcolor;
 
        rgbcolor = colorsel_select_color_rgb(_("Pick color for folder"), 
@@ -560,7 +760,8 @@ static void folder_color_set_dialog(GtkWidget *widget, gpointer data)
        page->folder_color = rgbcolor;
 }
 
-struct FolderItemGeneralPage folder_item_general_page;
+
+FolderItemGeneralPage folder_item_general_page;
 
 static void register_general_page()
 {
@@ -577,7 +778,7 @@ static void register_general_page()
        prefs_folder_item_register_page((PrefsPage *) &folder_item_general_page);
 }
 
-struct FolderItemComposePage folder_item_compose_page;
+FolderItemComposePage folder_item_compose_page;
 
 static void register_compose_page(void)
 {