2009-06-02 [colin] 3.7.1cvs65
[claws.git] / src / quote_fmt.c
index 70edd55c097d231b1fac98b9de1bd990e1504349..315ba86637f72692407858136aa161e9e2081dfd 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
@@ -69,6 +69,8 @@ static gchar *quote_desc_strings[] = {
        "%account_email (%am)",         N_("account property: your email address"), /* mail address in compose account */
        "%account_name (%an)",          N_("account property: account name"), /* compose account name itself */
        "%account_org (%ao)",           N_("account property: organization"), /* organization in compose account */
+       "%account_sig (%as)",           N_("account property: signature"), /* signature set in account prefs */
+       "%account_sigpath (%asp)",      N_("account property: signature path"), /* signature path set in account prefs */
        "%account_dict (%aT)",          N_("account property: default dictionary"), /* main dict (if enabled) in account */
        "%addrbook_cc (%ABc)",          N_("address book <span style=\"oblique\">completion</span>: Cc"), /* completion of 'Cc' from address book */
        "%addrbook_from (%ABf)",        N_("address book <span style=\"oblique\">completion</span>: From"), /* completion of 'From' from address book */
@@ -84,11 +86,12 @@ static gchar *quote_desc_strings[] = {
        "\\n",                          N_("new line"),
        "",                                     NULL,
        N_("<span weight=\"bold\">commands:</span>"),           NULL,
-       "?x{<span style=\"oblique\">expr</span>}\n\n",          N_("insert <span style=\"oblique\">expr</span> if x is set, where x is one of\nthe [dfNFLIstcnriT, ad, af, ao, aT, ABc, ABf, ABt]\nsymbols (or their long equivalent)"),
-       "!x{<span style=\"oblique\">expr</span>}\n\n",          N_("insert <span style=\"oblique\">expr</span> if x is not set, where x is one of\nthe [dfNFLIstcnriT, ad, af, ao, aT, ABc, ABf, ABt]\nsymbols (or their long equivalent)"),
+       "?x{<span style=\"oblique\">expr</span>}\n\n",          N_("insert <span style=\"oblique\">expr</span> if x is set, where x is one of\nthe [dfNFLIstcnriT, ad, af, ao, as, asp, aT, ABc, ABf, ABt]\nsymbols (or their long equivalent)"),
+       "!x{<span style=\"oblique\">expr</span>}\n\n",          N_("insert <span style=\"oblique\">expr</span> if x is not set, where x is one of\nthe [dfNFLIstcnriT, ad, af, ao, as, asp, aT, ABc, ABf, ABt]\nsymbols (or their long equivalent)"),
        "|file{<span style=\"oblique\">sub_expr</span>}\n(|f{<span style=\"oblique\">sub_expr</span>})",                N_("insert file:\n<span style=\"oblique\">sub_expr</span> is evaluated as the path of the file to insert"), /* insert file */
        "|program{<span style=\"oblique\">sub_expr</span>}\n(|p{<span style=\"oblique\">sub_expr</span>})\n",   N_("insert program output:\n<span style=\"oblique\">sub_expr</span> is evaluated as a command-line to get\nthe output from"), /* insert program output */
        "|input{<span style=\"oblique\">sub_expr</span>}\n(|i{<span style=\"oblique\">sub_expr</span>})\n",             N_("insert user input:\n<span style=\"oblique\">sub_expr</span> is a variable to be replaced by\nuser-entered text"), /* insert user input */
+       "|attach{<span style=\"oblique\">sub_expr</span>}\n(|a{<span style=\"oblique\">sub_expr</span>})",              N_("attach file:\n<span style=\"oblique\">sub_expr</span> is evaluated as the path of the file to attach"), /* attach file */
        "",                                     NULL,
        N_("<span weight=\"bold\">definition of terms:</span>"),        NULL,
        "<span style=\"oblique\">expr</span>\n",                        N_("text that can contain any of the symbols or\ncommands above"),
@@ -116,46 +119,75 @@ void quote_fmt_quote_description(GtkWidget *widget, GtkWidget *pref_window)
 void quotefmt_create_new_msg_fmt_widgets(GtkWindow *parent_window,
                                                GtkWidget *parent_box,
                                                GtkWidget **checkbtn_compose_with_format,
-                                               gchar *checkbtn_compose_text,
+                                               GtkWidget **override_from_format,
                                                GtkWidget **edit_subject_format,
                                                GtkWidget **edit_body_format,
-                                               gboolean add_info_button)
+                                               gboolean add_info_button,
+                                               void(*set_defaults_func)(void))
 {
        GtkWidget *checkbtn_use_format = NULL;
-       GtkWidget *frame_format;
        GtkWidget *vbox_format;
        GtkWidget *hbox_format;
+       GtkWidget *hbox2_format;
+       GtkWidget *label_from = NULL;
+       GtkWidget *entry_from = NULL;
        GtkWidget *label_subject;
        GtkWidget *entry_subject;
        GtkWidget *scrolledwin_format;
        GtkWidget *text_format;
+       GtkSizeGroup *size_group;
 
        if (add_info_button)
-               g_return_if_fail(parent_window != NULL);
-       g_return_if_fail(parent_box != NULL);
-       if (checkbtn_compose_with_format) {
-               g_return_if_fail(checkbtn_compose_with_format != NULL);
-               g_return_if_fail(checkbtn_compose_text != NULL);
-       }
-       g_return_if_fail(edit_subject_format != NULL);
-       g_return_if_fail(edit_body_format != NULL);
+               cm_return_if_fail(parent_window != NULL);
+       cm_return_if_fail(parent_box != NULL);
+       if (checkbtn_compose_with_format)
+               cm_return_if_fail(checkbtn_compose_with_format != NULL);
+
+       cm_return_if_fail(edit_subject_format != NULL);
+       cm_return_if_fail(edit_body_format != NULL);
+
+       size_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
 
        if (checkbtn_compose_with_format)
                PACK_CHECK_BUTTON (parent_box, checkbtn_use_format, 
-                                  _("Use format when composing new messages"));
+                                  _("Use template when composing new messages"));
 
-       vbox_format = gtkut_get_options_frame(parent_box, &frame_format, checkbtn_compose_text);
+       vbox_format = gtk_vbox_new (FALSE, 4);
+       gtk_widget_show(vbox_format);
+       gtk_container_add(GTK_CONTAINER (parent_box), vbox_format);
+       gtk_container_set_border_width (GTK_CONTAINER (vbox_format), 8);
 
-       if (checkbtn_compose_with_format)
-               SET_TOGGLE_SENSITIVITY(checkbtn_use_format, frame_format);
+       if (override_from_format) {
+               CLAWS_TIP_DECL();
+
+               hbox2_format = gtk_hbox_new (FALSE, 8);
+               gtk_widget_show (hbox2_format);
+               gtk_box_pack_start (GTK_BOX (vbox_format), hbox2_format, FALSE, FALSE, 0);
+
+               label_from = gtk_label_new (_("From"));
+               gtk_misc_set_alignment(GTK_MISC(label_from), 1, 0.5);
+               gtk_widget_show (label_from);
+               gtk_box_pack_start (GTK_BOX (hbox2_format), label_from, FALSE, FALSE, 0);
+               gtk_size_group_add_widget(size_group, label_from);
+
+               entry_from = gtk_entry_new ();
+               gtk_widget_show (entry_from);
+               gtk_box_pack_start (GTK_BOX (hbox2_format), entry_from, TRUE, TRUE, 0);
+               gtk_widget_set_size_request (entry_from, 100, -1);
+
+               CLAWS_SET_TIP(entry_from,
+                               _("Override From header. This doesn't change the account used to compose the new message."));
+       }
 
        hbox_format = gtk_hbox_new (FALSE, 8);
        gtk_widget_show (hbox_format);
        gtk_box_pack_start (GTK_BOX (vbox_format), hbox_format, FALSE, FALSE, 0);
 
        label_subject = gtk_label_new (_("Subject"));
+       gtk_misc_set_alignment(GTK_MISC(label_subject), 1, 0.5);
        gtk_widget_show (label_subject);
        gtk_box_pack_start (GTK_BOX (hbox_format), label_subject, FALSE, FALSE, 0);
+       gtk_size_group_add_widget(size_group, label_subject);
 
        entry_subject = gtk_entry_new ();
        gtk_widget_show (entry_subject);
@@ -188,11 +220,25 @@ void quotefmt_create_new_msg_fmt_widgets(GtkWindow *parent_window,
        gtk_text_view_set_editable (GTK_TEXT_VIEW (text_format), TRUE);
        gtk_widget_set_size_request(text_format, -1, 100);
 
+       if (checkbtn_compose_with_format) {
+               SET_TOGGLE_SENSITIVITY(checkbtn_use_format, label_subject);
+               if (override_from_format) {
+                       SET_TOGGLE_SENSITIVITY(checkbtn_use_format, entry_from);
+                       SET_TOGGLE_SENSITIVITY(checkbtn_use_format, label_from);
+               }
+               SET_TOGGLE_SENSITIVITY(checkbtn_use_format, entry_subject);
+               SET_TOGGLE_SENSITIVITY(checkbtn_use_format, text_format);
+       }
+
        if (add_info_button)
                quotefmt_add_info_button(parent_window, vbox_format);
+       if (set_defaults_func)
+               quotefmt_add_defaults_button(parent_window, vbox_format, set_defaults_func);
 
        if (checkbtn_compose_with_format)
                *checkbtn_compose_with_format = checkbtn_use_format;
+       if (override_from_format)
+               *override_from_format = entry_from;
        *edit_subject_format = entry_subject;
        *edit_body_format = text_format;
 }
@@ -200,44 +246,67 @@ void quotefmt_create_new_msg_fmt_widgets(GtkWindow *parent_window,
 void quotefmt_create_reply_fmt_widgets(GtkWindow *parent_window,
                                                GtkWidget *parent_box,
                                                GtkWidget **checkbtn_reply_with_format,
-                                               gchar *checkbtn_reply_text,
+                                               GtkWidget **override_from_format,
                                                GtkWidget **edit_reply_quotemark,
                                                GtkWidget **edit_reply_format,
-                                               gboolean add_info_button)
+                                               gboolean add_info_button,
+                                               void(*set_defaults_func)(void))
 {
        GtkWidget *checkbtn_use_format = NULL;
-       GtkWidget *frame_quote;
        GtkWidget *vbox_quote;
        GtkWidget *hbox1;
        GtkWidget *hbox2;
+       GtkWidget *hbox3;
        GtkWidget *label_quotemark;
        GtkWidget *entry_quotemark;
+       GtkWidget *label_from = NULL;
+       GtkWidget *entry_from = NULL;
        GtkWidget *scrolledwin_quotefmt;
        GtkWidget *text_quotefmt;
+       GtkSizeGroup *size_group;
 
        if (add_info_button)
-               g_return_if_fail(parent_window != NULL);
-       g_return_if_fail(parent_box != NULL);
-       if (checkbtn_reply_with_format) {
-               g_return_if_fail(checkbtn_reply_with_format != NULL);
-               g_return_if_fail(checkbtn_reply_text != NULL);
-       }
-       g_return_if_fail(edit_reply_quotemark != NULL);
-       g_return_if_fail(edit_reply_format != NULL);
-
+               cm_return_if_fail(parent_window != NULL);
+       cm_return_if_fail(parent_box != NULL);
        if (checkbtn_reply_with_format)
-               PACK_CHECK_BUTTON (parent_box, checkbtn_use_format, checkbtn_reply_text);
+               cm_return_if_fail(checkbtn_reply_with_format != NULL);
 
-       PACK_FRAME (parent_box, frame_quote, _("Reply format"));
+       cm_return_if_fail(edit_reply_quotemark != NULL);
+       cm_return_if_fail(edit_reply_format != NULL);
+
+       size_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
 
        if (checkbtn_reply_with_format)
-               SET_TOGGLE_SENSITIVITY(checkbtn_use_format, frame_quote);
+               PACK_CHECK_BUTTON (parent_box, checkbtn_use_format,
+                                  _("Use template when replying to messages"));
 
-       vbox_quote = gtk_vbox_new (FALSE, VSPACING_NARROW);
-       gtk_widget_show (vbox_quote);
-       gtk_container_add (GTK_CONTAINER (frame_quote), vbox_quote);
+       vbox_quote = gtk_vbox_new (FALSE, 4);
+       gtk_widget_show(vbox_quote);
+       gtk_container_add(GTK_CONTAINER (parent_box), vbox_quote);
        gtk_container_set_border_width (GTK_CONTAINER (vbox_quote), 8);
 
+       if (override_from_format) {
+               CLAWS_TIP_DECL();
+
+               hbox3 = gtk_hbox_new (FALSE, 8);
+               gtk_widget_show (hbox3);
+               gtk_box_pack_start (GTK_BOX (vbox_quote), hbox3, FALSE, FALSE, 0);
+
+               label_from = gtk_label_new (_("From"));
+               gtk_misc_set_alignment(GTK_MISC(label_from), 1, 0.5);
+               gtk_widget_show (label_from);
+               gtk_box_pack_start (GTK_BOX (hbox3), label_from, FALSE, FALSE, 0);
+               gtk_size_group_add_widget(size_group, label_from);
+
+               entry_from = gtk_entry_new ();
+               gtk_widget_show (entry_from);
+               gtk_box_pack_start (GTK_BOX (hbox3), entry_from, TRUE, TRUE, 0);
+               gtk_widget_set_size_request (entry_from, 100, -1);
+
+               CLAWS_SET_TIP(entry_from,
+                               _("Override From header. This doesn't change the account used to reply."));
+       }
+
        hbox1 = gtk_hbox_new (FALSE, 32);
        gtk_widget_show (hbox1);
        gtk_box_pack_start (GTK_BOX (vbox_quote), hbox1, FALSE, FALSE, 0);
@@ -247,8 +316,10 @@ void quotefmt_create_reply_fmt_widgets(GtkWindow *parent_window,
        gtk_box_pack_start (GTK_BOX (hbox1), hbox2, FALSE, FALSE, 0);
 
        label_quotemark = gtk_label_new (_("Quotation mark"));
+       gtk_misc_set_alignment(GTK_MISC(label_quotemark), 1, 0.5);
        gtk_widget_show (label_quotemark);
        gtk_box_pack_start (GTK_BOX (hbox2), label_quotemark, FALSE, FALSE, 0);
+       gtk_size_group_add_widget(size_group, label_quotemark);
 
        entry_quotemark = gtk_entry_new ();
        gtk_widget_show (entry_quotemark);
@@ -281,56 +352,93 @@ void quotefmt_create_reply_fmt_widgets(GtkWindow *parent_window,
        gtk_text_view_set_editable (GTK_TEXT_VIEW (text_quotefmt), TRUE);
        gtk_widget_set_size_request(text_quotefmt, -1, 100);
 
+       if (checkbtn_reply_with_format) {
+               SET_TOGGLE_SENSITIVITY(checkbtn_use_format, label_quotemark);
+               SET_TOGGLE_SENSITIVITY(checkbtn_use_format, entry_quotemark);
+               if (override_from_format) {
+                       SET_TOGGLE_SENSITIVITY(checkbtn_use_format, entry_from);
+                       SET_TOGGLE_SENSITIVITY(checkbtn_use_format, label_from);
+               }
+               SET_TOGGLE_SENSITIVITY(checkbtn_use_format, text_quotefmt);
+       }
+
        if (add_info_button)
                quotefmt_add_info_button(parent_window, vbox_quote);
+       if (set_defaults_func)
+               quotefmt_add_defaults_button(parent_window, vbox_quote, set_defaults_func);
 
        if (checkbtn_reply_with_format)
                *checkbtn_reply_with_format = checkbtn_use_format;
        *edit_reply_quotemark = entry_quotemark;
+       if (override_from_format)
+               *override_from_format = entry_from;
        *edit_reply_format = text_quotefmt;
 }
 
 void quotefmt_create_forward_fmt_widgets(GtkWindow *parent_window,
                                                GtkWidget *parent_box,
                                                GtkWidget **checkbtn_forward_with_format,
-                                               gchar *checkbtn_forward_text,
+                                               GtkWidget **override_from_format,
                                                GtkWidget **edit_fw_quotemark,
                                                GtkWidget **edit_fw_format,
-                                               gboolean add_info_button)
+                                               gboolean add_info_button,
+                                               void(*set_defaults_func)(void))
 {
        GtkWidget *checkbtn_use_format = NULL;
-       GtkWidget *frame_quote;
        GtkWidget *vbox_quote;
        GtkWidget *hbox1;
        GtkWidget *hbox2;
+       GtkWidget *hbox3;
        GtkWidget *label_quotemark;
        GtkWidget *entry_fw_quotemark;
+       GtkWidget *label_from = NULL;
+       GtkWidget *entry_from = NULL;
        GtkWidget *scrolledwin_quotefmt;
        GtkWidget *text_fw_quotefmt;
+       GtkSizeGroup *size_group;
 
        if (add_info_button)
-               g_return_if_fail(parent_window != NULL);
-       g_return_if_fail(parent_box != NULL);
+               cm_return_if_fail(parent_window != NULL);
+       cm_return_if_fail(parent_box != NULL);
        if (checkbtn_forward_with_format) {
-               g_return_if_fail(checkbtn_forward_with_format != NULL);
-               g_return_if_fail(checkbtn_forward_text != NULL);
+               cm_return_if_fail(checkbtn_forward_with_format != NULL);
        }
-       g_return_if_fail(edit_fw_quotemark != NULL);
-       g_return_if_fail(edit_fw_format != NULL);
-
-       if (checkbtn_forward_with_format)
-               PACK_CHECK_BUTTON (parent_box, checkbtn_use_format, checkbtn_forward_text);
+       cm_return_if_fail(edit_fw_quotemark != NULL);
+       cm_return_if_fail(edit_fw_format != NULL);
 
-       PACK_FRAME (parent_box, frame_quote, _("Forward format"));
+       size_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
 
        if (checkbtn_forward_with_format)
-               SET_TOGGLE_SENSITIVITY(checkbtn_use_format, frame_quote);
+               PACK_CHECK_BUTTON (parent_box, checkbtn_use_format,
+                                  _("Use template when forwarding messages"));
 
-       vbox_quote = gtk_vbox_new (FALSE, VSPACING_NARROW);
-       gtk_widget_show (vbox_quote);
-       gtk_container_add (GTK_CONTAINER (frame_quote), vbox_quote);
+       vbox_quote = gtk_vbox_new (FALSE, 4);
+       gtk_widget_show(vbox_quote);
+       gtk_container_add(GTK_CONTAINER (parent_box), vbox_quote);
        gtk_container_set_border_width (GTK_CONTAINER (vbox_quote), 8);
 
+       if (override_from_format) {
+               CLAWS_TIP_DECL();
+
+               hbox3 = gtk_hbox_new (FALSE, 8);
+               gtk_widget_show (hbox3);
+               gtk_box_pack_start (GTK_BOX (vbox_quote), hbox3, FALSE, FALSE, 0);
+
+               label_from = gtk_label_new (_("From"));
+               gtk_misc_set_alignment(GTK_MISC(label_from), 1, 0.5);
+               gtk_widget_show (label_from);
+               gtk_box_pack_start (GTK_BOX (hbox3), label_from, FALSE, FALSE, 0);
+               gtk_size_group_add_widget(size_group, label_from);
+
+               entry_from = gtk_entry_new ();
+               gtk_widget_show (entry_from);
+               gtk_box_pack_start (GTK_BOX (hbox3), entry_from, TRUE, TRUE, 0);
+               gtk_widget_set_size_request (entry_from, 100, -1);
+
+               CLAWS_SET_TIP(entry_from,
+                               _("Override From header. This doesn't change the account used to forward."));
+       }
+
        hbox1 = gtk_hbox_new (FALSE, 32);
        gtk_widget_show (hbox1);
        gtk_box_pack_start (GTK_BOX (vbox_quote), hbox1, FALSE, FALSE, 0);
@@ -340,8 +448,10 @@ void quotefmt_create_forward_fmt_widgets(GtkWindow *parent_window,
        gtk_box_pack_start (GTK_BOX (hbox1), hbox2, FALSE, FALSE, 0);
 
        label_quotemark = gtk_label_new (_("Quotation mark"));
+       gtk_misc_set_alignment(GTK_MISC(label_quotemark), 1, 0.5);
        gtk_widget_show (label_quotemark);
        gtk_box_pack_start (GTK_BOX (hbox2), label_quotemark, FALSE, FALSE, 0);
+       gtk_size_group_add_widget(size_group, label_quotemark);
 
        entry_fw_quotemark = gtk_entry_new ();
        gtk_widget_show (entry_fw_quotemark);
@@ -376,12 +486,26 @@ void quotefmt_create_forward_fmt_widgets(GtkWindow *parent_window,
        gtk_text_view_set_editable (GTK_TEXT_VIEW (text_fw_quotefmt), TRUE);
        gtk_widget_set_size_request (text_fw_quotefmt, -1, 100);
 
+       if (checkbtn_forward_with_format) {
+               SET_TOGGLE_SENSITIVITY(checkbtn_use_format, label_quotemark);
+               SET_TOGGLE_SENSITIVITY(checkbtn_use_format, entry_fw_quotemark);
+               if (override_from_format) {
+                       SET_TOGGLE_SENSITIVITY(checkbtn_use_format, entry_from);
+                       SET_TOGGLE_SENSITIVITY(checkbtn_use_format, label_from);
+               }
+               SET_TOGGLE_SENSITIVITY(checkbtn_use_format, text_fw_quotefmt);
+       }
+
        if (add_info_button)
                quotefmt_add_info_button(parent_window, vbox_quote);
+       if (set_defaults_func)
+               quotefmt_add_defaults_button(parent_window, vbox_quote, set_defaults_func);
 
        if (checkbtn_forward_with_format)
                *checkbtn_forward_with_format = checkbtn_use_format;
        *edit_fw_quotemark = entry_fw_quotemark;
+       if (override_from_format)
+               *override_from_format = entry_from;
        *edit_fw_format = text_fw_quotefmt;
 }
 
@@ -392,7 +516,8 @@ void quotefmt_add_info_button(GtkWindow *parent_window, GtkWidget *parent_box)
 
        hbox_formatdesc = gtk_hbox_new (FALSE, 32);
        gtk_widget_show (hbox_formatdesc);
-       gtk_box_pack_start (GTK_BOX (parent_box), hbox_formatdesc, FALSE, FALSE, 0);
+       gtk_box_pack_start (GTK_BOX (parent_box), hbox_formatdesc, FALSE, FALSE,
+                               VBOX_BORDER);
 
 #if GTK_CHECK_VERSION(2, 8, 0)
        btn_formatdesc = gtk_button_new_from_stock(GTK_STOCK_INFO);
@@ -406,51 +531,85 @@ void quotefmt_add_info_button(GtkWindow *parent_window, GtkWidget *parent_box)
                         G_CALLBACK(quote_fmt_quote_description), GTK_WIDGET(parent_window));
 }
 
+void quotefmt_add_defaults_button(GtkWindow *parent_window,
+                                                                 GtkWidget *parent_box,
+                                                                 void(*set_defaults_func)(void))
+{
+       GtkWidget *hbox_formatdesc;
+       GtkWidget *btn_formatdesc;
+
+       cm_return_if_fail(set_defaults_func != NULL);
+
+       hbox_formatdesc = gtk_hbox_new (FALSE, 32);
+       gtk_widget_show (hbox_formatdesc);
+       gtk_box_pack_start (GTK_BOX (parent_box), hbox_formatdesc, FALSE, FALSE,
+                               VBOX_BORDER);
+
+       btn_formatdesc = gtk_button_new_with_mnemonic (_("Defaults"));
+       gtk_button_set_image (GTK_BUTTON(btn_formatdesc),
+               gtk_image_new_from_stock(GTK_STOCK_UNDO, GTK_ICON_SIZE_BUTTON));
+       gtk_widget_show (btn_formatdesc);
+       gtk_box_pack_start (GTK_BOX (hbox_formatdesc), btn_formatdesc, FALSE, FALSE, 0);
+       g_signal_connect(G_OBJECT(btn_formatdesc), "clicked",
+                        G_CALLBACK(set_defaults_func), GTK_WIDGET(parent_window));
+}
 
 void quotefmt_check_new_msg_formats(gboolean use_format,
-                                                                       gchar *subject_fmt,
-                                                                       gchar *body_fmt)
+                                   gchar *override_from_fmt,
+                                   gchar *subject_fmt,
+                                   gchar *body_fmt)
 {
        if (use_format) {
                gint line;
 
-               if (!prefs_template_string_is_valid(subject_fmt, NULL))
-                       alertpanel_error(_("New message subject format error."));
+               if (override_from_fmt && !prefs_template_string_is_valid(override_from_fmt, NULL, TRUE, TRUE))
+                       alertpanel_error(_("The \"From\" field of the \"New message\" template contains an invalid email address."));
 
-               if (!prefs_template_string_is_valid(body_fmt, &line)) {
-                       alertpanel_error(_("New message body format error at line %d."), line);
+               if (!prefs_template_string_is_valid(subject_fmt, NULL, TRUE, FALSE))
+                       alertpanel_error(_("The \"Subject\" field of the \"New message\" template is invalid."));
+
+               if (!prefs_template_string_is_valid(body_fmt, &line, TRUE, FALSE)) {
+                       alertpanel_error(_("The body of the \"New message\" template has an error at line %d."), line);
                }
        }
 }
 
 void quotefmt_check_reply_formats(gboolean use_format,
-                                                                       gchar *quotation_mark,
-                                                                       gchar *body_fmt)
+                                 gchar *override_from_fmt,
+                                 gchar *quotation_mark,
+                                 gchar *body_fmt)
 {
        if (use_format) {
                gint line;
 
-               if (!prefs_template_string_is_valid(quotation_mark, NULL))
-                       alertpanel_error(_("Message reply quotation mark format error."));
+               if (!prefs_template_string_is_valid(quotation_mark, NULL, TRUE, FALSE))
+                       alertpanel_error(_("The \"Quotation mark\" field of the \"Reply\" template is invalid."));
+
+               if (override_from_fmt && !prefs_template_string_is_valid(override_from_fmt, NULL, TRUE, TRUE))
+                       alertpanel_error(_("The \"From\" field of the \"Reply\" template contains an invalid email address."));
 
-               if (!prefs_template_string_is_valid(body_fmt, &line)) {
-                       alertpanel_error(_("Message reply format error at line %d."), line);
+               if (!prefs_template_string_is_valid(body_fmt, &line, TRUE, FALSE)) {
+                       alertpanel_error(_("The body of the \"Reply\" template has an error at line %d."), line);
                }
        }
 }
 
 void quotefmt_check_forward_formats(gboolean use_format,
-                                                                       gchar *quotation_mark,
-                                                                       gchar *body_fmt)
+                                   gchar *override_from_fmt,
+                                   gchar *quotation_mark,
+                                   gchar *body_fmt)
 {
        if (use_format) {
                gint line;
 
-               if (!prefs_template_string_is_valid(quotation_mark, NULL))
-                       alertpanel_error(_("Message forward quotation mark format error."));
+               if (!prefs_template_string_is_valid(quotation_mark, NULL, TRUE, FALSE))
+                       alertpanel_error(_("The \"Quotation mark\" field of the \"Forward\" template is invalid."));
+
+               if (override_from_fmt && !prefs_template_string_is_valid(override_from_fmt, NULL, TRUE, TRUE))
+                       alertpanel_error(_("The \"From\" field of the \"Forward\" template contains an invalid email address."));
 
-               if (!prefs_template_string_is_valid(body_fmt, &line)) {
-                       alertpanel_error(_("Message forward format error at line %d."), line);
+               if (!prefs_template_string_is_valid(body_fmt, &line, TRUE, FALSE)) {
+                       alertpanel_error(_("The body of the \"Forward\" template has an error at line %d."), line);
                }
        }
 }