1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
#include "print.h"
#include "print-page-setup.h"
#include "print-utils.h"
#define PRINT_PAGE_SETUP_NAME "print-page-setup"
#ifndef EMBED_PAGE_SETUP
void
print_page_setup_dialog (GtkPrintOperation *operation)
{
GtkPrintSettings *settings;
GtkPageSetup *setup;
g_return_if_fail (GTK_IS_PRINT_OPERATION (operation));
setup = gtk_print_operation_get_default_page_setup (operation);
settings = gtk_print_settings_new ();
setup = gtk_print_run_page_setup_dialog (NULL, setup, settings);
g_object_unref (settings);
gtk_print_operation_set_default_page_setup (operation, setup);
}
#endif
void
print_page_setup_load (GtkPrintOperation *operation,
gint32 image_ID)
{
GKeyFile *key_file;
g_return_if_fail (GTK_IS_PRINT_OPERATION (operation));
key_file = print_utils_key_file_load_from_parasite (image_ID,
PRINT_PAGE_SETUP_NAME);
if (! key_file)
key_file = print_utils_key_file_load_from_rcfile (PRINT_PAGE_SETUP_NAME);
if (key_file)
{
GtkPageSetup *setup;
setup = gtk_page_setup_new_from_key_file (key_file,
PRINT_PAGE_SETUP_NAME, NULL);
if (setup)
{
gtk_print_operation_set_default_page_setup (operation, setup);
g_object_unref (setup);
}
g_key_file_free (key_file);
}
}
void
print_page_setup_save (GtkPrintOperation *operation,
gint32 image_ID)
{
GtkPageSetup *setup;
GKeyFile *key_file;
g_return_if_fail (GTK_IS_PRINT_OPERATION (operation));
key_file = g_key_file_new ();
setup = gtk_print_operation_get_default_page_setup (operation);
gtk_page_setup_to_key_file (setup, key_file, PRINT_PAGE_SETUP_NAME);
print_utils_key_file_save_as_parasite (key_file,
image_ID, PRINT_PAGE_SETUP_NAME);
print_utils_key_file_save_as_rcfile (key_file,
PRINT_PAGE_SETUP_NAME);
g_key_file_free (key_file);
}
|