From: Dirk-Jan C. Binnema Date: Thu, 14 Jun 2007 13:34:32 +0000 (+0000) Subject: * modest_text_utils_get_display_date: X-Git-Tag: git_migration_finished~3280 X-Git-Url: http://git.maemo.org/git/?p=modest;a=commitdiff_plain;h=592de36d3410bfccb171aed2f6d88d364a59541c * modest_text_utils_get_display_date: - use the localized (%X) display date * _modest_header_view_compact_header_cell_data - don't try to display the date when it's zero pmo-trunk-r2233 --- diff --git a/src/modest-text-utils.c b/src/modest-text-utils.c index 07ae71c..cb1a16e 100644 --- a/src/modest-text-utils.c +++ b/src/modest-text-utils.c @@ -236,7 +236,6 @@ modest_text_utils_strftime(char *s, gsize max, const char *fmt, time_t timet) * g_date_set_time_t (&date, timet); */ localtime_r (&timet, &tm); - return strftime(s, max, fmt, &tm); } @@ -994,14 +993,13 @@ modest_text_utils_get_display_date (time_t date) now = time (NULL); - modest_text_utils_strftime (date_buf, BUF_SIZE, "%d/%m/%Y", date); - modest_text_utils_strftime (now_buf, BUF_SIZE, "%d/%m/%Y", now); /* today */ -/* modest_text_utils_strftime (date_buf, BUF_SIZE, "%x", date); */ -/* modest_text_utils_strftime (now_buf, BUF_SIZE, "%x", now); /\* today *\/ */ + /* use the localized dates */ + modest_text_utils_strftime (date_buf, BUF_SIZE, "%x", date); + modest_text_utils_strftime (now_buf, BUF_SIZE, "%x", now); /* if this is today, get the time instead of the date */ if (strcmp (date_buf, now_buf) == 0) - modest_text_utils_strftime (date_buf, BUF_SIZE, "%H:%M %P", date); + modest_text_utils_strftime (date_buf, BUF_SIZE, "%X", date); return g_strdup(date_buf); } diff --git a/src/widgets/modest-header-view-render.c b/src/widgets/modest-header-view-render.c index b3bcbdb..de70f8f 100644 --- a/src/widgets/modest-header-view-render.c +++ b/src/widgets/modest-header-view-render.c @@ -255,7 +255,14 @@ _modest_header_view_compact_header_cell_data (GtkTreeViewColumn *column, GtkCe g_object_set (G_OBJECT (recipient_cell), "markup", header, NULL); set_common_flags (recipient_cell, flags); - tmp_date = modest_text_utils_get_display_date (date); + /* in some rare cases, mail might have no Date: field. it case, + * don't show the date, instead of bogus 1/1/1970 + */ + if (date) + tmp_date = modest_text_utils_get_display_date (date); + else + tmp_date = g_strdup (""); + display_date = g_strdup_printf ("%s", tmp_date); g_object_set (G_OBJECT (date_cell), "markup", display_date, NULL); g_free (tmp_date);