[evolution] Custom page setup not properly restored when printing



commit 43830a9058146134b547cea1676553d2f11df249
Author: Milan Crha <mcrha redhat com>
Date:   Tue Aug 29 14:25:21 2017 +0200

    Custom page setup not properly restored when printing
    
    Using standard and then custom page size saved it into the printing.ini
    with keys related to standard page size and the print dialog preferred
    the standard size over the custom. Removing the group from the key file
    first makes this work properly. Do the same for printer settings.
    Also allow changing page size in the print dialog, but do not save it.

 src/e-util/e-print.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/e-util/e-print.c b/src/e-util/e-print.c
index 0a2ab1c..6a16714 100644
--- a/src/e-util/e-print.c
+++ b/src/e-util/e-print.c
@@ -122,7 +122,10 @@ save_settings (GtkPrintSettings *settings,
        gtk_print_settings_unset (settings, GTK_PRINT_SETTINGS_PAGE_SET);
        gtk_print_settings_unset (settings, GTK_PRINT_SETTINGS_PRINT_PAGES);
 
-       gtk_print_settings_to_key_file (settings, key_file, NULL);
+       /* Remove old values first */
+       g_key_file_remove_group (key_file, PRINT_SETTINGS_GROUP_NAME, NULL);
+
+       gtk_print_settings_to_key_file (settings, key_file, PRINT_SETTINGS_GROUP_NAME);
 }
 
 static GtkPageSetup *
@@ -143,7 +146,10 @@ static void
 save_page_setup (GtkPageSetup *page_setup,
                  GKeyFile *key_file)
 {
-       gtk_page_setup_to_key_file (page_setup, key_file, NULL);
+       /* Remove old values first */
+       g_key_file_remove_group (key_file, PAGE_SETUP_GROUP_NAME, NULL);
+
+       gtk_page_setup_to_key_file (page_setup, key_file, PAGE_SETUP_GROUP_NAME);
 }
 
 static void
@@ -207,6 +213,8 @@ e_print_operation_new (void)
 
        operation = gtk_print_operation_new ();
 
+       gtk_print_operation_set_embed_page_setup (operation, TRUE);
+
        key_file = g_key_file_new ();
        load_key_file (key_file);
 


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