evolution r34780 - trunk/mail



Author: djihed
Date: Tue Jan  8 22:41:22 2008
New Revision: 34780
URL: http://svn.gnome.org/viewvc/evolution?rev=34780&view=rev

Log:
Fix bug #309432 : RTL headers

Modified:
   trunk/mail/ChangeLog
   trunk/mail/em-format-html.c

Modified: trunk/mail/em-format-html.c
==============================================================================
--- trunk/mail/em-format-html.c	(original)
+++ trunk/mail/em-format-html.c	Tue Jan  8 22:41:22 2008
@@ -1484,22 +1484,34 @@
 	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 = "<b>%s</b>: %s<br>";
 	} else {
 		if (flags & EM_FORMAT_HTML_HEADER_NOCOLUMNS) {
-			if (flags & EM_FORMAT_HEADER_BOLD)
+			if (flags & EM_FORMAT_HEADER_BOLD) {
 				fmt = "<tr><td><b>%s:</b> %s</td></tr>";
-			else
+			} else {
 				fmt = "<tr><td>%s: %s</td></tr>";
+			}
 		} else if (flags & EM_FORMAT_HTML_HEADER_NODEC) {
-			fmt = "<tr><th align=\"right\" valign=\"top\" nowrap>%s<b>&nbsp;</b></th><td valign=top>%s</td></tr>";
-		} else {
-
-			if (flags & EM_FORMAT_HEADER_BOLD)
-				fmt = "<tr><th align=\"right\" valign=\"top\" nowrap>%s:<b>&nbsp;</b></th><td>%s</td></tr>";
+			if (is_rtl)
+				fmt = "<tr><td align=\"right\" valign=\"top\" width=\"100%%\">%2$s</td><th valign=top align=\"left\" nowrap>%1$s<b>&nbsp;</b></th></tr>";
 			else
-				fmt = "<tr><td align=\"right\" valign=\"top\" nowrap>%s:<b>&nbsp;</b></td><td>%s</td></tr>";
+				fmt = "<tr><th align=\"right\" valign=\"top\" nowrap>%s<b>&nbsp;</b></th><td valign=top>%s</td></tr>";
+		} else {
+			
+			if (flags & EM_FORMAT_HEADER_BOLD) {
+				if (is_rtl)
+					fmt = "<tr><td align=\"right\" valign=\"top\" width=\"100%%\">%2$s</td><th align=\"left\" nowrap>%1$s:<b>&nbsp;</b></th></tr>";
+				else
+					fmt = "<tr><th align=\"right\" valign=\"top\" nowrap>%s:<b>&nbsp;</b></th><td>%s</td></tr>";
+			} else {
+				if (is_rtl)
+					fmt = "<tr><td align=\"right\" valign=\"top\" width=\"100%\">%2$s</td><td align=\"left\" nowrap>%1$s:<b>&nbsp;</b></td></tr>";
+				else
+					fmt = "<tr><td align=\"right\" valign=\"top\" nowrap>%s:<b>&nbsp;</b></td><td>%s</td></tr>";
+			}
 		}
 	}
 
@@ -1838,7 +1850,10 @@
 
 		if (header_sender && header_from && mail_from_delegate) {
 			camel_stream_printf(stream, "<tr><td><table border=1 width=\"100%%\" cellspacing=2 cellpadding=2><tr>");
-			camel_stream_printf(stream, "<td align=\"left\" width=\"100%%\">");
+			if(gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL)
+				camel_stream_printf (stream, "<td align=\"right\" width=\"100%%\">");
+			else
+				camel_stream_printf (stream, "<td align=\"left\" width=\"100%%\">");
 			/* 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 @@
 	g_free (header_sender);
 	g_free (header_from);
 
-	camel_stream_printf(stream, "<tr><td><table border=0 cellpadding=\"0\">\n");
+	if (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL)
+		camel_stream_printf (stream, "<tr><td><table width=\"100%%\" border=0 cellpadding=\"0\">\n");
+	else
+		camel_stream_printf (stream, "<tr><td><table border=0 cellpadding=\"0\">\n");
 
 	/* dump selected headers */
 	h = (EMFormatHeader *)emf->header_list.head;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]