2007-04-20 [wwp] 2.9.1cvs5
authorTristan Chabredier <wwp@claws-mail.org>
Fri, 20 Apr 2007 14:54:54 +0000 (14:54 +0000)
committerTristan Chabredier <wwp@claws-mail.org>
Fri, 20 Apr 2007 14:54:54 +0000 (14:54 +0000)
* po/POTFILES.in
* src/addressbook.c
* src/compose.c
* src/filtering.c
* src/headerview.c
* src/matcher.c
* src/prefs_common.c
* src/prefs_common.h
* src/prefs_display_header.c
* src/prefs_matcher.c
* src/summaryview.c
* src/gtk/headers.h
* src/gtk/quicksearch.c
Translate more header names according to the relevant option value,
mostly in filtering debug messages (reported by Tim <timbrain@post.cz>).
Replaced nearly all uses of prefs_common.trans_hdr with a call
to prefs_common_translated_header_name().
Added a headers.h reference file that contains known header names
(RFC2822 and others) to the translation process' input, so that
translated header names will still exist even if no occurrence of
_("headername") is found anymore in the sources.
Don't translate column name 'Number' following to trans_hdr option
value as it's not a header name.

16 files changed:
ChangeLog
PATCHSETS
configure.ac
po/POTFILES.in
src/addressbook.c
src/compose.c
src/filtering.c
src/gtk/headers.h [new file with mode: 0644]
src/gtk/quicksearch.c
src/headerview.c
src/matcher.c
src/prefs_common.c
src/prefs_common.h
src/prefs_display_header.c
src/prefs_matcher.c
src/summaryview.c

index 36f3c4c..eb5da56 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,29 @@
+2007-04-20 [wwp]       2.9.1cvs5
+
+       * po/POTFILES.in
+       * src/addressbook.c
+       * src/compose.c
+       * src/filtering.c
+       * src/headerview.c
+       * src/matcher.c
+       * src/prefs_common.c
+       * src/prefs_common.h
+       * src/prefs_display_header.c
+       * src/prefs_matcher.c
+       * src/summaryview.c
+       * src/gtk/headers.h
+       * src/gtk/quicksearch.c
+               Translate more header names according to the relevant option value,
+               mostly in filtering debug messages (reported by Tim <timbrain@post.cz>).
+               Replaced nearly all uses of prefs_common.trans_hdr with a call
+               to prefs_common_translated_header_name().
+               Added a headers.h reference file that contains known header names
+               (RFC2822 and others) to the translation process' input, so that
+               translated header names will still exist even if no occurrence of
+               _("headername") is found anymore in the sources.
+               Don't translate column name 'Number' following to trans_hdr option
+               value as it's not a header name.
+
 2007-04-20 [colin]     2.9.1cvs4
 
        * src/gtk/quicksearch.c
index dcfb263..2a95156 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.16.2.27 -r 1.16.2.28 src/prefs_display_header.c;  cvs diff -u -r 1.3.12.27 -r 1.3.12.28 src/message_search.c;  ) > 2.9.1cvs2.patchset
 ( cvs diff -u -r 1.75.2.39 -r 1.75.2.40 src/matcher.c;  ) > 2.9.1cvs3.patchset
 ( cvs diff -u -r 1.1.2.66 -r 1.1.2.67 src/gtk/quicksearch.c;  cvs diff -u -r 1.1.2.13 -r 1.1.2.14 src/gtk/quicksearch.h;  ) > 2.9.1cvs4.patchset
+( cvs diff -u -r 1.53.2.25 -r 1.53.2.26 po/POTFILES.in;  cvs diff -u -r 1.60.2.86 -r 1.60.2.87 src/addressbook.c;  cvs diff -u -r 1.382.2.370 -r 1.382.2.371 src/compose.c;  cvs diff -u -r 1.60.2.31 -r 1.60.2.32 src/filtering.c;  cvs diff -u -r 1.8.2.19 -r 1.8.2.20 src/headerview.c;  cvs diff -u -r 1.75.2.40 -r 1.75.2.41 src/matcher.c;  cvs diff -u -r 1.204.2.130 -r 1.204.2.131 src/prefs_common.c;  cvs diff -u -r 1.103.2.80 -r 1.103.2.81 src/prefs_common.h;  cvs diff -u -r 1.16.2.28 -r 1.16.2.29 src/prefs_display_header.c;  cvs diff -u -r 1.43.2.56 -r 1.43.2.57 src/prefs_matcher.c;  cvs diff -u -r 1.395.2.296 -r 1.395.2.297 src/summaryview.c;  diff -u /dev/null src/gtk/headers.h;  cvs diff -u -r 1.1.2.67 -r 1.1.2.68 src/gtk/quicksearch.c;  ) > 2.9.1cvs5.patchset
index 4e5b99c..14eb9c9 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=1
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=4
+EXTRA_VERSION=5
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index c771518..00f0df2 100644 (file)
@@ -42,6 +42,7 @@ src/gtk/colorlabel.c
 src/gtk/foldersort.c
 src/gtk/gtkaspell.c
 src/gtk/gtksourceprintjob.c
+src/gtk/headers.h
 src/gtk/icon_legend.c
 src/gtk/inputdialog.c
 src/gtk/logwindow.c
index eacbc6a..55290db 100644 (file)
@@ -1131,15 +1131,15 @@ static void addressbook_create(void)
                         G_CALLBACK(addressbook_lup_clicked), NULL);
 
        to_btn = gtk_button_new_with_label
-               (prefs_common.trans_hdr ? _("To:") : "To:");
+               (prefs_common_translated_header_name("To:"));
        GTK_WIDGET_SET_FLAGS(to_btn, GTK_CAN_DEFAULT);
        gtk_box_pack_start(GTK_BOX(hbbox), to_btn, TRUE, TRUE, 0);
        cc_btn = gtk_button_new_with_label
-               (prefs_common.trans_hdr ? _("Cc:") : "Cc:");
+               (prefs_common_translated_header_name("Cc:"));
        GTK_WIDGET_SET_FLAGS(cc_btn, GTK_CAN_DEFAULT);
        gtk_box_pack_start(GTK_BOX(hbbox), cc_btn, TRUE, TRUE, 0);
        bcc_btn = gtk_button_new_with_label
-               (prefs_common.trans_hdr ? _("Bcc:") : "Bcc:");
+               (prefs_common_translated_header_name("Bcc:"));
        GTK_WIDGET_SET_FLAGS(bcc_btn, GTK_CAN_DEFAULT);
        gtk_box_pack_start(GTK_BOX(hbbox), bcc_btn, TRUE, TRUE, 0);
 
index 5972f75..db51222 100644 (file)
@@ -2131,7 +2131,7 @@ void compose_entry_append(Compose *compose, const gchar *address,
                header = N_("To:");
                break;
        }
-       header = prefs_common.trans_hdr ? gettext(header) : header;
+       header = prefs_common_translated_header_name(header);
        
        cur = begin = (gchar *)address;
        
@@ -4183,13 +4183,13 @@ gboolean compose_check_for_valid_recipient(Compose *compose) {
                g_strstrip(entry);
                if (entry[0] != '\0') {
                        for (strptr = recipient_headers_mail; *strptr != NULL; strptr++) {
-                               if (!strcmp(header, (prefs_common.trans_hdr ? gettext(*strptr) : *strptr))) {
+                               if (!strcmp(header, prefs_common_translated_header_name(*strptr))) {
                                        compose->to_list = address_list_append(compose->to_list, entry);
                                        recipient_found = TRUE;
                                }
                        }
                        for (strptr = recipient_headers_news; *strptr != NULL; strptr++) {
-                               if (!strcmp(header, (prefs_common.trans_hdr ? gettext(*strptr) : *strptr))) {
+                               if (!strcmp(header, prefs_common_translated_header_name(*strptr))) {
                                        compose->newsgroup_list = newsgroup_list_append(compose->newsgroup_list, entry);
                                        recipient_found = TRUE;
                                }
@@ -4214,7 +4214,7 @@ static gboolean compose_check_for_set_recipients(Compose *compose)
                        header = gtk_editable_get_chars(GTK_EDITABLE(GTK_COMBO(((ComposeHeaderEntry *)list->data)->combo)->entry), 0, -1);
                        g_strstrip(entry);
                        if (strcmp(entry, compose->account->auto_cc)
-                       ||  strcmp(header, (prefs_common.trans_hdr ? gettext("Cc:") : "Cc:"))) {
+                       ||  strcmp(header, prefs_common_translated_header_name("Cc:"))) {
                                found_other = TRUE;
                                g_free(entry);
                                break;
@@ -4245,7 +4245,7 @@ static gboolean compose_check_for_set_recipients(Compose *compose)
                        header = gtk_editable_get_chars(GTK_EDITABLE(GTK_COMBO(((ComposeHeaderEntry *)list->data)->combo)->entry), 0, -1);
                        g_strstrip(entry);
                        if (strcmp(entry, compose->account->auto_bcc)
-                       ||  strcmp(header, (prefs_common.trans_hdr ? gettext("Bcc:") : "Bcc:"))) {
+                       ||  strcmp(header, prefs_common_translated_header_name("Bcc:"))) {
                                found_other = TRUE;
                                g_free(entry);
                                break;
@@ -4477,8 +4477,8 @@ static gint compose_redirect_write_headers_from_headerlist(Compose *compose,
 
        debug_print("Writing redirect header\n");
 
-       cc_hdr = prefs_common.trans_hdr ? _("Cc:") : "Cc:";
-       to_hdr = prefs_common.trans_hdr ? _("To:") : "To:";
+       cc_hdr = prefs_common_translated_header_name("Cc:");
+       to_hdr = prefs_common_translated_header_name("To:");
 
        first_to_address = TRUE;
        for (list = compose->header_list; list; list = list->next) {
@@ -5312,7 +5312,7 @@ static void compose_add_headerfield_from_headerlist(Compose *compose,
        fieldstr = g_string_sized_new(64);
 
        fieldname_w_colon = g_strconcat(fieldname, ":", NULL);
-       trans_fieldname = (prefs_common.trans_hdr ? gettext(fieldname_w_colon) : fieldname_w_colon);
+       trans_fieldname = prefs_common_translated_header_name(fieldname_w_colon);
 
        for (list = compose->header_list; list; list = list->next) {
                headerentry = ((ComposeHeaderEntry *)list->data);
@@ -5574,7 +5574,7 @@ static gchar *compose_get_header(Compose *compose)
                subst_char(headervalue, '\n', ' ');
                string = std_headers;
                while (*string != NULL) {
-                       headername_trans = prefs_common.trans_hdr ? gettext(*string) : *string;
+                       headername_trans = prefs_common_translated_header_name(*string);
                        if (!strcmp(headername_trans,headername_wcolon))
                                standard_header = TRUE;
                        string++;
@@ -5717,7 +5717,7 @@ static void compose_create_header_entry(Compose *compose)
        combo = gtk_combo_new();
        string = headers; 
        while(*string != NULL) {
-               combo_list = g_list_append(combo_list, (prefs_common.trans_hdr ? gettext(*string) : *string));
+               combo_list = g_list_append(combo_list, prefs_common_translated_header_name(*string));
                string++;
        }
        gtk_combo_set_popdown_strings(GTK_COMBO(combo), combo_list);
@@ -5744,10 +5744,10 @@ static void compose_create_header_entry(Compose *compose)
        if (!compose->header_last || !standard_header) {
                switch(compose->account->protocol) {
                        case A_NNTP:
-                               header = prefs_common.trans_hdr ? _("Newsgroups:") : "Newsgroups:";
+                               header = prefs_common_translated_header_name("Newsgroups:");
                                break;
                        default:
-                               header = prefs_common.trans_hdr ? _("To:") : "To:";
+                               header = prefs_common_translated_header_name("To:");
                                break;
                }                                                                   
        }
@@ -6566,9 +6566,11 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode,
        menu_set_sensitive(ifactory, "/Options/Reply mode", compose->mode == COMPOSE_REPLY);
 
        if (account->protocol != A_NNTP)
-               gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(compose->header_last->combo)->entry), prefs_common.trans_hdr ? _("To:") : "To:");
+               gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(compose->header_last->combo)->entry),
+                               prefs_common_translated_header_name("To:"));
        else
-               gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(compose->header_last->combo)->entry), prefs_common.trans_hdr ? _("Newsgroups:") : "Newsgroups:");
+               gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(compose->header_last->combo)->entry),
+                               prefs_common_translated_header_name("Newsgroups:"));
 
        addressbook_set_target_compose(compose);
        
@@ -9698,7 +9700,7 @@ static MsgInfo *compose_msginfo_new_from_compose(Compose *compose)
                gchar *entry = gtk_editable_get_chars(
                                                                GTK_EDITABLE(((ComposeHeaderEntry *)list->data)->entry), 0, -1);
 
-               if ( strcasecmp(header, (prefs_common.trans_hdr ? gettext("To:") : "To:")) == 0 ) {
+               if ( strcasecmp(header, prefs_common_translated_header_name("To:")) == 0 ) {
                        if ( newmsginfo->to == NULL ) {
                                newmsginfo->to = g_strdup(entry);
                        } else {
@@ -9707,7 +9709,7 @@ static MsgInfo *compose_msginfo_new_from_compose(Compose *compose)
                                newmsginfo->to = tmp;
                        }
                } else
-               if ( strcasecmp(header, (prefs_common.trans_hdr ? gettext("Cc:") : "Cc:")) == 0 ) {
+               if ( strcasecmp(header, prefs_common_translated_header_name("Cc:")) == 0 ) {
                        if ( newmsginfo->cc == NULL ) {
                                newmsginfo->cc = g_strdup(entry);
                        } else {
@@ -9717,7 +9719,7 @@ static MsgInfo *compose_msginfo_new_from_compose(Compose *compose)
                        }
                } else
                if ( strcasecmp(header,
-                                               (prefs_common.trans_hdr ? gettext("Newsgroups:") : "Newsgroups:")) == 0 ) {
+                                               prefs_common_translated_header_name("Newsgroups:")) == 0 ) {
                        if ( newmsginfo->newsgroups == NULL ) {
                                newmsginfo->newsgroups = g_strdup(entry);
                        } else {
index 5dc72a7..e8b0737 100644 (file)
@@ -839,10 +839,12 @@ gboolean filter_message_by_msginfo(GSList *flist, MsgInfo *info, PrefsAccount* a
                        if (prefs_common.filtering_debug_level >= FILTERING_DEBUG_LEVEL_MED) {
                                log_print(LOG_DEBUG_FILTERING,
                                                _("filtering message (%s%s%s)\n"
-                                               "%smessage file: %s\n%sDate: %s\n%sFrom: %s\n%sTo: %s\n%sSubject: %s\n"),
+                                               "%smessage file: %s\n%s%s %s\n%s%s %s\n%s%s %s\n%s%s %s\n"),
                                                tmp, extra_info ? _(": ") : "", extra_info ? extra_info : "",
-                                               spc, file, spc, info->date, spc, info->from,
-                                               spc, info->to, spc, info->subject);
+                                               spc, file, spc, prefs_common_translated_header_name("Date:"), info->date,
+                                               spc, prefs_common_translated_header_name("From:"), info->from,
+                                               spc, prefs_common_translated_header_name("To:"), info->to,
+                                               spc, prefs_common_translated_header_name("Subject:"), info->subject);
                        } else {
                                log_print(LOG_DEBUG_FILTERING,
                                                _("filtering message (%s%s%s)\n"
diff --git a/src/gtk/headers.h b/src/gtk/headers.h
new file mode 100644 (file)
index 0000000..823c755
--- /dev/null
@@ -0,0 +1,65 @@
+/* all header names, with or without trailing colon */
+static struct {
+       const gchar *header_name;
+       const gchar *header_name_w_colon;
+} HEADERS[] = {
+
+       /* RFC2822 */
+       { N_("Date"),                                             N_("Date:") },
+       { N_("From"),                                             N_("From:") },
+       { N_("Sender"),                                           N_("Sender:") },
+       { N_("Reply-To"),                                         N_("Reply-To:") },
+       { N_("To"),                                               N_("To:") },
+       { N_("Cc"),                                               N_("Cc:") },
+       { N_("Bcc"),                                              N_("Bcc:") },
+       { N_("Message-ID"),                               N_("Message-ID:") },
+       { N_("In-Reply-To"),                              N_("In-Reply-To:") },
+       { N_("References"),                               N_("References:") },
+       { N_("Subject"),                                          N_("Subject:") },
+       { N_("Comments"),                                         N_("Comments:") },
+       { N_("Keywords"),                                         N_("Keywords:") },
+       { N_("Resent-Date"),                              N_("Resent-Date:") },
+       { N_("Resent-From"),                              N_("Resent-From:") },
+       { N_("Resent-Sender"),                            N_("Resent-Sender:") },
+       { N_("Resent-To"),                                        N_("Resent-To:") },
+       { N_("Resent-Cc"),                                        N_("Resent-Cc:") },
+       { N_("Resent-Bcc"),                               N_("Resent-Bcc:") },
+       { N_("Resent-Message-ID"),                        N_("Resent-Message-ID:") },
+       { N_("Return-Path"),                              N_("Return-Path:") },
+       { N_("Received"),                                         N_("Received:") },
+
+       /* more */
+       { N_("Newsgroups"),                               N_("Newsgroups:") },
+       { N_("Followup-To"),                              N_("Followup-To:") },
+       { N_("Delivered-To"),                             N_("Delivered-To:") },
+       { N_("Seen"),                                             N_("Seen:") },
+       { N_("Status"),                                           N_("Status:") },
+       { N_("Face"),                                             N_("Face:") },
+       { N_("Disposition-Notification-To"),  N_("Disposition-Notification-To:") },
+       { N_("Return-Receipt-To"),                        N_("Return-Receipt-To:") },
+       { N_("User-Agent"),                               N_("User-Agent:") },
+       { N_("Content-Type"),                             N_("Content-Type:") },
+       { N_("Content-Transfert-Encoding"),   N_("Content-Transfert-Encoding:") },
+       { N_("MIME-Version"),                             N_("MIME-Version:") },
+       { N_("Precedence"),                               N_("Precedence:") },
+       { N_("Organization"),                             N_("Organization:") },
+
+       { N_("Mailing-List"),                             N_("Mailing-List:") },
+       { N_("List-Post"),                                        N_("List-Post:") },
+       { N_("List-Subscribe"),                           N_("List-Subscribe:") },
+       { N_("List-Unsubscribe"),                         N_("List-Unsubscribe:") },
+       { N_("List-Help"),                                        N_("List-Help:") },
+       { N_("List-Archive"),                             N_("List-Archive:") },
+       { N_("List-Owner"),                               N_("List-Owner:") },
+
+       { N_("X-Label"),                                          N_("X-Label:") },
+       { N_("X-Mailer"),                                         N_("X-Mailer:") },
+       { N_("X-Status"),                                         N_("X-Status:") },
+       { N_("X-Face"),                                           N_("X-Face:") },
+       { N_("X-No-Archive"),                             N_("X-No-Archive:") },
+
+/* some common logical names referring to real header names */
+       { N_("In reply to"),                              N_("In reply to:") },
+       { N_("To or Cc"),                                         N_("To or Cc:") },
+       { N_("From, To or Subject"),              N_("From, To or Subject:") },
+};
index ed3b7c4..fdf7540 100644 (file)
@@ -482,19 +482,23 @@ QuickSearch *quicksearch_new()
        gtk_box_pack_start(GTK_BOX(hbox_search), search_type_opt, FALSE, FALSE, 0);
 
        search_type = gtk_menu_new();
-       MENUITEM_ADD (search_type, menuitem, _("Subject"), QUICK_SEARCH_SUBJECT);
+       MENUITEM_ADD (search_type, menuitem,
+                       prefs_common_translated_header_name("Subject"), QUICK_SEARCH_SUBJECT);
        g_signal_connect(G_OBJECT(menuitem), "activate",
                         G_CALLBACK(searchtype_changed),
                         quicksearch);
-       MENUITEM_ADD (search_type, menuitem, _("From"), QUICK_SEARCH_FROM);
+       MENUITEM_ADD (search_type, menuitem,
+                       prefs_common_translated_header_name("From"), QUICK_SEARCH_FROM);
        g_signal_connect(G_OBJECT(menuitem), "activate",
                         G_CALLBACK(searchtype_changed),
                         quicksearch);
-       MENUITEM_ADD (search_type, menuitem, _("To"), QUICK_SEARCH_TO);
+       MENUITEM_ADD (search_type, menuitem,
+                       prefs_common_translated_header_name("To"), QUICK_SEARCH_TO);
        g_signal_connect(G_OBJECT(menuitem), "activate",
                         G_CALLBACK(searchtype_changed),
                         quicksearch);
-       MENUITEM_ADD (search_type, menuitem, _("From, To or Subject"), QUICK_SEARCH_MIXED);
+       MENUITEM_ADD (search_type, menuitem,
+                       prefs_common_translated_header_name("From, To or Subject"), QUICK_SEARCH_MIXED);
        g_signal_connect(G_OBJECT(menuitem), "activate",
                         G_CALLBACK(searchtype_changed),
                         quicksearch);
index c69c625..22b2321 100644 (file)
@@ -48,8 +48,7 @@
 #include "gtkutils.h"
 #include "utils.h"
 #include "base64.h"
-
-#define TR(str)        (prefs_common.trans_hdr ? gettext(str) : str)
+#include "headers.h"
 
 #if HAVE_LIBCOMPFACE
 #define XPM_XFACE_HEIGHT       (HEIGHT + 3)  /* 3 = 1 header + 2 colors */
@@ -92,13 +91,13 @@ HeaderView *headerview_create(void)
        hbox2 = gtk_hbox_new(FALSE, 4);
        gtk_box_pack_start(GTK_BOX(vbox), hbox2, FALSE, FALSE, 0);
 
-       from_header_label    = gtk_label_new(TR("From:"));
+       from_header_label    = gtk_label_new(prefs_common_translated_header_name("From:"));
        from_body_label      = gtk_label_new("");
-       to_header_label      = gtk_label_new(TR("To:"));
+       to_header_label      = gtk_label_new(prefs_common_translated_header_name("To:"));
        to_body_label        = gtk_label_new("");
-       ng_header_label      = gtk_label_new(TR("Newsgroups:"));
+       ng_header_label      = gtk_label_new(prefs_common_translated_header_name("Newsgroups:"));
        ng_body_label        = gtk_label_new("");
-       subject_header_label = gtk_label_new(TR("Subject:"));
+       subject_header_label = gtk_label_new(prefs_common_translated_header_name("Subject:"));
        subject_body_label   = gtk_label_new("");
 
        gtk_label_set_selectable(GTK_LABEL(from_body_label), TRUE);
index f10b015..5cc8f59 100644 (file)
@@ -768,27 +768,70 @@ gboolean matcherprop_match(MatcherProp *prop,
        case MATCHCRITERIA_NOT_IGNORE_THREAD:
                return !MSG_IS_IGNORE_THREAD(info->flags);
        case MATCHCRITERIA_SUBJECT:
-               return matcherprop_string_match(prop, info->subject, _("subject"));
+               return matcherprop_string_match(prop, info->subject,
+                                               prefs_common_translated_header_name("Subject:"));
        case MATCHCRITERIA_NOT_SUBJECT:
-               return !matcherprop_string_match(prop, info->subject, _("subject"));
+               return !matcherprop_string_match(prop, info->subject,
+                                               prefs_common_translated_header_name("Subject:"));
        case MATCHCRITERIA_FROM:
-               return matcherprop_string_match(prop, info->from, _("From: header"));
        case MATCHCRITERIA_NOT_FROM:
-               return !matcherprop_string_match(prop, info->from, _("From: header"));
+       {
+               gchar *context;
+               gboolean ret;
+
+               context = g_strdup_printf(_("%s header"), prefs_common_translated_header_name("From:"));
+               ret = matcherprop_string_match(prop, info->from, context);
+               g_free(context);
+               return (prop->criteria == MATCHCRITERIA_FROM)? ret : !ret;
+       }
        case MATCHCRITERIA_TO:
-               return matcherprop_string_match(prop, info->to, _("To: header"));
        case MATCHCRITERIA_NOT_TO:
-               return !matcherprop_string_match(prop, info->to, _("To: header"));
+       {
+               gchar *context;
+               gboolean ret;
+
+               context = g_strdup_printf(_("%s header"), prefs_common_translated_header_name("To:"));
+               ret = matcherprop_string_match(prop, info->to, context);
+               g_free(context);
+               return (prop->criteria == MATCHCRITERIA_TO)? ret : !ret;
+       }
        case MATCHCRITERIA_CC:
-               return matcherprop_string_match(prop, info->cc, _("Cc: header"));
        case MATCHCRITERIA_NOT_CC:
-               return !matcherprop_string_match(prop, info->cc, _("Cc: header"));
+       {
+               gchar *context;
+               gboolean ret;
+
+               context = g_strdup_printf(_("%s header"), prefs_common_translated_header_name("Cc:"));
+               ret = matcherprop_string_match(prop, info->cc, context);
+               g_free(context);
+               return (prop->criteria == MATCHCRITERIA_CC)? ret : !ret;
+       }
        case MATCHCRITERIA_TO_OR_CC:
-               return matcherprop_string_match(prop, info->to, _("To: header"))
-                       || matcherprop_string_match(prop, info->cc, _("Cc: header"));
+       {
+               gchar *context1, *context2;
+               gboolean ret;
+
+               context1 = g_strdup_printf(_("%s header"), prefs_common_translated_header_name("To:"));
+               context2 = g_strdup_printf(_("%s header"), prefs_common_translated_header_name("Cc:"));
+               ret = matcherprop_string_match(prop, info->to, context1)
+                       || matcherprop_string_match(prop, info->cc, context2);
+               g_free(context1);
+               g_free(context2);
+               return ret;
+       }
        case MATCHCRITERIA_NOT_TO_AND_NOT_CC:
-               return !(matcherprop_string_match(prop, info->to, _("To:"))
-               || matcherprop_string_match(prop, info->cc, _("Cc:")));
+       {
+               gchar *context1, *context2;
+               gboolean ret;
+
+               context1 = g_strdup_printf(_("%s header"), prefs_common_translated_header_name("To:"));
+               context2 = g_strdup_printf(_("%s header"), prefs_common_translated_header_name("Cc:"));
+               ret = !(matcherprop_string_match(prop, info->to, context1)
+                       || matcherprop_string_match(prop, info->cc, context2));
+               g_free(context1);
+               g_free(context2);
+               return ret;
+       }
        case MATCHCRITERIA_AGE_GREATER:
        {
                gboolean ret;
@@ -993,17 +1036,41 @@ gboolean matcherprop_match(MatcherProp *prop,
                return ret;
        }
        case MATCHCRITERIA_NEWSGROUPS:
-               return matcherprop_string_match(prop, info->newsgroups, _("Newsgroups: header"));
        case MATCHCRITERIA_NOT_NEWSGROUPS:
-               return !matcherprop_string_match(prop, info->newsgroups, _("Newsgroups: header"));
+       {
+               gchar *context;
+               gboolean ret;
+
+               context = g_strdup_printf(_("%s header"),
+                                               prefs_common_translated_header_name("Newsgroups:"));
+               ret = matcherprop_string_match(prop, info->newsgroups, context);
+               g_free(context);
+               return (prop->criteria == MATCHCRITERIA_NEWSGROUPS)? ret : !ret;
+       }
        case MATCHCRITERIA_INREPLYTO:
-               return matcherprop_string_match(prop, info->inreplyto, _("InReplyTo: header"));
        case MATCHCRITERIA_NOT_INREPLYTO:
-               return !matcherprop_string_match(prop, info->inreplyto, _("InReplyTo: header"));
+       {
+               gchar *context;
+               gboolean ret;
+
+               context = g_strdup_printf(_("%s header"),
+                                               prefs_common_translated_header_name("In-Reply-To:"));
+               ret = matcherprop_string_match(prop, info->inreplyto, context);
+               g_free(context);
+               return (prop->criteria == MATCHCRITERIA_INREPLYTO)? ret : !ret;
+       }
        case MATCHCRITERIA_REFERENCES:
-               return matcherprop_list_match(prop, info->references, _("References: header"));
        case MATCHCRITERIA_NOT_REFERENCES:
-               return !matcherprop_list_match(prop, info->references, _("References: header"));
+       {
+               gchar *context;
+               gboolean ret;
+
+               context = g_strdup_printf(_("%s header"),
+                                               prefs_common_translated_header_name("References:"));
+               ret = matcherprop_list_match(prop, info->references, context);
+               g_free(context);
+               return (prop->criteria == MATCHCRITERIA_REFERENCES)? ret : !ret;
+       }
        case MATCHCRITERIA_TEST:
                return matcherprop_match_test(prop, info);
        case MATCHCRITERIA_NOT_TEST:
index 414b47a..713b0a3 100644 (file)
@@ -1302,3 +1302,20 @@ gboolean prefs_common_unsafe_ssl_certs(void)
 {
        return prefs_common.unsafe_ssl_certs;
 }
+
+/**
+   return the translated name of a header, if the translate_header option is
+   set, otherwise return the untranslated header name (header_name itself).
+   this function is provided for convenience, it's an interface to
+   prefs_common.trans_hdr.
+   works with header names either with or without trailing colon, provided
+   that gettext found such header name in the sources (they should all be
+   found in src/gtk/headers.h anyway).
+*/
+const gchar *prefs_common_translated_header_name(const gchar *header_name)
+{
+       if (header_name != NULL || *header_name == '\0')
+               return header_name;
+
+       return prefs_common.trans_hdr ? gettext(header_name) : header_name;
+}
index 8875617..8fb6086 100644 (file)
@@ -449,5 +449,6 @@ void pref_set_textview_from_pref(GtkTextView *textview, const gchar *txt);
 void pref_set_entry_from_pref(GtkEntry *entry, const gchar *txt);
 gchar *pref_get_pref_from_textview(GtkTextView *textview);
 gchar *pref_get_pref_from_entry(GtkEntry *entry);
+const gchar *prefs_common_translated_header_name(const gchar *header_name);
 
 #endif /* __PREFS_COMMON_H__ */
index ad92974..240f85f 100644 (file)
@@ -255,7 +255,7 @@ static void prefs_display_header_create(void)
        hdr_combo = gtk_combo_box_entry_new_text();
        for(i=0; i < 9 ; i++)
                gtk_combo_box_append_text(GTK_COMBO_BOX (hdr_combo),
-                       prefs_common.trans_hdr ? gettext(defaults[i]) : defaults[i]);
+                       prefs_common_translated_header_name(defaults[i]));
        gtk_combo_box_set_active(GTK_COMBO_BOX(hdr_combo), 0);
        gtk_widget_show (hdr_combo);
        gtk_box_pack_start (GTK_BOX (hbox1), hdr_combo, TRUE, TRUE, 0);
@@ -730,7 +730,7 @@ static void prefs_display_header_insert_header(GtkListStore *store,
        gtk_list_store_append(store, &iter);
        gtk_list_store_set(store, &iter,
                           PREFS_HDR_HEADER,
-                          prefs_common.trans_hdr ? gettext(name) : name,
+                          prefs_common_translated_header_name(name),
                           PREFS_HDR_DATA, dp,
                           -1);
 }
index 6de755a..a2d6569 100644 (file)
@@ -155,28 +155,51 @@ enum {
 /*!
  *\brief       Descriptive text for conditions
  */
-static const gchar *criteria_text [] = {
-       N_("All messages"), N_("Subject"),
-       N_("From"), N_("To"), N_("Cc"), N_("To or Cc"),
-       N_("Newsgroups"), N_("In reply to"), N_("References"),
-       N_("Age greater than"), N_("Age lower than"),
-       N_("Header"), N_("Headers part"),
-       N_("Body part"), N_("Whole message"),
-       N_("Unread flag"), N_("New flag"),
-       N_("Marked flag"), N_("Deleted flag"),
-       N_("Replied flag"), N_("Forwarded flag"),
-       N_("Locked flag"),
-       N_("Spam flag"),
-       N_("Color label"),
-       N_("Ignored thread"),
-       N_("Score greater than"), N_("Score lower than"),
-       N_("Score equal to"),
-       N_("Test"),
-       N_("Size greater than"), 
-       N_("Size smaller than"),
-       N_("Size exactly"),
-       N_("Partially downloaded"),
-       N_("Found in addressbook")
+typedef struct _struct_criteria_text struct_criteria_text;
+struct _struct_criteria_text {
+       const gchar     *text;
+       gboolean         contains_header_name;
+       /* if contains_header_name is TRUE, prefs_common_translated_headername(text)
+          will be used
+       */
+};
+
+static struct_criteria_text criteria_text [] = {
+       { N_("All messages"), FALSE },
+       { N_("Subject"), TRUE },
+       { N_("From"), TRUE },
+       { N_("To"), TRUE },
+       { N_("Cc"), TRUE },
+       { N_("To or Cc"), TRUE },
+       { N_("Newsgroups"), TRUE },
+       { N_("In reply to"), TRUE },
+       { N_("References"), TRUE },
+       { N_("Age greater than"), FALSE },
+       { N_("Age lower than"), FALSE },
+       { N_("Header"), FALSE },
+       { N_("Headers part"), FALSE },
+       { N_("Body part"), FALSE },
+       { N_("Whole message"), FALSE },
+       { N_("Unread flag"), FALSE },
+       { N_("New flag"), FALSE },
+       { N_("Marked flag"), FALSE },
+       { N_("Deleted flag"), FALSE },
+       { N_("Replied flag"), FALSE },
+       { N_("Forwarded flag"), FALSE },
+       { N_("Locked flag"), FALSE },
+       { N_("Spam flag"), FALSE },
+       { N_("Color label"), FALSE },
+       { N_("Ignored thread"), FALSE },
+       { N_("Score greater than"), FALSE },
+       { N_("Score lower than"), FALSE },
+       { N_("Score equal to"), FALSE },
+       { N_("Test"), FALSE },
+       { N_("Size greater than"), FALSE }, 
+       { N_("Size smaller than"), FALSE },
+       { N_("Size exactly"), FALSE },
+       { N_("Partially downloaded"), FALSE },
+       { N_("Found in addressbook"), FALSE },
+       { NULL, FALSE }
 };
 
 /*!
@@ -473,9 +496,13 @@ static void prefs_matcher_create(void)
 
        combo_items = NULL;
 
-       for (i = 0; i < (gint) (sizeof(criteria_text) / sizeof(gchar *)); i++) {
-               combo_items = g_list_append(combo_items,
-                                           (gpointer) _(criteria_text[i]));
+       for (i = 0; criteria_text[i].text != NULL; i++) {
+               if (criteria_text[i].contains_header_name)
+                       combo_items = g_list_append(combo_items,
+                                           (gpointer) prefs_common_translated_header_name(criteria_text[i].text));
+               else
+                       combo_items = g_list_append(combo_items,
+                                           (gpointer) gettext(criteria_text[i].text));
        }
        gtk_combo_set_popdown_strings(GTK_COMBO(criteria_combo), combo_items);
 
index 9dcb969..ce0a441 100644 (file)
@@ -2426,10 +2426,10 @@ static void summary_set_column_titles(SummaryView *summaryview)
                                        FOLDER_SHOWS_TO_HDR(item) &&
                                        !summaryview->col_state[summaryview->col_pos[S_COL_TO]].visible)
                                type = S_COL_TO;
-                       if (prefs_common.trans_hdr)
+                       if(type == S_COL_NUMBER)
                                title = gettext(col_label[type]);
                        else
-                               title = col_label[type];
+                               title = prefs_common_translated_header_name(col_label[type]);
                        break;
                default:
                        title = gettext(col_label[type]);