2007-06-05 [wwp] 2.9.2cvs42
authorTristan Chabredier <wwp@claws-mail.org>
Tue, 5 Jun 2007 17:28:28 +0000 (17:28 +0000)
committerTristan Chabredier <wwp@claws-mail.org>
Tue, 5 Jun 2007 17:28:28 +0000 (17:28 +0000)
* src/prefs_account.c
* src/prefs_folder_item.c
* src/prefs_quote.c
* src/quote_fmt.c
* src/quote_fmt.h
Per-folder templates can now be applied recursively.
Always save per-folder templates (formats were erroneously
saved only if they were enabled).
Check for validity of quotation marks everywhere there
are defined.

ChangeLog
PATCHSETS
configure.ac
src/prefs_account.c
src/prefs_folder_item.c
src/prefs_quote.c
src/quote_fmt.c
src/quote_fmt.h

index 57200f59e9492d24b3c6eba7b5cfde25d03f7ed7..485d99c656822c67d4b8f3f434f5a849e2ec1644 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2007-06-05 [wwp]       2.9.2cvs42
+
+       * src/prefs_account.c
+       * src/prefs_folder_item.c
+       * src/prefs_quote.c
+       * src/quote_fmt.c
+       * src/quote_fmt.h
+               Per-folder templates can now be applied recursively.
+               Always save per-folder templates (formats were erroneously
+               saved only if they were enabled).
+               Check for validity of quotation marks everywhere there
+               are defined.
+
 2007-06-05 [wwp]       2.9.2cvs41
 
        * src/inc.c
index 50aeff91e670fc80228d5ae503aea9ba97145af2..79146bccb0a19f6673fd39b088e4d7c285669c11 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.382.2.386 -r 1.382.2.387 src/compose.c;  ) > 2.9.2cvs39.patchset
 ( cvs diff -u -r 1.382.2.387 -r 1.382.2.388 src/compose.c;  cvs diff -u -r 1.50.2.35 -r 1.50.2.36 src/compose.h;  ) > 2.9.2cvs40.patchset
 ( cvs diff -u -r 1.149.2.73 -r 1.149.2.74 src/inc.c;  ) > 2.9.2cvs41.patchset
+( cvs diff -u -r 1.105.2.100 -r 1.105.2.101 src/prefs_account.c;  cvs diff -u -r 1.52.2.39 -r 1.52.2.40 src/prefs_folder_item.c;  cvs diff -u -r 1.1.2.21 -r 1.1.2.22 src/prefs_quote.c;  cvs diff -u -r 1.8.2.18 -r 1.8.2.19 src/quote_fmt.c;  cvs diff -u -r 1.5.12.10 -r 1.5.12.11 src/quote_fmt.h;  ) > 2.9.2cvs42.patchset
index 90553d425b82284d3d433f4fe658d2cce54c74e4..85468e2498412b8e2e45a52687a705ba6f9b0d05 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=2
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=41
+EXTRA_VERSION=42
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 8fff607ff9fec50f0b2fa871051304fef3ca82ec..af6a715de0518c21491d4c2f8e05f756dee676ed 100644 (file)
@@ -2857,8 +2857,10 @@ static void templates_save_func(PrefsPage *_page)
                                                                        tmp_ac_prefs.compose_subject_format,
                                                                        tmp_ac_prefs.compose_body_format);
        quotefmt_check_reply_formats(tmp_ac_prefs.reply_with_format,
+                                                                       tmp_ac_prefs.reply_quotemark,
                                                                        tmp_ac_prefs.reply_body_format);
        quotefmt_check_forward_formats(tmp_ac_prefs.forward_with_format,
+                                                                       tmp_ac_prefs.forward_quotemark,
                                                                        tmp_ac_prefs.forward_body_format);
        if (prefs_templates_apply() >= 0)
                cancelled = FALSE;
index f31ced42ff6e1246672d0ef5b9b755736f41ada2..525d2f838551b54d24bdb7d6021ba05b1b0af628 100644 (file)
@@ -137,6 +137,7 @@ struct _FolderItemTemplatesPage
        FolderItem *item;
 
        GtkWidget *window;
+       GtkWidget *table;
        GtkWidget *checkbtn_compose_with_format;
        GtkWidget *compose_subject_format;
        GtkWidget *compose_body_format;
@@ -146,6 +147,11 @@ struct _FolderItemTemplatesPage
        GtkWidget *checkbtn_forward_with_format;
        GtkWidget *forward_quotemark;
        GtkWidget *forward_body_format;
+
+       /* apply to sub folders */
+       GtkWidget *new_msg_format_rec_checkbtn;
+       GtkWidget *reply_format_rec_checkbtn;
+       GtkWidget *forward_format_rec_checkbtn;
 };
 
 
@@ -174,7 +180,6 @@ static void prefs_folder_item_general_create_widget_func(PrefsPage * page_,
        FolderItem *item = (FolderItem *) data;
        guint rowcount;
 
-
        GtkWidget *table;
        GtkWidget *hbox;
        GtkWidget *label;
@@ -1055,40 +1060,127 @@ static void prefs_folder_item_templates_create_widget_func(PrefsPage * page_,
        FolderItemTemplatesPage *page = (FolderItemTemplatesPage *) page_;
        FolderItem *item = (FolderItem *) data;
 
-       GtkWidget *vbox_formats;
+       GtkWidget *table;
+       GtkWidget *label;
+       guint rowcount;
+       GtkWidget *vbox;
+       GtkWidget *alignment;
+       GtkWidget *new_msg_format_rec_checkbtn;
+       GtkWidget *reply_format_rec_checkbtn;
+       GtkWidget *forward_format_rec_checkbtn;
 
        page->item         = item;
 
-       /* compose/reply/forward formats */
-       vbox_formats = gtk_vbox_new (FALSE, VSPACING);
-       gtk_widget_show (vbox_formats);
-       gtk_container_set_border_width (GTK_CONTAINER (vbox_formats), VBOX_BORDER);
+       /* Table */
+       table = gtk_table_new(5, 3, FALSE);
+       gtk_container_set_border_width (GTK_CONTAINER (table), VBOX_BORDER);
+       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++;
+
+       /* compose format */
+       vbox = gtk_vbox_new (FALSE, VSPACING);
+       gtk_widget_show (vbox);
+       gtk_container_set_border_width (GTK_CONTAINER (vbox), 0);
+       gtk_table_attach(GTK_TABLE(table), vbox, 1, 2, 
+                        rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
 
        quotefmt_create_new_msg_fmt_widgets(
                                window,
-                               vbox_formats,
+                               vbox,
                                &page->checkbtn_compose_with_format,
                                _("Use a specific format for new messages"),
                                &page->compose_subject_format,
                                &page->compose_body_format,
                                FALSE);
+
+       vbox = gtk_vbox_new (FALSE, VSPACING);
+       gtk_widget_show (vbox);
+       gtk_container_set_border_width (GTK_CONTAINER (vbox), 0);
+       gtk_table_attach(GTK_TABLE(table), vbox, 2, 3, 
+                        rowcount, rowcount + 1, GTK_SHRINK, GTK_FILL, 0, 0);
+
+       new_msg_format_rec_checkbtn = gtk_check_button_new();
+       gtk_box_pack_start (GTK_BOX(vbox), new_msg_format_rec_checkbtn, FALSE, FALSE, 0);
+       alignment = gtk_alignment_new(0, 1, 0, 0);      
+       gtk_box_pack_start (GTK_BOX(vbox), alignment, FALSE, FALSE, 0);
+
+       rowcount++;
+
+       /* reply format */
+       vbox = gtk_vbox_new (FALSE, VSPACING);
+       gtk_widget_show (vbox);
+       gtk_container_set_border_width (GTK_CONTAINER (vbox), 0);
+       gtk_table_attach(GTK_TABLE(table), vbox, 1, 2, 
+                        rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+
        quotefmt_create_reply_fmt_widgets(
                                window,
-                               vbox_formats,
+                               vbox,
                                &page->checkbtn_reply_with_format,
                                _("Use a specific reply quote format"),
                                &page->reply_quotemark,
                                &page->reply_body_format,
                                FALSE);
+
+       vbox = gtk_vbox_new (FALSE, VSPACING);
+       gtk_widget_show (vbox);
+       gtk_container_set_border_width (GTK_CONTAINER (vbox), 0);
+       gtk_table_attach(GTK_TABLE(table), vbox, 2, 3, 
+                        rowcount, rowcount + 1, GTK_SHRINK, GTK_FILL, 0, 0);
+
+       reply_format_rec_checkbtn = gtk_check_button_new();
+       gtk_box_pack_start (GTK_BOX(vbox), reply_format_rec_checkbtn, FALSE, FALSE, 0);
+       alignment = gtk_alignment_new(0, 1, 0, 0);      
+       gtk_box_pack_start (GTK_BOX(vbox), alignment, FALSE, FALSE, 0);
+
+       rowcount++;
+
+       /* forward format */
+       vbox = gtk_vbox_new (FALSE, VSPACING);
+       gtk_widget_show (vbox);
+       gtk_container_set_border_width (GTK_CONTAINER (vbox), 0);
+       gtk_table_attach(GTK_TABLE(table), vbox, 1, 2, 
+                        rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+
        quotefmt_create_forward_fmt_widgets(
                                window,
-                               vbox_formats,
+                               vbox,
                                &page->checkbtn_forward_with_format,
                                _("Use a specific forward quote format"),
                                &page->forward_quotemark,
                                &page->forward_body_format,
                                FALSE);
-       quotefmt_add_info_button(window, vbox_formats);
+
+       vbox = gtk_vbox_new (FALSE, VSPACING);
+       gtk_widget_show (vbox);
+       gtk_container_set_border_width (GTK_CONTAINER (vbox), 0);
+       gtk_table_attach(GTK_TABLE(table), vbox, 2, 3, 
+                        rowcount, rowcount + 1, GTK_SHRINK, GTK_FILL, 0, 0);
+
+       forward_format_rec_checkbtn = gtk_check_button_new();
+       gtk_box_pack_start (GTK_BOX(vbox), forward_format_rec_checkbtn, FALSE, FALSE, 0);
+       alignment = gtk_alignment_new(0, 1, 0, 0);      
+       gtk_box_pack_start (GTK_BOX(vbox), alignment, FALSE, FALSE, 0);
+
+       rowcount++;
+
+       /* information button */
+       vbox = gtk_vbox_new (FALSE, VSPACING);
+       gtk_widget_show (vbox);
+       gtk_container_set_border_width (GTK_CONTAINER (vbox), 0);
+       gtk_table_attach(GTK_TABLE(table), vbox, 1, 2, 
+                        rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+       rowcount++;
+       quotefmt_add_info_button(window, vbox);
+
 
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(page->checkbtn_compose_with_format),
                        item->prefs->compose_with_format);
@@ -1111,11 +1203,16 @@ static void prefs_folder_item_templates_create_widget_func(PrefsPage * page_,
        pref_set_textview_from_pref(GTK_TEXT_VIEW(page->forward_body_format),
                        item->prefs->forward_body_format);
 
-       gtk_widget_show_all(vbox_formats);
+       gtk_widget_show_all(table);
 
        page->window = GTK_WIDGET(window);
+       page->table = table;
+
+       page->new_msg_format_rec_checkbtn = new_msg_format_rec_checkbtn;
+       page->reply_format_rec_checkbtn = reply_format_rec_checkbtn;
+       page->forward_format_rec_checkbtn = forward_format_rec_checkbtn;
 
-       page->page.widget = vbox_formats;
+       page->page.widget = table;
 }
 
 static void prefs_folder_item_templates_destroy_widget_func(PrefsPage *page_) 
@@ -1143,7 +1240,7 @@ static void templates_save_folder_prefs(FolderItem *folder, FolderItemTemplatesP
 
        /* save and check formats */
 
-       if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_compose_with_format))) {
+       if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->new_msg_format_rec_checkbtn))) {
                prefs->compose_with_format =
                        gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_compose_with_format));
                prefs->compose_subject_format = pref_get_pref_from_entry(
@@ -1155,7 +1252,7 @@ static void templates_save_folder_prefs(FolderItem *folder, FolderItemTemplatesP
                                                                                prefs->compose_body_format);
        }
 
-       if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_reply_with_format))) {
+       if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->reply_format_rec_checkbtn))) {
                prefs->reply_with_format =
                        gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_reply_with_format));
                prefs->reply_quotemark = gtk_editable_get_chars(
@@ -1163,10 +1260,11 @@ static void templates_save_folder_prefs(FolderItem *folder, FolderItemTemplatesP
                prefs->reply_body_format = pref_get_pref_from_textview(
                                GTK_TEXT_VIEW(page->reply_body_format));
                quotefmt_check_reply_formats(prefs->reply_with_format,
+                                                                               prefs->reply_quotemark,
                                                                                prefs->reply_body_format);
        }
 
-       if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_forward_with_format))) {
+       if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->forward_format_rec_checkbtn))) {
                prefs->forward_with_format =
                        gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_forward_with_format));
                prefs->forward_quotemark = gtk_editable_get_chars(
@@ -1174,6 +1272,7 @@ static void templates_save_folder_prefs(FolderItem *folder, FolderItemTemplatesP
                prefs->forward_body_format = pref_get_pref_from_textview(
                                GTK_TEXT_VIEW(page->forward_body_format));
                quotefmt_check_forward_formats(prefs->forward_with_format,
+                                                                               prefs->forward_quotemark,
                                                                                prefs->forward_body_format);
        }
 
@@ -1190,6 +1289,17 @@ static gboolean templates_save_recurse_func(GNode *node, gpointer data)
 
        templates_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->new_msg_format_rec_checkbtn)) ||
+             gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->reply_format_rec_checkbtn)) ||
+             gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->forward_format_rec_checkbtn))))
+               return TRUE;
+       else 
+               return FALSE;
+
        return FALSE;
 }
 
index 92f41c669b541b91a9336ef34572c0fe8ea6dcda..7254ba0a9071d57f941ea9d733a403476c869d05 100644 (file)
@@ -152,18 +152,17 @@ static void prefs_quote_save(PrefsPage *_page)
                                                                        prefs_common.compose_subject_format,
                                                                        prefs_common.compose_body_format);
 
+       prefs_common.quotemark = gtk_editable_get_chars(
+                       GTK_EDITABLE(page->entry_quotemark), 0, -1);
        prefs_common.quotefmt = pref_get_pref_from_textview(
                        GTK_TEXT_VIEW(page->text_quotefmt));
-       quotefmt_check_reply_formats(TRUE, prefs_common.quotefmt);
-
-       prefs_common.fw_quotefmt = pref_get_pref_from_textview(
-                       GTK_TEXT_VIEW(page->text_fw_quotefmt));
-       quotefmt_check_forward_formats(TRUE, prefs_common.fw_quotefmt);
+       quotefmt_check_reply_formats(TRUE, prefs_common.quotemark, prefs_common.quotefmt);
 
-       prefs_common.quotemark = gtk_editable_get_chars(
-                       GTK_EDITABLE(page->entry_quotemark), 0, -1);
        prefs_common.fw_quotemark = gtk_editable_get_chars(
                        GTK_EDITABLE(page->entry_fw_quotemark), 0, -1);
+       prefs_common.fw_quotefmt = pref_get_pref_from_textview(
+                       GTK_TEXT_VIEW(page->text_fw_quotefmt));
+       quotefmt_check_forward_formats(TRUE, prefs_common.fw_quotemark, prefs_common.fw_quotefmt);
 }
 
 static void prefs_quote_destroy_widget(PrefsPage *_page)
index 4668a35eed7f01e7a128358ef74452ecbb1cfa91..81139a8b234b159b0387ed8575e7be6ed4091a93 100644 (file)
@@ -410,41 +410,52 @@ void quotefmt_check_new_msg_formats(gboolean use_format,
                                                                        gchar *subject_fmt,
                                                                        gchar *body_fmt)
 {
-       gint line;
-
-       if (use_format &&
-                       !prefs_template_string_is_valid(subject_fmt, NULL))
-               alertpanel_error(_("New message subject format error."));
-       if (use_format &&
-                       !prefs_template_string_is_valid(body_fmt, &line)) {
-               gchar *msg = g_strdup_printf(_("New message body format error at line %d."), line);
-               alertpanel_error(msg);
-               g_free(msg);
+       if (use_format) {
+               gint line;
+
+               if (!prefs_template_string_is_valid(subject_fmt, NULL))
+                       alertpanel_error(_("New message subject format error."));
+
+               if (!prefs_template_string_is_valid(body_fmt, &line)) {
+                       gchar *msg = g_strdup_printf(_("New message body format error at line %d."), line);
+                       alertpanel_error(msg);
+                       g_free(msg);
+               }
        }
 }
 
 void quotefmt_check_reply_formats(gboolean use_format,
+                                                                       gchar *quotation_mark,
                                                                        gchar *body_fmt)
 {
-       gint line;
+       if (use_format) {
+               gint line;
+
+               if (!prefs_template_string_is_valid(quotation_mark, NULL))
+                       alertpanel_error(_("Message reply quotation mark format error."));
 
-       if (use_format &&
-                       !prefs_template_string_is_valid(body_fmt, &line)) {
-               gchar *msg = g_strdup_printf(_("Message reply format error at line %d."), line);
-               alertpanel_error(msg);
-               g_free(msg);
+               if (!prefs_template_string_is_valid(body_fmt, &line)) {
+                       gchar *msg = g_strdup_printf(_("Message reply format error at line %d."), line);
+                       alertpanel_error(msg);
+                       g_free(msg);
+               }
        }
 }
 
 void quotefmt_check_forward_formats(gboolean use_format,
+                                                                       gchar *quotation_mark,
                                                                        gchar *body_fmt)
 {
-       gint line;
+       if (use_format) {
+               gint line;
+
+               if (!prefs_template_string_is_valid(quotation_mark, NULL))
+                       alertpanel_error(_("Message forward quotation mark format error."));
 
-       if (use_format &&
-                       !prefs_template_string_is_valid(body_fmt, &line)) {
-               gchar *msg = g_strdup_printf(_("Message forward format error at line %d."), line);
-               alertpanel_error(msg);
-               g_free(msg);
+               if (!prefs_template_string_is_valid(body_fmt, &line)) {
+                       gchar *msg = g_strdup_printf(_("Message forward format error at line %d."), line);
+                       alertpanel_error(msg);
+                       g_free(msg);
+               }
        }
 }
index 6f014f894beb4835903d612401eee64390297e3e..b6d280a1683f9cf18d82fc96f298530c4d79ca22 100644 (file)
@@ -54,8 +54,10 @@ void quotefmt_check_new_msg_formats(gboolean use_format,
                                                                        gchar *subject_fmt,
                                                                        gchar *body_fmt);
 void quotefmt_check_reply_formats(gboolean use_format,
+                                                                       gchar *quotation_mark,
                                                                        gchar *body_fmt);
 void quotefmt_check_forward_formats(gboolean use_format,
+                                                                       gchar *quotation_mark,
                                                                        gchar *body_fmt);
 
 #endif /* __QUOTE_FMT_H__ */