aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-format-html.c
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2009-08-04 21:04:02 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-08-12 03:44:27 +0800
commit50302d03b3ce145b165db2ddef4e92ad190cbef9 (patch)
tree4a804f72f256ef774d6f0f23c84643e42cc10083 /mail/em-format-html.c
parentcd6f86108bfc34db41de71f1e00c7e7768cb4816 (diff)
downloadgsoc2013-evolution-50302d03b3ce145b165db2ddef4e92ad190cbef9.tar
gsoc2013-evolution-50302d03b3ce145b165db2ddef4e92ad190cbef9.tar.gz
gsoc2013-evolution-50302d03b3ce145b165db2ddef4e92ad190cbef9.tar.bz2
gsoc2013-evolution-50302d03b3ce145b165db2ddef4e92ad190cbef9.tar.lz
gsoc2013-evolution-50302d03b3ce145b165db2ddef4e92ad190cbef9.tar.xz
gsoc2013-evolution-50302d03b3ce145b165db2ddef4e92ad190cbef9.tar.zst
gsoc2013-evolution-50302d03b3ce145b165db2ddef4e92ad190cbef9.zip
Bug #205137 - Configurable date formats in components
Diffstat (limited to 'mail/em-format-html.c')
-rw-r--r--mail/em-format-html.c34
1 files changed, 15 insertions, 19 deletions
diff --git a/mail/em-format-html.c b/mail/em-format-html.c
index fa713282c1..b9657a1fd9 100644
--- a/mail/em-format-html.c
+++ b/mail/em-format-html.c
@@ -43,6 +43,7 @@
#include <libedataserver/e-data-server-util.h> /* for e_utf8_strftime, what about e_time_format_time? */
#include <libedataserver/e-time-utils.h>
+#include "e-util/e-datetime-format.h"
#include "e-util/e-icon-factory.h"
#include "e-util/e-util-private.h"
#include "e-util/e-util.h"
@@ -2321,14 +2322,16 @@ efh_format_header(EMFormat *emf, CamelStream *stream, CamelMedium *part, struct
gint msg_offset, local_tz;
time_t msg_date;
struct tm local;
+ gchar *date_str;
txt = header->value;
while (*txt == ' ' || *txt == '\t')
txt++;
- /* Show the local timezone equivalent in brackets if the sender is remote */
msg_date = camel_header_decode_date(txt, &msg_offset);
- e_localtime_with_offset(msg_date, &local, &local_tz);
+ e_localtime_with_offset (msg_date, &local, &local_tz);
+
+ date_str = e_datetime_format_format ("mail", "header", DTFormatKindDateTime, msg_date);
/* Convert message offset to minutes (e.g. -0400 --> -240) */
msg_offset = ((msg_offset / 100) * 60) + (msg_offset % 100);
@@ -2336,25 +2339,18 @@ efh_format_header(EMFormat *emf, CamelStream *stream, CamelMedium *part, struct
msg_offset -= local_tz / 60;
if (msg_offset) {
- gchar buf[256], *html;
-
- msg_offset += (local.tm_hour * 60) + local.tm_min;
- if (msg_offset >= (24 * 60) || msg_offset < 0) {
- /* translators: strftime format for local time equivalent in Date header display, with day */
- gchar *msg = g_strdup_printf("<I>%s</I>", _(" (%a, %R %Z)"));
- e_utf8_strftime(buf, sizeof(buf), msg, &local);
- g_free(msg);
- } else {
- /* translators: strftime format for local time equivalent in Date header display, without day */
- gchar *msg = g_strdup_printf("<I>%s</I>", _(" (%R %Z)"));
- e_utf8_strftime(buf, sizeof(buf), msg, &local);
- g_free(msg);
- }
+ gchar *html;
+
+ html = camel_text_to_html (txt, efh->text_html_flags, 0);
+ txt = value = g_strdup_printf ("%s (<I>%s</I>)", date_str, html);
+
+ g_free (html);
+ g_free (date_str);
- html = camel_text_to_html(txt, efh->text_html_flags, 0);
- txt = value = g_strdup_printf("%s %s", html, buf);
- g_free(html);
flags |= EM_FORMAT_HTML_HEADER_HTML;
+ } else {
+ /* date_str will be freed at the end */
+ txt = value = date_str;
}
flags |= EM_FORMAT_HEADER_BOLD;