[evolution/gnome-2-28] Bug #597582 - Original Date: header should be given precedence
- From: Milan Crha <mcrha src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [evolution/gnome-2-28] Bug #597582 - Original Date: header should be given precedence
- Date: Thu, 5 Nov 2009 14:05:02 +0000 (UTC)
commit ce3cee9fae245bf86fa6cf2848cf792ca72242ae
Author: David Woodhouse <David Woodhouse intel com>
Date: Thu Nov 5 15:04:22 2009 +0100
Bug #597582 - Original Date: header should be given precedence
mail/em-folder-view.c | 10 ++++++++++
mail/em-format-html.c | 39 ++++++++++++++++++++++++---------------
mail/em-format.h | 1 +
3 files changed, 35 insertions(+), 15 deletions(-)
---
diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c
index 5923e6e..b792cd5 100644
--- a/mail/em-folder-view.c
+++ b/mail/em-folder-view.c
@@ -2930,6 +2930,7 @@ enum {
EMFV_PANED_SIZE,
EMFV_SENDER_PHOTO,
EMFV_PHOTO_LOCAL,
+ EMFV_SHOW_REAL_DATE,
EMFV_SETTINGS /* last, for loop count */
};
@@ -2951,6 +2952,7 @@ static const gchar * const emfv_display_keys[] = {
"paned_size",
"sender_photo",
"photo_local",
+ "show_real_date"
};
static GHashTable *emfv_setting_key;
@@ -3120,6 +3122,14 @@ emfv_setting_notify(GConfClient *gconf, guint cnxn_id, GConfEntry *entry, EMFold
gtk_paned_set_position (GTK_PANED (emfb->vpane), paned_size);
break; }
+ case EMFV_SHOW_REAL_DATE: {
+ EMFormat *emf = (EMFormat *)emfv->preview;
+
+ emf->show_real_date = gconf_value_get_bool (value);
+ if (emf->message)
+ em_format_redraw (emf);
+
+ break; }
}
}
diff --git a/mail/em-format-html.c b/mail/em-format-html.c
index 038ca4b..bf3bec0 100644
--- a/mail/em-format-html.c
+++ b/mail/em-format-html.c
@@ -1751,38 +1751,47 @@ efh_format_header(EMFormat *emf, CamelStream *stream, CamelMedium *part, struct
gint msg_offset, local_tz;
time_t msg_date;
struct tm local;
- gchar *date_str;
+ gchar *html;
+ gboolean hide_real_date;
+
+ hide_real_date = !emf->show_real_date;
txt = header->value;
while (*txt == ' ' || *txt == '\t')
txt++;
+ html = camel_text_to_html (txt, efh->text_html_flags, 0);
+
msg_date = camel_header_decode_date(txt, &msg_offset);
e_localtime_with_offset (msg_date, &local, &local_tz);
- date_str = e_datetime_format_format ("mail", "header", DTFormatKindDateTime, msg_date);
-
/* 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) {
- gchar *html;
+ /* value will be freed at the end */
+ if (!hide_real_date && !msg_offset) {
+ /* No timezone difference; just show the real Date: header */
+ txt = value = html;
+ } else {
+ gchar *date_str;
- html = camel_text_to_html (txt, efh->text_html_flags, 0);
- txt = value = g_strdup_printf ("%s (<I>%s</I>)", date_str, html);
+ date_str = e_datetime_format_format ("mail", "header",
+ DTFormatKindDateTime, msg_date);
+ if (hide_real_date) {
+ /* Show only the local-formatted date, losing all timezone
+ information like Outlook does. Should we attempt to show
+ it somehow? */
+ txt = value = date_str;
+ } else {
+ txt = value = g_strdup_printf ("%s (<I>%s</I>)", html, date_str);
+ g_free (date_str);
+ }
g_free (html);
- g_free (date_str);
-
- flags |= EM_FORMAT_HTML_HEADER_HTML;
- } else {
- /* date_str will be freed at the end */
- txt = value = date_str;
}
-
- flags |= EM_FORMAT_HEADER_BOLD;
+ flags |= EM_FORMAT_HTML_HEADER_HTML | EM_FORMAT_HEADER_BOLD;
} else if (!strcmp(name, "Newsgroups")) {
struct _camel_header_newsgroup *ng, *scan;
GString *html;
diff --git a/mail/em-format.h b/mail/em-format.h
index b3af1e8..4637278 100644
--- a/mail/em-format.h
+++ b/mail/em-format.h
@@ -250,6 +250,7 @@ struct _EMFormat {
gboolean print;
gboolean show_photo; /* Want to show the photo of the sender ?*/
gboolean photo_local; /* Photos only from local addressbooks */
+ gboolean show_real_date;
};
struct _EMFormatClass {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]