diff options
Diffstat (limited to 'mail/e-mail-reader-utils.c')
-rw-r--r-- | mail/e-mail-reader-utils.c | 107 |
1 files changed, 0 insertions, 107 deletions
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) { |