talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit 571de7f50975c43f35cb6fc49b34856558b16d05
parent 6b68aee40d2e09580518069ad0f2ad5ac6f5bfbc
Author: wwp <wwp@free.fr>
Date:   Tue, 27 Dec 2016 15:11:00 +0100

Revert "Revert "Revert g9737584."" (but the fix) by reimplementing
the thing differently: don't mix printf() and C_() as it messes the
compiler up.
Factorize a bit format errors in compose.c.
Make some header names translatable following prefs in the
address keeper plugin.

Diffstat:
Msrc/compose.c | 26++++++++++++++++++++------
Msrc/messageview.c | 8+++++---
Msrc/plugins/address_keeper/address_keeper_prefs.c | 8+++++---
Msrc/prefs_folder_item.c | 31+++++++++++++++++++++----------
4 files changed, 51 insertions(+), 22 deletions(-)

diff --git a/src/compose.c b/src/compose.c @@ -8661,6 +8661,20 @@ static void compose_template_apply(Compose *compose, Template *tmpl, #endif } +static void compose_template_apply_fields_error(const gchar *header) +{ + gchar *tr; + gchar *text; + + tr = g_strdup(C_("'%s' stands for a header name", + "Template '%s' format error.")); + text = g_strdup_printf(tr, prefs_common_translated_header_name(header)); + alertpanel_error(text); + + g_free(text); + g_free(tr); +} + static void compose_template_apply_fields(Compose *compose, Template *tmpl) { MsgInfo* dummyinfo = NULL; @@ -8688,7 +8702,7 @@ static void compose_template_apply_fields(Compose *compose, Template *tmpl) buf = quote_fmt_get_buffer(); if (buf == NULL) { - alertpanel_error(_("Template From format error.")); + compose_template_apply_fields_error("From"); } else { gtk_entry_set_text(GTK_ENTRY(compose->from_name), buf); } @@ -8706,7 +8720,7 @@ static void compose_template_apply_fields(Compose *compose, Template *tmpl) buf = quote_fmt_get_buffer(); if (buf == NULL) { - alertpanel_error(_("Template To format error.")); + compose_template_apply_fields_error("To"); } else { compose_entry_append(compose, buf, COMPOSE_TO, PREF_TEMPLATE); } @@ -8724,7 +8738,7 @@ static void compose_template_apply_fields(Compose *compose, Template *tmpl) buf = quote_fmt_get_buffer(); if (buf == NULL) { - alertpanel_error(_("Template Cc format error.")); + compose_template_apply_fields_error("Cc"); } else { compose_entry_append(compose, buf, COMPOSE_CC, PREF_TEMPLATE); } @@ -8742,7 +8756,7 @@ static void compose_template_apply_fields(Compose *compose, Template *tmpl) buf = quote_fmt_get_buffer(); if (buf == NULL) { - alertpanel_error(_("Template Bcc format error.")); + compose_template_apply_fields_error("Bcc"); } else { compose_entry_append(compose, buf, COMPOSE_BCC, PREF_TEMPLATE); } @@ -8760,7 +8774,7 @@ static void compose_template_apply_fields(Compose *compose, Template *tmpl) buf = quote_fmt_get_buffer(); if (buf == NULL) { - alertpanel_error(_("Template Reply-To format error.")); + compose_template_apply_fields_error("Reply-To"); } else { compose_entry_append(compose, buf, COMPOSE_REPLYTO, PREF_TEMPLATE); } @@ -8779,7 +8793,7 @@ static void compose_template_apply_fields(Compose *compose, Template *tmpl) buf = quote_fmt_get_buffer(); if (buf == NULL) { - alertpanel_error(_("Template subject format error.")); + compose_template_apply_fields_error("Subject"); } else { gtk_entry_set_text(GTK_ENTRY(compose->subject_entry), buf); } diff --git a/src/messageview.c b/src/messageview.c @@ -864,13 +864,14 @@ static gint disposition_notification_send(MsgInfo *msginfo) if (ac_list == NULL) { AlertValue val; + gchar *tr; gchar *text; - text = g_strdup_printf( - C_("'%s' stands for 'To' then 'Cc'", + tr = g_strdup(C_("'%s' stands for 'To' then 'Cc'", "This message is asking for a return receipt notification\n" "but according to its '%s' and '%s' headers it was not\n" "officially addressed to you.\n" - "It is advised to not send the return receipt."), + "It is advised to not send the return receipt.")); + text = g_strdup_printf(tr, prefs_common_translated_header_name("To"), prefs_common_translated_header_name("Cc")); val = alertpanel_full(_("Warning"), @@ -878,6 +879,7 @@ static gint disposition_notification_send(MsgInfo *msginfo) _("_Don't Send"), _("_Send"), NULL, FALSE, NULL, ALERT_WARNING, G_ALERTDEFAULT); g_free(text); + g_free(tr); if (val != G_ALERTALTERNATE) return -1; } diff --git a/src/plugins/address_keeper/address_keeper_prefs.c b/src/plugins/address_keeper/address_keeper_prefs.c @@ -100,6 +100,7 @@ static void addkeeper_prefs_create_widget_func(PrefsPage * _page, GtkWidget *vbox; GtkTextBuffer *buffer; gchar *text; + gchar *tr; vbox = gtk_vbox_new(FALSE, 6); @@ -168,11 +169,12 @@ static void addkeeper_prefs_create_widget_func(PrefsPage * _page, gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(keep_bcc_checkbox), addkeeperprefs.keep_bcc_addrs); gtk_box_pack_start(GTK_BOX(keep_hbox), keep_bcc_checkbox, FALSE, FALSE, 0); gtk_widget_show(keep_bcc_checkbox); - text = g_strdup_printf(C_("address keeper: %s stands for a header name", - "Keep addresses which appear in '%s' headers"), - prefs_common_translated_header_name("Bcc")); + tr = g_strdup(C_("address keeper: %s stands for a header name", + "Keep addresses which appear in '%s' headers")); + text = g_strdup_printf(tr, prefs_common_translated_header_name("Bcc")); CLAWS_SET_TIP(keep_bcc_checkbox, text); g_free(text); + g_free(tr); gtk_widget_show(keep_bcc_checkbox); page->keep_bcc_addrs_check = keep_bcc_checkbox; diff --git a/src/prefs_folder_item.c b/src/prefs_folder_item.c @@ -816,6 +816,7 @@ static void prefs_folder_item_compose_create_widget_func(PrefsPage * page_, FolderItem *item = (FolderItem *) data; guint rowcount; gchar *text = NULL; + gchar *tr = NULL; GtkWidget *table; GtkWidget *label; @@ -919,14 +920,16 @@ static void prefs_folder_item_compose_create_widget_func(PrefsPage * page_, rowcount++; /* Default To */ - text = g_strdup_printf(C_("folder properties: %s stands for a header name", - "Default %s"), prefs_common_translated_header_name("To:")); + tr = g_strdup(C_("folder properties: %s stands for a header name", + "Default %s")); + text = g_strdup_printf(tr, prefs_common_translated_header_name("To:")); checkbtn_default_to = gtk_check_button_new_with_label(text); gtk_table_attach(GTK_TABLE(table), checkbtn_default_to, 0, 1, rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_default_to), item->prefs->enable_default_to); g_free(text); + g_free(tr); entry_default_to = gtk_entry_new(); gtk_table_attach(GTK_TABLE(table), entry_default_to, 1, 2, @@ -943,14 +946,16 @@ static void prefs_folder_item_compose_create_widget_func(PrefsPage * page_, rowcount++; /* Default address to reply to */ - text = g_strdup_printf(C_("folder properties: %s stands for a header name", - "Default %s for replies"), prefs_common_translated_header_name("To:")); + tr = g_strdup(C_("folder properties: %s stands for a header name", + "Default %s for replies")); + text = g_strdup_printf(tr, prefs_common_translated_header_name("To:")); checkbtn_default_reply_to = gtk_check_button_new_with_label(text); gtk_table_attach(GTK_TABLE(table), checkbtn_default_reply_to, 0, 1, rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_default_reply_to), item->prefs->enable_default_reply_to); g_free(text); + g_free(tr); entry_default_reply_to = gtk_entry_new(); gtk_table_attach(GTK_TABLE(table), entry_default_reply_to, 1, 2, @@ -967,14 +972,16 @@ static void prefs_folder_item_compose_create_widget_func(PrefsPage * page_, rowcount++; /* Default Cc */ - text = g_strdup_printf(C_("folder properties: %s stands for a header name", - "Default %s"), prefs_common_translated_header_name("Cc:")); + tr = g_strdup(C_("folder properties: %s stands for a header name", + "Default %s")); + text = g_strdup_printf(tr, prefs_common_translated_header_name("Cc:")); checkbtn_default_cc = gtk_check_button_new_with_label(text); gtk_table_attach(GTK_TABLE(table), checkbtn_default_cc, 0, 1, rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_default_cc), item->prefs->enable_default_cc); g_free(text); + g_free(tr); entry_default_cc = gtk_entry_new(); gtk_table_attach(GTK_TABLE(table), entry_default_cc, 1, 2, @@ -991,14 +998,16 @@ static void prefs_folder_item_compose_create_widget_func(PrefsPage * page_, rowcount++; /* Default Bcc */ - text = g_strdup_printf(C_("folder properties: %s stands for a header name", - "Default %s"), prefs_common_translated_header_name("Bcc:")); + tr = g_strdup(C_("folder properties: %s stands for a header name", + "Default %s")); + text = g_strdup_printf(tr, prefs_common_translated_header_name("Bcc:")); checkbtn_default_bcc = gtk_check_button_new_with_label(text); gtk_table_attach(GTK_TABLE(table), checkbtn_default_bcc, 0, 1, rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_default_bcc), item->prefs->enable_default_bcc); g_free(text); + g_free(tr); entry_default_bcc = gtk_entry_new(); gtk_table_attach(GTK_TABLE(table), entry_default_bcc, 1, 2, @@ -1015,14 +1024,16 @@ static void prefs_folder_item_compose_create_widget_func(PrefsPage * page_, rowcount++; /* Default Reply-to */ - text = g_strdup_printf(C_("folder properties: %s stands for a header name", - "Default %s"), prefs_common_translated_header_name("Reply-To:")); + tr = g_strdup(C_("folder properties: %s stands for a header name", + "Default %s")); + text = g_strdup_printf(tr, prefs_common_translated_header_name("Reply-To:")); checkbtn_default_replyto = gtk_check_button_new_with_label(text); gtk_table_attach(GTK_TABLE(table), checkbtn_default_replyto, 0, 1, rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_default_replyto), item->prefs->enable_default_replyto); g_free(text); + g_free(tr); entry_default_replyto = gtk_entry_new(); gtk_table_attach(GTK_TABLE(table), entry_default_replyto, 1, 2,