From e188aba01b54c93555963969f008a04c3ca3fa0b Mon Sep 17 00:00:00 2001 From: Srinivasa Ragavan Date: Fri, 5 Oct 2007 05:45:28 +0000 Subject: ** Fix for bug #468736 svn path=/trunk/; revision=34355 --- mail/ChangeLog | 8 ++++++++ mail/em-folder-view.c | 3 +++ mail/em-format.c | 32 ++++++++++++++++++++++++++++++++ mail/em-format.h | 1 + 4 files changed, 44 insertions(+) diff --git a/mail/ChangeLog b/mail/ChangeLog index 98b078f75c..22f373fb35 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,11 @@ +2007-10-05 Srinivasa Ragavan + + ** Fix for bug #468736 + + * em-folder-view.c: (em_folder_view_print): + * em-format.c: (merge_missing), (em_format_merge_handler): + * em-format.h: + 2007-10-04 Matthew Barnes ** Fixes part of bug #477045 diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c index 200422848a..b7d80bac03 100644 --- a/mail/em-folder-view.c +++ b/mail/em-folder-view.c @@ -2197,6 +2197,9 @@ em_folder_view_print (EMFolderView *emfv, GtkPrintOperationAction action) em_format_set_session ( (EMFormat *) efhp, ((EMFormat *) emfv->preview)->session); + em_format_merge_handler ((EMFormat *) efhp, + (EMFormat *) emfv->preview); + em_format_html_print_message ( efhp, emfv->folder, uids->pdata[0]); g_object_unref (efhp); diff --git a/mail/em-format.c b/mail/em-format.c index ce820cab11..aa54470409 100644 --- a/mail/em-format.c +++ b/mail/em-format.c @@ -224,6 +224,38 @@ em_format_class_add_handler(EMFormatClass *emfc, EMFormatHandler *info) g_hash_table_insert(emfc->type_handlers, info->mime_type, info); } +struct _class_handlers { + EMFormatClass *old; + EMFormatClass *new; +}; +static void +merge_missing (gpointer key, gpointer value, gpointer userdata) +{ + struct _class_handlers *classes = (struct _class_handlers *) userdata; + EMFormatHandler *info, *oldinfo; + + oldinfo = (EMFormatHandler *) value; + info = g_hash_table_lookup (classes->new->type_handlers, key); + if (!info) { + /* Might be from a plugin */ + g_hash_table_insert (classes->new->type_handlers, key, value); + } + +} + +void +em_format_merge_handler(EMFormat *new, EMFormat *old) +{ + EMFormatClass *oldc = (EMFormatClass *)G_OBJECT_GET_CLASS(old); + EMFormatClass *newc = (EMFormatClass *)G_OBJECT_GET_CLASS(new); + struct _class_handlers fclasses; + + fclasses.old = oldc; + fclasses.new = newc; + + g_hash_table_foreach (oldc->type_handlers, merge_missing, &fclasses); + +} /** * em_format_class_remove_handler: * @emfc: diff --git a/mail/em-format.h b/mail/em-format.h index abe17f03cc..81f4b5c508 100644 --- a/mail/em-format.h +++ b/mail/em-format.h @@ -328,5 +328,6 @@ void em_format_format_text(EMFormat *emf, struct _CamelStream *stream, struct _C void em_format_part_as(EMFormat *emf, struct _CamelStream *stream, struct _CamelMimePart *part, const char *mime_type); void em_format_part(EMFormat *emf, struct _CamelStream *stream, struct _CamelMimePart *part); +void em_format_merge_handler(EMFormat *new, EMFormat *old); #endif /* ! _EM_FORMAT_H */ -- cgit v1.2.3