Revert "Revert "Revert g9737584."" (but the fix) by reimplementing
authorwwp <wwp@free.fr>
Tue, 27 Dec 2016 14:11:00 +0000 (15:11 +0100)
committerwwp <wwp@free.fr>
Tue, 27 Dec 2016 14:11:00 +0000 (15:11 +0100)
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.

src/compose.c
src/messageview.c
src/plugins/address_keeper/address_keeper_prefs.c
src/prefs_folder_item.c

index 0be7a596d38a78031dbcdd2b32595a70fc1a91d0..d300cd69aacb1ebf87c102c61d3af0747b5247b9 100644 (file)
@@ -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);
                }
index f4ff32419e936d4014a341beb923f9f9720cfd8f..7c83afbf6731a39de67ca77502d2d4b0a7966425 100644 (file)
@@ -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;
        }
index 118899c8584bf3c1c02c4a5f427340b3ab479741..ae5b9bd353bbb6b95c657d31186a30cb858b09fc 100644 (file)
@@ -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;
index cc3905dc3847b6317a7bc007e36a9e155773c740..0da2f87bc2a7aa98c35c41945c8888f04cd70caf 100644 (file)
@@ -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,