GnuCash  5.6-133-gc519490283+
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. More...
 
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. More...
 
void gnc_ui_page_setup (GtkWindow *parent)
 Run a page setup dialog and save the resulting GtkPageSetup in a static variable. More...
 
GtkPrintSettings * gnc_print_get_settings (void)
 Returns the pointer to our static GtkPrintSettings object. More...
 

Detailed Description

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 108 of file print-session.c.

109 {
110  return print_settings;
111 }

◆ 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  gtk_print_operation_set_print_settings(op, print_settings);
59  G_UNLOCK(print_settings);
60 
61  /* Restore page setup */
62  G_LOCK(page_setup);
63  if (page_setup)
64  gtk_print_operation_set_default_page_setup(op, page_setup);
65  G_UNLOCK(page_setup);
66 
67  gtk_print_operation_set_job_name ( op, jobname);
68 }

◆ 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 71 of file print-session.c.

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