From 31e9ec42573a50e903980599df67f69d4e431726 Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Sun, 24 Dec 2000 21:05:49 +0000 Subject: Changed this to do different formatting of dates within the last week. 2000-12-24 Christopher James Lahey * message-list.c (filter_date): Changed this to do different formatting of dates within the last week. svn path=/trunk/; revision=7157 --- mail/ChangeLog | 5 +++++ mail/message-list.c | 37 ++++++++++++++++++++++++++++--------- 2 files changed, 33 insertions(+), 9 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index 193d276e05..0b6ce30585 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,8 @@ +2000-12-24 Christopher James Lahey + + * message-list.c (filter_date): Changed this to do different + formatting of dates within the last week. + 2000-12-24 Not Zed * Merge from camel-mt-branch. diff --git a/mail/message-list.c b/mail/message-list.c index c34b01c18f..9d08d04308 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -959,31 +959,50 @@ filter_date (const void *data) time_t yesdate; struct tm then, now, yesterday; char buf[26]; + gboolean done = FALSE; if (date == 0) - return g_strdup ("?"); + return g_strdup (_("?")); localtime_r (&date, &then); localtime_r (&nowdate, &now); if (then.tm_mday == now.tm_mday && then.tm_mon == now.tm_mon && then.tm_year == now.tm_year) { - strftime (buf, 26, "Today %T", &then); - } else { + strftime (buf, 26, _("Today %T"), &then); + done = TRUE; + } + if (!done) { yesdate = nowdate - 60 * 60 * 24; localtime_r (&yesdate, &yesterday); if (then.tm_mday == yesterday.tm_mday && then.tm_mon == yesterday.tm_mon && then.tm_year == yesterday.tm_year) { - strftime (buf, 26, "Yesterday %T", &then); - } else { - if (then.tm_year == now.tm_year) { - strftime (buf, 26, "%b %d %T", &then); - } else { - strftime (buf, 26, "%b %d %Y", &then); + strftime (buf, 26, _("Yesterday %T"), &then); + done = TRUE; + } + } + if (!done) { + int i; + for (i = 2; i < 7; i++) { + yesdate = nowdate - 60 * 60 * 24 * i; + localtime_r (&yesdate, &yesterday); + if (then.tm_mday == yesterday.tm_mday && + then.tm_mon == yesterday.tm_mon && + then.tm_year == yesterday.tm_year) { + strftime (buf, 26, _("%a %T"), &then); + done = TRUE; + break; } } } + if (!done) { + if (then.tm_year == now.tm_year) { + strftime (buf, 26, _("%b %d %T"), &then); + } else { + strftime (buf, 26, _("%b %d %Y"), &then); + } + } #if 0 #ifdef CTIME_R_THREE_ARGS ctime_r (&date, buf, 26); -- cgit