From 50302d03b3ce145b165db2ddef4e92ad190cbef9 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Tue, 4 Aug 2009 15:04:02 +0200 Subject: Bug #205137 - Configurable date formats in components --- mail/em-format-html-display.c | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) (limited to 'mail/em-format-html-display.c') 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 #include +#include "e-util/e-datetime-format.h" #include #include @@ -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 ,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, ""); 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, "%s ", _("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); } -- cgit v1.2.3