Re: [evolution-patches] Show date in localtime.
- From: Not Zed <notzed ximian com>
- To: David Woodhouse <dwmw2 infradead org>
- Cc: evolution-patches lists ximian com, anna ximian com
- Subject: Re: [evolution-patches] Show date in localtime.
- Date: Tue, 19 Aug 2003 09:39:25 -0400
Hi,
I've committed this to head, but with some slight changes. I added
translation for the day (it isn't required in camel because its an
internet format string), and removed the tm_zone stuff, since it doesn't
seem to add much and afaict not available many places (also since
feature tests are confined to e-time-utils i didn't want the clutter).
Oh and reformatted for > 80 columns, we're not using VT100's anymore.
Michael
On Fri, 2003-08-15 at 06:08, David Woodhouse wrote:
> This time against -HEAD...
>
> This causes Evolution to add a local version of the time in the Date
> header -- http://www.infradead.org/~dwmw2/evo-show-localtime.jpeg
>
> In the relatively rare case where the localtime conversion means the
> _day_ has changed too (e.g. a mail was sent at half past midnight which
> is half past eleven in the user's timezone, it'll also show the day of
> the week to make the difference clear --
> http://www.infradead.org/~dwmw2/evo-show-localtime-day.jpeg
>
> This adds useful information, because timezone calculations are easy to
> get wrong when done mentally, but without causing significant clutter.
> Please apply to -HEAD.
>
> As you can see from the mail used for the first example screenshot, I
> don't really think the addition of the day is necessary in the case
> where the conversion crosses midnight, but I've added it to keep Ettore
> happy.
>
> Anna -- are you happy with this addition? Do you have any requests?
>
> Index: ChangeLog
> ===================================================================
> RCS file: /cvs/gnome/evolution/ChangeLog,v
> retrieving revision 1.1224
> diff -u -p -r1.1224 ChangeLog
> --- ChangeLog 13 Aug 2003 16:48:20 -0000 1.1224
> +++ ChangeLog 15 Aug 2003 09:59:45 -0000
> @@ -1,3 +1,7 @@
> +2003-08-15 David Woodhouse <dwmw2 infradead org>
> +
> + * configure.in: Check for tm_zone in struct tm.
> +
> 2003-08-13 Mike Kestner <mkestner ximian com>
>
> * configure.in: don't make 1.5 the default version (ie LN_S)
> Index: configure.in
> ===================================================================
> RCS file: /cvs/gnome/evolution/configure.in,v
> retrieving revision 1.600
> diff -u -p -r1.600 configure.in
> --- configure.in 13 Aug 2003 16:48:20 -0000 1.600
> +++ configure.in 15 Aug 2003 09:59:46 -0000
> @@ -125,6 +125,7 @@ AC_SUBST(CAMEL_LOCK_HELPER_GROUP)
> dnl ***************
> dnl Timezone checks
> dnl ***************
> +AC_CHECK_MEMBERS(struct tm.tm_zone,,,[#include <time.h>])
> AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff,
> AC_TRY_COMPILE([
> #include <time.h>
> Index: mail/ChangeLog
> ===================================================================
> RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
> retrieving revision 1.2789
> diff -u -p -r1.2789 ChangeLog
> --- mail/ChangeLog 14 Aug 2003 21:06:59 -0000 1.2789
> +++ mail/ChangeLog 15 Aug 2003 09:59:46 -0000
> @@ -1,3 +1,7 @@
> +2003-08-15 David Woodhouse <dwmw2 infradead org>
> +
> + * mail-format.c (write_date): Show date in localtime too.
> +
> 2003-08-13 Suresh Chandrasekharan <suresh chandrasekharan sun com>
>
> * e-searching-tokenizer.c (searcher_next_token): Fix for 45818 (
> Index: mail/mail-format.c
> ===================================================================
> RCS file: /cvs/gnome/evolution/mail/mail-format.c,v
> retrieving revision 1.292
> diff -u -p -r1.292 mail-format.c
> --- mail/mail-format.c 11 Aug 2003 18:07:43 -0000 1.292
> +++ mail/mail-format.c 15 Aug 2003 09:59:47 -0000
> @@ -48,6 +48,7 @@
> #include <camel/camel-mime-filter-windows.h>
>
> #include <e-util/e-trie.h>
> +#include <e-util/e-time-utils.h>
>
> #include "mail.h"
> #include "mail-tools.h"
> @@ -774,6 +775,10 @@ write_field_row_begin (MailDisplayStream
> }
> }
>
> +static char *tz_days [] = {
> + "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
> +};
> +
> static void
> write_date (MailDisplayStream *stream, CamelMimeMessage *message, int flags)
> {
> @@ -782,8 +787,46 @@ write_date (MailDisplayStream *stream, C
> datestr = camel_medium_get_header (CAMEL_MEDIUM (message), "Date");
>
> if (datestr) {
> + int msg_offset;
> + time_t msg_date;
> + struct tm local;
> + int local_tz;
> +
> + msg_date = header_decode_date(datestr, &msg_offset);
> + e_localtime_with_offset(msg_date, &local, &local_tz);
> +
> write_field_row_begin (stream, _("Date"), flags);
> - camel_stream_printf ((CamelStream *) stream, "%s</td> </tr>", datestr);
> + camel_stream_printf ((CamelStream *) stream, "%s", datestr);
> +
> + /* Convert message offset to minutes (e.g. -0400 --> -240) */
> + msg_offset = ((msg_offset / 100) * 60) + (msg_offset % 100);
> + /* Turn into offset from localtime, not UTC */
> + msg_offset -= local_tz / 60;
> +
> + if (msg_offset) {
> + /* Message timezone different from local. Show both */
> + camel_stream_printf ((CamelStream *) stream,
> + "<I> (");
> +
> + msg_offset += (local.tm_hour * 60) + local.tm_min;
> + if (msg_offset > 1439 || msg_offset < 0) {
> + /* Timezone conversion crossed midnight. Show day */
> + camel_stream_printf ((CamelStream *) stream,
> + "%s ",
> + tz_days[local.tm_wday]);
> + }
> + camel_stream_printf ((CamelStream *) stream,
> + "%02d:%02d %s)</I>",
> + local.tm_hour, local.tm_min,
> +#if defined (HAVE_STRUCT_TM_TM_ZONE)
> + local.tm_zone?:
> +#endif
> + "localtime"
> + );
> + }
> +
> + camel_stream_printf ((CamelStream *) stream, "</td> </tr>");
> +
> }
> }
>
>
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]