[evolution/webkit: 98/182] Fix displaying and toggling default mail headers



commit 98788d2aa47f6d89623efa31cd93a7bebb1b60dd
Author: Dan VrÃtil <dvratil redhat com>
Date:   Wed Jan 4 17:05:55 2012 +0100

    Fix displaying and toggling default mail headers
    
    Resolves a FIXME and some build-time warnings

 mail/e-mail-browser.c      |    2 --
 mail/e-mail-paned-view.c   |    2 --
 mail/e-mail-reader-utils.c |   36 +++++++++++++-----------------------
 mail/e-mail-reader-utils.h |    3 ++-
 mail/e-mail-reader.c       |    2 ++
 5 files changed, 17 insertions(+), 28 deletions(-)
---
diff --git a/mail/e-mail-browser.c b/mail/e-mail-browser.c
index 6e8a46a..2bb22d3 100644
--- a/mail/e-mail-browser.c
+++ b/mail/e-mail-browser.c
@@ -711,8 +711,6 @@ mail_browser_constructed (GObject *object)
 	e_plugin_ui_register_manager (ui_manager, id, object);
 	e_plugin_ui_enable_manager (ui_manager, id);
 
-	e_mail_reader_connect_headers (E_MAIL_READER (reader));
-
 	e_extensible_load_extensions (E_EXTENSIBLE (object));
 }
 
diff --git a/mail/e-mail-paned-view.c b/mail/e-mail-paned-view.c
index f132156..6c2cedd 100644
--- a/mail/e-mail-paned-view.c
+++ b/mail/e-mail-paned-view.c
@@ -735,8 +735,6 @@ mail_paned_view_constructed (GObject *object)
 		G_CALLBACK (mail_paned_view_restore_state_cb),
 		object);
 
-	e_mail_reader_connect_headers (reader);
-
 	/* Do this after creating the message list.  Our
 	 * set_preview_visible() method relies on it. */
 	e_mail_view_set_preview_visible (view, TRUE);
diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c
index 7f81ad4..aea0a0e 100644
--- a/mail/e-mail-reader-utils.c
+++ b/mail/e-mail-reader-utils.c
@@ -1375,26 +1375,18 @@ static void
 headers_changed_cb (GConfClient *client,
                     guint cnxn_id,
                     GConfEntry *entry,
-                    EMailReader *reader)
+                    EMFormat *emf)
 {
-	EMailDisplay *display;
-	EMFormatHTML *formatter;
 	GSList *header_config_list, *p;
 
 	g_return_if_fail (client != NULL);
-	g_return_if_fail (reader != NULL);
-
-	display = e_mail_reader_get_mail_display (reader);
-	formatter = e_mail_display_get_formatter (display);
-
-	if (!formatter)
-		return;
+	g_return_if_fail (EM_IS_FORMAT (emf));
 
 	header_config_list = gconf_client_get_list (
 		client, "/apps/evolution/mail/display/headers",
 		GCONF_VALUE_STRING, NULL);
-	/* FIXME WEBKIT
-	em_format_clear_headers (EM_FORMAT (formatter));
+
+	em_format_clear_headers (emf);
 	for (p = header_config_list; p; p = g_slist_next (p)) {
 		EMailReaderHeader *h;
 		gchar *xml = (gchar *) p->data;
@@ -1402,23 +1394,20 @@ headers_changed_cb (GConfClient *client,
 		h = e_mail_reader_header_from_xml (xml);
 		if (h && h->enabled)
 			em_format_add_header (
-				EM_FORMAT (formatter),
-				h->name, EM_FORMAT_HEADER_BOLD);
+				emf, h->name, NULL, EM_FORMAT_HEADER_BOLD);
 
 		e_mail_reader_header_free (h);
 	}
 
 	if (!header_config_list)
-		em_format_default_headers (EM_FORMAT (formatter));
+		em_format_default_headers (emf);
 
 	g_slist_foreach (header_config_list, (GFunc) g_free, NULL);
 	g_slist_free (header_config_list);
-	*/
 
 	/* force a redraw */
-	if (EM_FORMAT (formatter)->message) {
-		e_mail_display_reload (display);
-	}
+	if (emf->message)
+		em_format_redraw (emf);
 }
 
 static void
@@ -1444,7 +1433,8 @@ remove_header_notify_cb (gpointer data)
  * updates the EMFormat whenever it changes and on this call too.
  **/
 void
-e_mail_reader_connect_headers (EMailReader *reader)
+e_mail_reader_connect_headers (EMailReader *reader,
+			       EMFormat *emf)
 {
 	GConfClient *client;
 	guint notify_id;
@@ -1457,13 +1447,13 @@ e_mail_reader_connect_headers (EMailReader *reader)
 	notify_id = gconf_client_notify_add (
 		client, "/apps/evolution/mail/display/headers",
 		(GConfClientNotifyFunc) headers_changed_cb,
-		reader, NULL, NULL);
+		emf, NULL, NULL);
 
 	g_object_set_data_full (
-		G_OBJECT (reader), "reader-header-notify-id",
+		G_OBJECT (emf), "reader-header-notify-id",
 		GINT_TO_POINTER (notify_id), remove_header_notify_cb);
 
-	headers_changed_cb (client, 0, NULL, reader);
+	headers_changed_cb (client, 0, NULL, emf);
 
 	g_object_unref (client);
 }
diff --git a/mail/e-mail-reader-utils.h b/mail/e-mail-reader-utils.h
index bb4671b..6913d09 100644
--- a/mail/e-mail-reader-utils.h
+++ b/mail/e-mail-reader-utils.h
@@ -67,7 +67,8 @@ 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);
+void		e_mail_reader_connect_headers	(EMailReader *reader,
+						 EMFormat *emf);
 
 G_END_DECLS
 
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index fd2bc30..3dd98e8 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -3030,6 +3030,8 @@ mail_reader_message_loaded (EMailReader *reader,
 		EM_FORMAT (formatter)->message_uid = g_strdup (message_uid);
 		EM_FORMAT (formatter)->uri_base = g_strdup (mail_uri);
 
+		e_mail_reader_connect_headers (reader, EM_FORMAT (formatter));
+
 		/* FIXME WEBKIT Not passing GCancellable */
 		em_format_parse_async (EM_FORMAT (formatter), message, folder,
 			NULL, format_parser_async_done_cb, reader);



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