Fix printing of empty pages when the selected part
authorColin Leroy <colin@colino.net>
Sat, 9 Nov 2019 21:45:17 +0000 (22:45 +0100)
committerColin Leroy <colin@colino.net>
Sat, 9 Nov 2019 21:45:17 +0000 (22:45 +0100)
is rendered with a plugin not implementing print.

src/messageview.c
src/mimeview.c
src/mimeview.h

index 2f7a828..b4fc183 100644 (file)
@@ -2180,6 +2180,10 @@ static void print_mimeview(MimeView *mimeview, gint sel_start, gint sel_end, gin
                        if (viewer && viewer->print) {
                                viewer->print(viewer);
                                return;
+                       } else {
+                               /* Force text rendering */
+                               mimeview_show_part_as_text(mimeview,
+                                                          mimeview_get_selected_part(mimeview));
                        }
                }
                if (sel_start != -1 && sel_end != -1) {
index bb14a60..28dd069 100644 (file)
@@ -1430,6 +1430,14 @@ static void update_signature_info(MimeView *mimeview, MimeInfo *selected)
        noticeview_show(mimeview->siginfoview);
 }
 
+void mimeview_show_part_as_text(MimeView *mimeview, MimeInfo *partinfo)
+{
+       cm_return_if_fail(mimeview != NULL);
+       cm_return_if_fail(partinfo != NULL);
+
+       mimeview_show_message_part(mimeview, partinfo);
+}
+
 static void mimeview_selected(GtkTreeSelection *selection, MimeView *mimeview)
 {
        GtkTreeView *ctree = GTK_TREE_VIEW(mimeview->ctree);
index e520d55..2f87b8c 100644 (file)
@@ -147,6 +147,8 @@ void mimeview_show_message  (MimeView       *mimeview,
                                 const gchar    *file);
 gboolean mimeview_show_part    (MimeView       *mimeview, 
                                 MimeInfo       *partinfo);
+void mimeview_show_part_as_text (MimeView *mimeview,
+                                MimeInfo *partinfo);
 void mimeview_destroy          (MimeView       *mimeview);
 void mimeview_update           (MimeView       *mimeview);
 void mimeview_clear            (MimeView       *mimeview);