From 2a0b181422cfac6025c238e1edc6281a2ac3fba3 Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Mon, 23 Apr 2001 20:23:47 +0000 Subject: Made it so that if a message is from the last 8 hours, it only prints the 2001-04-23 Christopher James Lahey * e-cell-date.c (ecd_get_text): Made it so that if a message is from the last 8 hours, it only prints the time, not the date. svn path=/trunk/; revision=9519 --- widgets/table/e-cell-date.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'widgets') diff --git a/widgets/table/e-cell-date.c b/widgets/table/e-cell-date.c index 7e48f97a62..00d5ca00aa 100644 --- a/widgets/table/e-cell-date.c +++ b/widgets/table/e-cell-date.c @@ -33,19 +33,35 @@ ecd_get_text(ECellText *cell, ETableModel *model, int col, int row) 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 %l:%M %p"), &then); + + if (nowdate - date < 60 * 60 * 8) { + strftime (buf, 26, _("%l:%M %p"), &then); done = TRUE; } + + if (!done) { + if (then.tm_mday == now.tm_mday && + then.tm_mon == now.tm_mon && + then.tm_year == now.tm_year) { + strftime (buf, 26, _("Today %l:%M %p"), &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 %l:%M %p"), &then); +#if 0 + if (nowdate - date < 60 * 60 * 12) { + strftime (buf, 26, _("Late Yesterday %l:%M %p"), &then); + } else { +#endif + strftime (buf, 26, _("Yesterday %l:%M %p"), &then); +#if 0 + } +#endif done = TRUE; } } -- cgit v1.2.3