aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorDan Vrátil <dvratil@redhat.com>2012-06-08 22:09:53 +0800
committerDan Vrátil <dvratil@redhat.com>2012-06-08 23:08:00 +0800
commitc4071b0a1d38a478d3ba51c81af222cdeb4ed4fd (patch)
tree52b0f8825f9defd6accf554c5b26ae1c8c7ead94 /mail
parenta601031be2fa34f3f860179c8448cc0b04d4bfa4 (diff)
downloadgsoc2013-evolution-c4071b0a1d38a478d3ba51c81af222cdeb4ed4fd.tar.gz
gsoc2013-evolution-c4071b0a1d38a478d3ba51c81af222cdeb4ed4fd.tar.zst
gsoc2013-evolution-c4071b0a1d38a478d3ba51c81af222cdeb4ed4fd.zip
Fix displayed message headers
The new formatter was ignoring selected headers, always displaying only From, To, Subject and Date (default headers). Handling of the currently displayed headers has been moved to EMailConfigFormatHTML extension, because it is related to configuration of EMailFormatter, rather then EMailReader.
Diffstat (limited to 'mail')
-rw-r--r--mail/e-mail-display.c2
-rw-r--r--mail/e-mail-reader-utils.c107
-rw-r--r--mail/e-mail-reader-utils.h3
-rw-r--r--mail/e-mail-reader.c1
4 files changed, 2 insertions, 111 deletions
diff --git a/mail/e-mail-display.c b/mail/e-mail-display.c
index 4f72e843f6..33922d8c0a 100644
--- a/mail/e-mail-display.c
+++ b/mail/e-mail-display.c
@@ -1552,6 +1552,8 @@ e_mail_display_set_mode (EMailDisplay *display,
G_CALLBACK (e_mail_display_reload), display,
"swapped-signal::notify::header-color",
G_CALLBACK (e_mail_display_reload), display,
+ "swapped-signal::need-redraw",
+ G_CALLBACK (e_mail_display_reload), display,
NULL);
e_mail_display_reload (display);
diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c
index f18d881ba2..d1c3d3d7e5 100644
--- a/mail/e-mail-reader-utils.c
+++ b/mail/e-mail-reader-utils.c
@@ -1536,113 +1536,6 @@ e_mail_reader_header_free (EMailReaderHeader *header)
g_free (header);
}
-struct headers_changed_closure {
- EMailFormatter *formatter;
- EMailDisplay *display;
-};
-
-static void
-free_headers_changed_closure (struct headers_changed_closure *closure)
-{
- g_clear_object (&closure->formatter);
- g_clear_object (&closure->display);
-
- g_free (closure);
-}
-
-static void
-headers_changed_cb (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- struct headers_changed_closure *closure)
-{
- GSList *header_config_list, *p;
-
- g_return_if_fail (client != NULL);
-
- header_config_list = gconf_client_get_list (
- client, "/apps/evolution/mail/display/headers",
- GCONF_VALUE_STRING, NULL);
-
- e_mail_formatter_clear_headers (closure->formatter);
- for (p = header_config_list; p; p = g_slist_next (p)) {
- EMailReaderHeader *h;
- gchar *xml = (gchar *) p->data;
-
- h = e_mail_reader_header_from_xml (xml);
- if (h && h->enabled)
- e_mail_formatter_add_header (
- closure->formatter, h->name, NULL,
- E_MAIL_FORMATTER_HEADER_FLAG_BOLD);
-
- e_mail_reader_header_free (h);
- }
-
- if (!header_config_list)
- e_mail_formatter_set_default_headers (closure->formatter);
-
- g_slist_foreach (header_config_list, (GFunc) g_free, NULL);
- g_slist_free (header_config_list);
-
- /* force a redraw */
- if (closure->display) {
- e_mail_display_reload (closure->display);
- }
-}
-
-static void
-remove_header_notify_cb (gpointer data)
-{
- GConfClient *client;
- guint notify_id;
-
- notify_id = GPOINTER_TO_INT (data);
- g_return_if_fail (notify_id != 0);
-
- client = gconf_client_get_default ();
- gconf_client_notify_remove (client, notify_id);
- gconf_client_remove_dir (client, "/apps/evolution/mail/display", NULL);
- g_object_unref (client);
-}
-
-/**
- * e_mail_reader_connect_headers
- * @reader: an #EMailReader
- *
- * Connects @reader to listening for changes in headers and
- * updates the EMFormat whenever it changes and on this call too.
- **/
-void
-e_mail_reader_connect_headers (EMailReader *reader,
- EMailFormatter *formatter)
-{
- GConfClient *client;
- guint notify_id;
- struct headers_changed_closure *closure;
-
- client = gconf_client_get_default ();
-
- closure = g_new0 (struct headers_changed_closure, 1);
- closure->display = g_object_ref (e_mail_reader_get_mail_display (reader));
- closure->formatter = g_object_ref (formatter);
-
- gconf_client_add_dir (
- client, "/apps/evolution/mail/display",
- GCONF_CLIENT_PRELOAD_NONE, NULL);
- notify_id = gconf_client_notify_add (
- client, "/apps/evolution/mail/display/headers",
- (GConfClientNotifyFunc) headers_changed_cb,
- closure, (GFreeFunc) free_headers_changed_closure, NULL);
-
- g_object_set_data_full (
- G_OBJECT (formatter), "reader-header-notify-id",
- GINT_TO_POINTER (notify_id), remove_header_notify_cb);
-
- headers_changed_cb (client, 0, NULL, closure);
-
- g_object_unref (client);
-}
-
static GHashTable *
mail_reader_get_mail_register (void)
{
diff --git a/mail/e-mail-reader-utils.h b/mail/e-mail-reader-utils.h
index 887e399451..a3a1cdb86d 100644
--- a/mail/e-mail-reader-utils.h
+++ b/mail/e-mail-reader-utils.h
@@ -67,9 +67,6 @@ EMailReaderHeader *
gchar * e_mail_reader_header_to_xml (EMailReaderHeader *header);
void e_mail_reader_header_free (EMailReaderHeader *header);
-void e_mail_reader_connect_headers (EMailReader *reader,
- EMailFormatter *formatter);
-
EMailPartList * e_mail_reader_lookup_part_list (EMailReader *reader,
const gchar *uri);
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index 3d0911b1fc..069f064953 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -4768,5 +4768,4 @@ e_mail_reader_set_formatter (EMailReader *reader,
priv->formatter = formatter;
- e_mail_reader_connect_headers (reader, formatter);
}