GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
Session Functions

Macros

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

Functions

void gnc_print_operation_save_print_settings (GtkPrintOperation *op)
 
void gnc_print_operation_init (GtkPrintOperation *op, const gchar *jobname)
 
void gnc_ui_page_setup (GtkWindow *parent)
 
GtkPrintSettings * gnc_print_get_settings (void)
 

Detailed Description

Macro Definition Documentation

#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 70 of file print-session.h.

Function Documentation

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

117 {
118  return print_settings;
119 }
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 59 of file print-session.c.

60 {
61  g_return_if_fail(op);
62 
63  /* Restore print settings */
64  G_LOCK(print_settings);
65  if (print_settings)
66  gtk_print_operation_set_print_settings(op, print_settings);
67  G_UNLOCK(print_settings);
68 
69  /* Restore page setup */
70  G_LOCK(page_setup);
71  if (page_setup)
72  gtk_print_operation_set_default_page_setup(op, page_setup);
73  G_UNLOCK(page_setup);
74 
75  gtk_print_operation_set_job_name ( op, jobname);
76 }
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 47 of file print-session.c.

48 {
49  g_return_if_fail(op);
50 
51  G_LOCK(print_settings);
52  if (print_settings)
53  g_object_unref(print_settings);
54  print_settings = g_object_ref(gtk_print_operation_get_print_settings(op));
55  G_UNLOCK(print_settings);
56 }
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 79 of file print-session.c.

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