[balsa/gtk3] Actually print the HTML part



commit 0f90eafb3b4da7d789354f3922f42f1b745c2299
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Sat Apr 6 11:13:32 2013 -0400

    Actually print the HTML part
    
        * libbalsa/html.c (libbalsa_html_popup_menu_widget),
        (libbalsa_html_print): actually print the HTML part.

 ChangeLog       |    5 +++++
 libbalsa/html.c |   18 ++++++++++++++++--
 2 files changed, 21 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 85db419..fe22c40 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-04-06  Peter Bloomfield
+
+       * libbalsa/html.c (libbalsa_html_popup_menu_widget),
+       (libbalsa_html_print): actually print the HTML part.
+
 2013-04-05  Peter Bloomfield
 
        * libbalsa/html.c (lbh_context_menu_cb), (libbalsa_html_new):
diff --git a/libbalsa/html.c b/libbalsa/html.c
index ebe0b22..1483b9d 100644
--- a/libbalsa/html.c
+++ b/libbalsa/html.c
@@ -800,7 +800,6 @@ libbalsa_html_get_selection_bounds(GtkWidget    * widget,
 GtkWidget *
 libbalsa_html_popup_menu_widget(GtkWidget * widget)
 {
-    /* FIXME Need new API to access webkit2's "context-menu" signal */
     return NULL;
 }
 
@@ -833,10 +832,25 @@ libbalsa_html_print(GtkWidget * widget)
     WebKitWebView *web_view;
 
     if (lbh_get_web_view(widget, &web_view)) {
+        static GtkPrintSettings *settings = NULL;
         WebKitPrintOperation *print_operation;
+        WebKitPrintOperationResponse response;
+
+        if (!settings)
+            settings = gtk_print_settings_new();
 
         print_operation = webkit_print_operation_new(web_view);
-        webkit_print_operation_print(print_operation);
+        webkit_print_operation_set_print_settings(print_operation,
+                                                  settings);
+        response =
+            webkit_print_operation_run_dialog(print_operation, NULL);
+        if (response != WEBKIT_PRINT_OPERATION_RESPONSE_CANCEL) {
+            g_object_unref(settings);
+            settings =
+                webkit_print_operation_get_print_settings(print_operation);
+            g_object_ref(settings);
+        }
+        g_object_unref(print_operation);
     }
 }
 


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