GnuCash fec5643+
Loading...
Searching...
No Matches
Macros | Functions
Session Functions

Macros

#define GNC_GTK_PRINT_SETTINGS_EXPORT_DIR   "gnc-pdf-export-directory"
 Key for saving the PDF-export directory in the print settings.
 

Functions

void gnc_print_operation_save_print_settings (GtkPrintOperation *op)
 Retrieve the print settings from the GtkPrintOperation op and save them in a static variable.
 
void gnc_print_operation_init (GtkPrintOperation *op, const gchar *jobname)
 If print settings have been saved by gnc_print_operation_save_print_settings(), then set them on the given GtkPrintOperation op.
 
void gnc_ui_page_setup (GtkWindow *parent)
 Run a page setup dialog and save the resulting GtkPageSetup in a static variable.
 
GtkPrintSettings * gnc_print_get_settings (void)
 Returns the pointer to our static GtkPrintSettings object.
 

Detailed Description

Macro Definition Documentation

◆ GNC_GTK_PRINT_SETTINGS_EXPORT_DIR

#define GNC_GTK_PRINT_SETTINGS_EXPORT_DIR   "gnc-pdf-export-directory"

Key for saving the PDF-export directory in the print settings.

Definition at line 74 of file print-session.h.

Function Documentation

◆ gnc_print_get_settings()

GtkPrintSettings * gnc_print_get_settings ( void  )

Returns the pointer to our static GtkPrintSettings object.

Watch out: This might get modified by other threads.

Definition at line 113 of file print-session.c.

114{
115 return print_settings;
116}

◆ gnc_print_operation_init()

void gnc_print_operation_init ( GtkPrintOperation *  op,
const gchar *  jobname 
)

If print settings have been saved by gnc_print_operation_save_print_settings(), then set them on the given GtkPrintOperation op.

Set the default page setup as well.

Parameters
opnon-NULL print operation
jobnamenon-NULL print job name

Definition at line 51 of file print-session.c.

52{
53 g_return_if_fail(op);
54
55 /* Restore print settings */
56 G_LOCK(print_settings);
57 if (print_settings)
58 {
59 // Clear page range to prevent carryover from previous print jobs
60 gtk_print_settings_set(print_settings, GTK_PRINT_SETTINGS_PAGE_RANGES, NULL);
61 gtk_print_settings_set(print_settings, GTK_PRINT_SETTINGS_PAGE_SET, NULL);
62 gtk_print_operation_set_print_settings(op, print_settings);
63 }
64 G_UNLOCK(print_settings);
65
66 /* Restore page setup */
67 G_LOCK(page_setup);
68 if (page_setup)
69 gtk_print_operation_set_default_page_setup(op, page_setup);
70 G_UNLOCK(page_setup);
71
72 gtk_print_operation_set_job_name ( op, jobname);
73}

◆ gnc_print_operation_save_print_settings()

void gnc_print_operation_save_print_settings ( GtkPrintOperation *  op)

Retrieve the print settings from the GtkPrintOperation op and save them in a static variable.

Parameters
opnon-NULL print operation

Definition at line 39 of file print-session.c.

40{
41 g_return_if_fail(op);
42
43 G_LOCK(print_settings);
44 if (print_settings)
45 g_object_unref(print_settings);
46 print_settings = g_object_ref(gtk_print_operation_get_print_settings(op));
47 G_UNLOCK(print_settings);
48}

◆ gnc_ui_page_setup()

void gnc_ui_page_setup ( GtkWindow *  parent)

Run a page setup dialog and save the resulting GtkPageSetup in a static variable.

Parameters
parentTransient parent, or NULL

Definition at line 76 of file print-session.c.

77{
78 GtkPrintSettings *settings = NULL;
79 GtkPageSetup *old_page_setup, *new_page_setup;
80
81 /* Get a reference to the current print settings */
82 G_LOCK(print_settings);
83 settings = print_settings;
84 if (settings)
85 g_object_ref(settings);
86 G_UNLOCK(print_settings);
87
88 /* Get a reference to the current page setup */
89 G_LOCK(page_setup);
90 old_page_setup = page_setup;
91 if (old_page_setup)
92 g_object_ref(old_page_setup);
93 G_UNLOCK(page_setup);
94
95 /* Run dialog */
96 new_page_setup = gtk_print_run_page_setup_dialog(parent, old_page_setup,
97 settings);
98
99 /* Save new page setup */
100 G_LOCK(page_setup);
101 if (page_setup)
102 g_object_unref(page_setup);
103 page_setup = new_page_setup;
104 G_UNLOCK(page_setup);
105
106 /* Release references */
107 if (settings)
108 g_object_unref(settings);
109 if (old_page_setup)
110 g_object_unref(old_page_setup);
111}