mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-01 00:11:29 +00:00
Save PageSetup into print settings file used by the print previewer
Fixes bug #578271
This commit is contained in:
parent
5261d14d6f
commit
d77156952d
@ -183,6 +183,10 @@ _gtk_print_operation_platform_backend_launch_preview (GtkPrintOperation *op,
|
|||||||
gchar *preview_cmd;
|
gchar *preview_cmd;
|
||||||
GtkSettings *settings;
|
GtkSettings *settings;
|
||||||
GtkPrintSettings *print_settings;
|
GtkPrintSettings *print_settings;
|
||||||
|
GtkPageSetup *page_setup;
|
||||||
|
GKeyFile *key_file = NULL;
|
||||||
|
gchar *data = NULL;
|
||||||
|
gsize data_len;
|
||||||
gchar *settings_filename = NULL;
|
gchar *settings_filename = NULL;
|
||||||
gchar *quoted_filename;
|
gchar *quoted_filename;
|
||||||
gchar *quoted_settings_filename;
|
gchar *quoted_settings_filename;
|
||||||
@ -204,10 +208,19 @@ _gtk_print_operation_platform_backend_launch_preview (GtkPrintOperation *op,
|
|||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
print_settings = gtk_print_operation_get_print_settings (op);
|
key_file = g_key_file_new ();
|
||||||
retval = gtk_print_settings_to_file (print_settings, settings_filename, &error);
|
|
||||||
close (fd);
|
|
||||||
|
|
||||||
|
print_settings = gtk_print_operation_get_print_settings (op);
|
||||||
|
gtk_print_settings_to_key_file (print_settings, key_file, NULL);
|
||||||
|
|
||||||
|
page_setup = gtk_print_context_get_page_setup (op->priv->print_context);
|
||||||
|
gtk_page_setup_to_key_file (page_setup, key_file, NULL);
|
||||||
|
|
||||||
|
data = g_key_file_to_data (key_file, &data_len, &error);
|
||||||
|
if (!data)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
retval = g_file_set_contents (settings_filename, data, data_len, &error);
|
||||||
if (!retval)
|
if (!retval)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
@ -259,6 +272,12 @@ _gtk_print_operation_platform_backend_launch_preview (GtkPrintOperation *op,
|
|||||||
if (!settings_used)
|
if (!settings_used)
|
||||||
g_unlink (settings_filename);
|
g_unlink (settings_filename);
|
||||||
|
|
||||||
|
if (fd > 0)
|
||||||
|
close (fd);
|
||||||
|
|
||||||
|
if (key_file)
|
||||||
|
g_key_file_free (key_file);
|
||||||
|
g_free (data);
|
||||||
g_free (settings_filename);
|
g_free (settings_filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user