From 345f0c8c5dc0ca6e4bce0d46064ed77acd8d914d Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Mon, 22 Apr 2002 23:35:36 +0000 Subject: Plug-in Anna's html for the flag-for-followup stuff. Finishes up bug #90. 2002-04-22 Jeffrey Stedfast * mail-display.c (mail_display_render): Plug-in Anna's html for the flag-for-followup stuff. Finishes up bug #90. svn path=/trunk/; revision=16563 --- mail/ChangeLog | 5 +++++ mail/mail-display.c | 44 +++++++++++++++++++++++++++++--------------- 2 files changed, 34 insertions(+), 15 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index 2503603635..7a5edf152d 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,8 @@ +2002-04-22 Jeffrey Stedfast + + * mail-display.c (mail_display_render): Plug-in Anna's html for + the flag-for-followup stuff. Finishes up bug #90. + 2002-04-19 Jeffrey Stedfast * folder-browser.c (folder_browser_finalise): Free the diff --git a/mail/mail-display.c b/mail/mail-display.c index cabab31feb..5c506ffbbe 100644 --- a/mail/mail-display.c +++ b/mail/mail-display.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -1509,6 +1510,11 @@ mail_display_render (MailDisplay *md, GtkHTML *html, gboolean reset_scroll) mail_html_write (html, stream, "\n"); if (md->followup) { + const char *overdue; + char due_date[100]; + struct tm due; + time_t now; + /* my favorite thing to do... muck around with colors so we respect people's stupid themes. */ style = gtk_widget_get_style (GTK_WIDGET (html)); if (style && !md->printing) { @@ -1520,13 +1526,13 @@ mail_display_render (MailDisplay *md, GtkHTML *html, gboolean reset_scroll) b = style->base[state].blue / 256; if (COLOR_IS_LIGHT (r, g, b)) { - r *= 0.92; - g *= 0.92; - b *= 0.92; + r *= 1.0; + g *= 0.97; + b *= 0.75; } else { - r = 255 - (0.92 * (255 - r)); - g = 255 - (0.92 * (255 - g)); - b = 255 - (0.92 * (255 - b)); + r = 255 - (1.0 * (255 - r)); + g = 255 - (0.97 * (255 - g)); + b = 255 - (0.75 * (255 - b)); } sprintf (bgcolor, "%.2X%.2X%.2X", r, g, b); @@ -1541,17 +1547,25 @@ mail_display_render (MailDisplay *md, GtkHTML *html, gboolean reset_scroll) strcpy (fontcolor, "000000"); } - gtk_html_stream_printf (stream, "" - "
" - "" - "
" - "\n", fontcolor, bgcolor); + now = time (NULL); + if (now >= md->followup->target_date) + overdue = U_("Overdue: "); + else + overdue = ""; - gtk_html_stream_printf (stream, "\n", - mail_display_get_url_for_icon (md, EVOLUTION_IMAGES "/flag-for-followup-16.png"), - message_tag_followup_i18n_name (md->followup->type)); + /* copy the due date into 'now' because localtime_r destroys the time_t value */ + now = md->followup->target_date; + localtime_r (&now, &due); - mail_html_write (html, stream, "
%s
"); + e_strftime (due_date, 100, "%B %d, %Y, %l:%M %P", &due); + + gtk_html_stream_printf (stream, "" + "
" + "" + "" + "
%s%s by %s
", fontcolor, bgcolor, + mail_display_get_url_for_icon (md, EVOLUTION_IMAGES "/flag-for-followup-16.png"), + overdue, message_tag_followup_i18n_name (md->followup->type), due_date); } if (md->current_message) { -- cgit v1.2.3