From 258ae9acd3fbaa82a03fa95cba84996812a17165 Mon Sep 17 00:00:00 2001 From: Djihed Afifi Date: Tue, 8 Jan 2008 22:41:22 +0000 Subject: Fix bug #309432 : RTL headers svn path=/trunk/; revision=34780 --- mail/ChangeLog | 6 ++++++ mail/em-format-html.c | 38 ++++++++++++++++++++++++++++---------- 2 files changed, 34 insertions(+), 10 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index 4bf45fec17..38b2853ecd 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,9 @@ +2008-01-08 Djihed Afifi + + ** Fix for bug #309432 + + * em-format-html.c: Fix message headers for RTL languages. + 2008-01-08 Colin Leroy ** Fix for bug #499145 diff --git a/mail/em-format-html.c b/mail/em-format-html.c index 1339aa8ec0..c272fd6d78 100644 --- a/mail/em-format-html.c +++ b/mail/em-format-html.c @@ -1484,22 +1484,34 @@ efh_format_text_header (EMFormatHTML *emfh, CamelStream *stream, const char *lab else html = mhtml = camel_text_to_html (value, emfh->text_html_flags, 0); + gboolean is_rtl = gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL; if (emfh->simple_headers) { fmt = "%s: %s
"; } else { if (flags & EM_FORMAT_HTML_HEADER_NOCOLUMNS) { - if (flags & EM_FORMAT_HEADER_BOLD) + if (flags & EM_FORMAT_HEADER_BOLD) { fmt = "%s: %s"; - else + } else { fmt = "%s: %s"; + } } else if (flags & EM_FORMAT_HTML_HEADER_NODEC) { - fmt = "%s %s"; - } else { - - if (flags & EM_FORMAT_HEADER_BOLD) - fmt = "%s: %s"; + if (is_rtl) + fmt = "%2$s%1$s "; else - fmt = "%s: %s"; + fmt = "%s %s"; + } else { + + if (flags & EM_FORMAT_HEADER_BOLD) { + if (is_rtl) + fmt = "%2$s%1$s: "; + else + fmt = "%s: %s"; + } else { + if (is_rtl) + fmt = "%2$s%1$s: "; + else + fmt = "%s: %s"; + } } } @@ -1838,7 +1850,10 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part) if (header_sender && header_from && mail_from_delegate) { camel_stream_printf(stream, ""); - camel_stream_printf(stream, "
"); + if(gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL) + camel_stream_printf (stream, ""); + else + camel_stream_printf (stream, ""); /* To translators: This message suggests to the receipients that the sender of the mail is different from the one listed in From field. */ @@ -1853,7 +1868,10 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part) g_free (header_sender); g_free (header_from); - camel_stream_printf(stream, "
\n"); + if (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL) + camel_stream_printf (stream, "
\n"); + else + camel_stream_printf (stream, "
\n"); /* dump selected headers */ h = (EMFormatHeader *)emf->header_list.head; -- cgit