Re: [evolution-patches] [PATCH] Show date in localtime.



this probably needs anna's approval.

the code looks ok tho...

Jeff

On Thu, 2003-06-26 at 13:04, David Woodhouse wrote:
> When someone sends you a mail in a timezone other than your own, it's
> not immediately clear what your _local_ time equivalent is. 
> 
> This adds it in parentheses after the real contents of the Date: header.
> Nothing in the real Date: header is lost and the additional information
> should be subtle enough that its presence doesn't offend anyone who
> doesn't actually need it.
> 
> Index: ChangeLog
> ===================================================================
> RCS file: /cvs/gnome/evolution/ChangeLog,v
> retrieving revision 1.1214
> diff -u -p -r1.1214 ChangeLog
> --- ChangeLog	23 Jun 2003 14:07:07 -0000	1.1214
> +++ ChangeLog	24 Jun 2003 21:11:23 -0000
> @@ -1,3 +1,7 @@
> +2003-02-24  David Woodhouse  <dwmw2 infradead org>
> +
> +	* configure.in: Check for tm_zone in struct tm.
> +
>  2003-06-23  Ettore Perazzoli  <ettore ximian com>
>  
>  	* data/Makefile.am: Added implicity rule to subst @BASE_VERSION@
> Index: configure.in
> ===================================================================
> RCS file: /cvs/gnome/evolution/configure.in,v
> retrieving revision 1.590
> diff -u -p -r1.590 configure.in
> --- configure.in	19 Jun 2003 17:27:29 -0000	1.590
> +++ configure.in	24 Jun 2003 21:11:25 -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.2755
> diff -u -p -r1.2755 ChangeLog
> --- mail/ChangeLog	23 Jun 2003 20:26:09 -0000	1.2755
> +++ mail/ChangeLog	24 Jun 2003 21:11:25 -0000
> @@ -1,3 +1,8 @@
> +2002-06-24  David Woodhouse  <dwmw2 infradead org>
> +
> +	* mail-format.c (write_date): Display message date in
> +	localtime too, if it's different.
> +
>  2003-06-23  Dan Winship  <danw ximian com>
>  
>  	* message-list.c (on_selection_changed_cmd): Save the idle_id
> Index: mail/mail-format.c
> ===================================================================
> RCS file: /cvs/gnome/evolution/mail/mail-format.c,v
> retrieving revision 1.286
> diff -u -p -r1.286 mail-format.c
> --- mail/mail-format.c	12 Jun 2003 04:47:32 -0000	1.286
> +++ mail/mail-format.c	24 Jun 2003 21:11:27 -0000
> @@ -48,6 +48,7 @@
>  #include <camel/camel-mime-filter-tohtml.h>
>  
>  #include <e-util/e-trie.h>
> +#include <e-util/e-time-utils.h>
>  
>  #include "mail.h"
>  #include "mail-tools.h"
> @@ -782,8 +783,32 @@ 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);
> +
> +		
> +		if (msg_offset != 
> +		    (((local_tz/60/60) * 100) + (local_tz/60 % 60))) {
> +			camel_stream_printf ((CamelStream *) stream, 
> +					     "<I> (%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>");
> +
>  	}
>  }
>  
-- 
Jeffrey Stedfast
Evolution Hacker - Ximian, Inc.
fejj ximian com  - www.ximian.com




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]