aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-format-html-display.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-display.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-display.c')
-rw-r--r--mail/em-format-html-display.c29
1 files changed, 9 insertions, 20 deletions
diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c
index a15b0d671f..70b8547972 100644
--- a/mail/em-format-html-display.c
+++ b/mail/em-format-html-display.c
@@ -63,6 +63,7 @@
#include <e-util/e-util-private.h>
#include <libedataserver/e-msgport.h>
+#include "e-util/e-datetime-format.h"
#include <e-util/e-dialog-utils.h>
#include <e-util/e-icon-factory.h>
@@ -81,16 +82,6 @@
#include "widgets/misc/e-attachment-button.h"
#include "widgets/misc/e-attachment-view.h"
-#ifdef G_OS_WIN32
-/* Undefine the similar macro from <pthread.h>,it doesn't check if
- * localtime() returns NULL.
- */
-#undef localtime_r
-
-/* The localtime() in Microsoft's C library is MT-safe */
-#define localtime_r(tp,tmp) (localtime(tp)?(*(tmp)=*localtime(tp),(tmp)):0)
-#endif
-
#define d(x)
#define EM_FORMAT_HTML_DISPLAY_GET_PRIVATE(obj) \
@@ -768,9 +759,7 @@ efhd_message_prefix(EMFormat *emf, CamelStream *stream, CamelMimePart *part, EMF
{
const gchar *flag, *comp, *due;
time_t date;
- gchar due_date[128];
- struct tm due_tm;
- gchar *iconpath;
+ gchar *iconpath, *due_date_str;
if (emf->folder == NULL || emf->uid == NULL
|| (flag = camel_folder_get_message_user_tag(emf->folder, emf->uid, "follow-up")) == NULL
@@ -801,10 +790,10 @@ efhd_message_prefix(EMFormat *emf, CamelStream *stream, CamelMimePart *part, EMF
camel_stream_printf(stream, "<td align=\"left\" width=\"100%%\">");
if (comp && comp[0]) {
- date = camel_header_decode_date(comp, NULL);
- localtime_r(&date, &due_tm);
- e_utf8_strftime_fix_am_pm(due_date, sizeof (due_date), _("Completed on %B %d, %Y, %l:%M %p"), &due_tm);
- camel_stream_printf(stream, "%s, %s", flag, due_date);
+ date = camel_header_decode_date (comp, NULL);
+ due_date_str = e_datetime_format_format ("mail", "header", DTFormatKindDateTime, date);
+ camel_stream_printf (stream, "%s, %s %s", flag, _("Completed on"), due_date_str ? due_date_str : "???");
+ g_free (due_date_str);
} else if ((due = camel_folder_get_message_user_tag(emf->folder, emf->uid, "due-by")) != NULL && due[0]) {
time_t now;
@@ -813,9 +802,9 @@ efhd_message_prefix(EMFormat *emf, CamelStream *stream, CamelMimePart *part, EMF
if (now > date)
camel_stream_printf(stream, "<b>%s</b>&nbsp;", _("Overdue:"));
- localtime_r(&date, &due_tm);
- e_utf8_strftime_fix_am_pm(due_date, sizeof (due_date), _("by %B %d, %Y, %l:%M %p"), &due_tm);
- camel_stream_printf(stream, "%s %s", flag, due_date);
+ due_date_str = e_datetime_format_format ("mail", "header", DTFormatKindDateTime, date);
+ /* To Translators: the "by" is part of the string, like "Follow-up by Tuesday, January 13, 2009" */
+ camel_stream_printf (stream, "%s %s %s", flag, _("by"), due_date_str ? due_date_str : "???");
} else {
camel_stream_printf(stream, "%s", flag);
}