[geary/mjog/webkit-sandbox-print-to-pdf] ConversationEmail: Print to XDG_DOWNLOADS by default



commit 728c9e1cbefdbc3aa7b40bd640b900cdf5dd8553
Author: Michael Gratton <mike vee net>
Date:   Wed Feb 3 23:48:39 2021 +1100

    ConversationEmail: Print to XDG_DOWNLOADS by default
    
    We know that location is writable under Flatpak at the moment, so
    default it it.

 src/client/conversation-viewer/conversation-email.vala | 9 +++++++++
 1 file changed, 9 insertions(+)
---
diff --git a/src/client/conversation-viewer/conversation-email.vala 
b/src/client/conversation-viewer/conversation-email.vala
index 868f33a3b..d93831835 100644
--- a/src/client/conversation-viewer/conversation-email.vala
+++ b/src/client/conversation-viewer/conversation-email.vala
@@ -577,6 +577,15 @@ public class ConversationEmail : Gtk.Box, Geary.BaseInterface {
         WebKit.PrintOperation op = this.primary_message.new_print_operation();
         Gtk.PrintSettings settings = new Gtk.PrintSettings();
 
+        // Use XDG_DOWNLOADS as default while WebKitGTK printing is
+        // entirely b0rked on Flatpak, since we know at least have the
+        // RW filesystem override in place to allow printing to PDF to
+        // work, when using that directory.
+        var download_dir = GLib.Environment.get_user_special_dir(DOWNLOAD);
+        if (!Geary.String.is_empty_or_whitespace(download_dir)) {
+            settings.set(Gtk.PRINT_SETTINGS_OUTPUT_DIR, download_dir);
+        }
+
         if (this.email.subject != null) {
             string file_name = Geary.String.reduce_whitespace(this.email.subject.value);
             file_name = file_name.replace("/", "_");


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