diff options
author | Milan Crha <mcrha@redhat.com> | 2009-08-04 21:04:02 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2009-08-04 21:04:02 +0800 |
commit | b6313289303f2263649c70ea477e04aea4a994ec (patch) | |
tree | 36b4435a060aca6425e717b1b0ddd29efb8a0712 /mail/em-format-html.c | |
parent | bc301a8c3784610a0c55c9fb5056ec63ca574f4d (diff) | |
download | gsoc2013-evolution-b6313289303f2263649c70ea477e04aea4a994ec.tar.gz gsoc2013-evolution-b6313289303f2263649c70ea477e04aea4a994ec.tar.zst gsoc2013-evolution-b6313289303f2263649c70ea477e04aea4a994ec.zip |
Bug #205137 - Configurable date formats in components
Diffstat (limited to 'mail/em-format-html.c')
-rw-r--r-- | mail/em-format-html.c | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/mail/em-format-html.c b/mail/em-format-html.c index ec3427c88d..038ca4b61b 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" @@ -1750,14 +1751,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); @@ -1765,25 +1768,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; |