2007-09-23 [paul] 3.0.1cvs25
[claws.git] / src / quote_fmt.c
index 4668a35eed7f01e7a128358ef74452ecbb1cfa91..1c42131f37122f44bdfaff29521510364f14b2fa 100644 (file)
@@ -4,7 +4,7 @@
  *
  * 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
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
@@ -13,8 +13,8 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * 
  */
 
 #ifdef HAVE_CONFIG_H
@@ -62,10 +62,11 @@ static gchar *quote_desc_strings[] = {
        "%quoted_msg (%Q)",                     N_("quoted message body"), /* quoted message */
        "%msg_no_sig (%m)",                     N_("message body without signature"), /* message with no signature */
        "%quoted_msg_no_sig (%q)",      N_("quoted message body without signature"), /* quoted message with no signature */
+       "%tags",                                N_("message tags"), /* message tags */
        "%dict (%T)",                           N_("current dictionary"), /* current dictionary */
        "%cursor (%X)",                         N_("cursor position"), /* X marks the cursor spot */
        "%account_fullname (%af)",      N_("account property: your name"), /* full name in compose account */
-       "%account_email (%ae)",         N_("account property: your email address"), /* mail address in compose account */
+       "%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_dict (%aT)",          N_("account property: default dictionary"), /* main dict (if enabled) in account */
@@ -115,13 +116,11 @@ 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 **edit_subject_format,
                                                GtkWidget **edit_body_format,
                                                gboolean add_info_button)
 {
        GtkWidget *checkbtn_use_format = NULL;
-       GtkWidget *frame_format;
        GtkWidget *vbox_format;
        GtkWidget *hbox_format;
        GtkWidget *label_subject;
@@ -132,21 +131,20 @@ void quotefmt_create_new_msg_fmt_widgets(GtkWindow *parent_window,
        if (add_info_button)
                g_return_if_fail(parent_window != NULL);
        g_return_if_fail(parent_box != NULL);
-       if (checkbtn_compose_with_format) {
+       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);
 
        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);
-
-       if (checkbtn_compose_with_format)
-               SET_TOGGLE_SENSITIVITY(checkbtn_use_format, frame_format);
+       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);
 
        hbox_format = gtk_hbox_new (FALSE, 8);
        gtk_widget_show (hbox_format);
@@ -187,6 +185,12 @@ 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);
+               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);
 
@@ -199,13 +203,11 @@ 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 **edit_reply_quotemark,
                                                GtkWidget **edit_reply_format,
                                                gboolean add_info_button)
 {
        GtkWidget *checkbtn_use_format = NULL;
-       GtkWidget *frame_quote;
        GtkWidget *vbox_quote;
        GtkWidget *hbox1;
        GtkWidget *hbox2;
@@ -217,24 +219,19 @@ void quotefmt_create_reply_fmt_widgets(GtkWindow *parent_window,
        if (add_info_button)
                g_return_if_fail(parent_window != NULL);
        g_return_if_fail(parent_box != NULL);
-       if (checkbtn_reply_with_format) {
+       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);
 
        if (checkbtn_reply_with_format)
-               PACK_CHECK_BUTTON (parent_box, checkbtn_use_format, checkbtn_reply_text);
-
-       PACK_FRAME (parent_box, frame_quote, _("Reply format"));
-
-       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);
 
        hbox1 = gtk_hbox_new (FALSE, 32);
@@ -280,6 +277,12 @@ 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);
+               SET_TOGGLE_SENSITIVITY(checkbtn_use_format, text_quotefmt);
+       }
+
        if (add_info_button)
                quotefmt_add_info_button(parent_window, vbox_quote);
 
@@ -292,13 +295,11 @@ void quotefmt_create_reply_fmt_widgets(GtkWindow *parent_window,
 void quotefmt_create_forward_fmt_widgets(GtkWindow *parent_window,
                                                GtkWidget *parent_box,
                                                GtkWidget **checkbtn_forward_with_format,
-                                               gchar *checkbtn_forward_text,
                                                GtkWidget **edit_fw_quotemark,
                                                GtkWidget **edit_fw_format,
                                                gboolean add_info_button)
 {
        GtkWidget *checkbtn_use_format = NULL;
-       GtkWidget *frame_quote;
        GtkWidget *vbox_quote;
        GtkWidget *hbox1;
        GtkWidget *hbox2;
@@ -312,22 +313,17 @@ void quotefmt_create_forward_fmt_widgets(GtkWindow *parent_window,
        g_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);
        }
        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);
-
-       PACK_FRAME (parent_box, frame_quote, _("Forward format"));
-
-       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);
 
        hbox1 = gtk_hbox_new (FALSE, 32);
@@ -375,6 +371,12 @@ 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);
+               SET_TOGGLE_SENSITIVITY(checkbtn_use_format, text_fw_quotefmt);
+       }
+
        if (add_info_button)
                quotefmt_add_info_button(parent_window, vbox_quote);
 
@@ -391,7 +393,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);
@@ -410,41 +413,46 @@ 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)) {
+                       alertpanel_error(_("New message body format error at line %d."), line);
+               }
        }
 }
 
 void quotefmt_check_reply_formats(gboolean use_format,
+                                                                       gchar *quotation_mark,
                                                                        gchar *body_fmt)
 {
-       gint line;
+       if (use_format) {
+               gint line;
 
-       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(quotation_mark, NULL))
+                       alertpanel_error(_("Message reply quotation mark format error."));
+
+               if (!prefs_template_string_is_valid(body_fmt, &line)) {
+                       alertpanel_error(_("Message reply format error at line %d."), line);
+               }
        }
 }
 
 void quotefmt_check_forward_formats(gboolean use_format,
+                                                                       gchar *quotation_mark,
                                                                        gchar *body_fmt)
 {
-       gint line;
+       if (use_format) {
+               gint line;
 
-       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(quotation_mark, NULL))
+                       alertpanel_error(_("Message forward quotation mark format error."));
+
+               if (!prefs_template_string_is_valid(body_fmt, &line)) {
+                       alertpanel_error(_("Message forward format error at line %d."), line);
+               }
        }
 }