evolution/bnc-302017-print-100pc.diff

69 lines
2.2 KiB
Diff

Index: mail/em-format.c
===================================================================
--- mail/em-format.c (revision 34224)
+++ mail/em-format.c (working copy)
@@ -224,6 +224,38 @@ em_format_class_add_handler(EMFormatClas
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:
Index: mail/em-format.h
===================================================================
--- mail/em-format.h (revision 34224)
+++ mail/em-format.h (working copy)
@@ -328,5 +328,6 @@ void em_format_format_text(EMFormat *emf
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 */
Index: mail/em-folder-view.c
===================================================================
--- mail/em-folder-view.c (revision 34224)
+++ mail/em-folder-view.c (working copy)
@@ -2193,6 +2193,9 @@ em_folder_view_print (EMFolderView *emfv
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);