diff options
author | Christopher James Lahey <clahey@helixcode.com> | 2000-12-25 05:05:49 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2000-12-25 05:05:49 +0800 |
commit | 31e9ec42573a50e903980599df67f69d4e431726 (patch) | |
tree | 053d48b6aa23044ad581159840fe81700ec54323 /mail | |
parent | d187b5887d16afa700bcd747b693ef2b1f81b0f1 (diff) | |
download | gsoc2013-evolution-31e9ec42573a50e903980599df67f69d4e431726.tar gsoc2013-evolution-31e9ec42573a50e903980599df67f69d4e431726.tar.gz gsoc2013-evolution-31e9ec42573a50e903980599df67f69d4e431726.tar.bz2 gsoc2013-evolution-31e9ec42573a50e903980599df67f69d4e431726.tar.lz gsoc2013-evolution-31e9ec42573a50e903980599df67f69d4e431726.tar.xz gsoc2013-evolution-31e9ec42573a50e903980599df67f69d4e431726.tar.zst gsoc2013-evolution-31e9ec42573a50e903980599df67f69d4e431726.zip |
Changed this to do different formatting of dates within the last week.
2000-12-24 Christopher James Lahey <clahey@helixcode.com>
* message-list.c (filter_date): Changed this to do different
formatting of dates within the last week.
svn path=/trunk/; revision=7157
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 5 | ||||
-rw-r--r-- | mail/message-list.c | 37 |
2 files changed, 33 insertions, 9 deletions
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 <clahey@helixcode.com> + + * message-list.c (filter_date): Changed this to do different + formatting of dates within the last week. + 2000-12-24 Not Zed <NotZed@HelixCode.com> * 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); |