1.153 <GtkPrintDialog>

Class: <GtkPrintDialog>

It derives from <GObject>.

Asynchronous API to present a print dialog to the user.

<GtkPrintDialog> collects the arguments that are needed to present the dialog, such as a title for the dialog and whether it should be modal.

The dialog is shown with the print-dialog:setup function.

The actual printing can be done with print-dialog:print or print-dialog:print-file. These APIs follows the GIO async pattern, and the results can be obtained by calling the corresponding finish methods.

Properties

Property: print-dialog:accept-label self

A label that may be shown on the accept button of a print dialog that is presented by print-dialog:setup.

Its value is a string, or #f.

Set it with (set! (print-dialog:accept-label self) value).

Property: print-dialog:modal self

Whether the print dialog is modal.

Its value is a boolean.

Set it with (set! (print-dialog:modal self) value).

Property: print-dialog:page-setup self

The page setup to use.

Its value is a <GtkPageSetup>, or #f.

Set it with (set! (print-dialog:page-setup self) value).

Property: print-dialog:print-settings self

The print settings to use.

Its value is a <GtkPrintSettings>, or #f.

Set it with (set! (print-dialog:print-settings self) value).

Property: print-dialog:title self

A title that may be shown on the print dialog that is presented by print-dialog:setup.

Its value is a string, or #f.

Set it with (set! (print-dialog:title self) value).

Procedures

Method: print-dialog:get-accept-label self ⇒ %return
Method: get-accept-label self ⇒ %return

Returns the label that will be shown on the accept button of the print dialog.

self

Passed: a <GtkPrintDialog>.

a <GtkPrintDialog>

%return

Returned: a string.

the accept label

Method: print-dialog:get-modal? self ⇒ %return
Method: get-modal? self ⇒ %return

Returns whether the print dialog blocks interaction with the parent window while it is presented.

self

Passed: a <GtkPrintDialog>.

a <GtkPrintDialog>

%return

Returned: a boolean.

whether the print dialog is modal

Method: print-dialog:get-page-setup self ⇒ %return
Method: get-page-setup self ⇒ %return

Returns the page setup.

self

Passed: a <GtkPrintDialog>.

a <GtkPrintDialog>

%return

Returned: a <GtkPageSetup>, or #f.

the page setup

Method: print-dialog:get-print-settings self ⇒ %return
Method: get-print-settings self ⇒ %return

Returns the print settings for the print dialog.

self

Passed: a <GtkPrintDialog>.

a <GtkPrintDialog>

%return

Returned: a <GtkPrintSettings>, or #f.

the settings

Method: print-dialog:get-title self ⇒ %return
Method: get-title self ⇒ %return

Returns the title that will be shown on the print dialog.

self

Passed: a <GtkPrintDialog>.

a <GtkPrintDialog>

%return

Returned: a string.

the title

Procedure: print-dialog:new ⇒ %return

Creates a new <GtkPrintDialog> object.

%return

Returned: a <GtkPrintDialog>.

the new <GtkPrintDialog>

Method: print-dialog:print self [parent] [setup] [cancellable] [callback]
Method: print self [parent] [setup] [cancellable] [callback]

This function prints content from a stream.

If you pass NULL as setup, then this method will present a print dialog. Otherwise, it will attempt to print directly, without user interaction.

The callback will be called when the printing is done.

self

Passed: a <GtkPrintDialog>.

a <GtkPrintDialog>

parent

Passed, or left out: a <GtkWindow>, or #f.

the parent <GtkWindow>

setup

Passed, or left out: a <GtkPrintSetup>, or #f.

the <GtkPrintSetup> to use

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable> to cancel the operation

callback

Passed, or left out: a procedure, or #f.

a callback to call when the operation is complete

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

data to pass to callback

Method: print-dialog:print-file self parent setup file [cancellable] [callback]
Method: print-file self parent setup file [cancellable] [callback]

This function prints a file.

If you pass NULL as setup, then this method will present a print dialog. Otherwise, it will attempt to print directly, without user interaction.

self

Passed: a <GtkPrintDialog>.

a <GtkPrintDialog>

parent

Passed: a <GtkWindow>, or #f.

the parent <GtkWindow>

setup

Passed: a <GtkPrintSetup>, or #f.

the <GtkPrintSetup> to use

file

Passed: a <GFile>.

the <GFile> to print

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable> to cancel the operation

callback

Passed, or left out: a procedure, or #f.

a callback to call when the operation is complete

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

data to pass to callback

Method: print-dialog:print-file-finish? self result ⇒ %return
Method: print-file-finish? self result ⇒ %return

Finishes the print-dialog:print-file call and returns the results.

Note that this function returns a Gtk.DialogError.DISMISSED error if the user cancels the dialog.

self

Passed: a <GtkPrintDialog>.

a <GtkPrintDialog>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a boolean.

Whether the call was successful

Method: print-dialog:print-finish self result ⇒ %return
Method: print-finish self result ⇒ %return

Finishes the print-dialog:print call and returns the results.

If the call was successful, the content to be printed should be written to the returned output stream. Otherwise, NULL is returned.

The overall results of the print operation will be returned in the output-stream:close? call, so if you are interested in the results, you need to explicitly close the output stream (it will be closed automatically if you just unref it). Be aware that the close call may not be instant as it operation will for the printer to finish printing.

Note that this function returns a Gtk.DialogError.DISMISSED error if the user cancels the dialog.

self

Passed: a <GtkPrintDialog>.

a <GtkPrintDialog>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a <GOutputStream>.

a <GOutputStream>

Method: print-dialog:set-accept-label self accept-label
Method: set-accept-label self accept-label

Sets the label that will be shown on the accept button of the print dialog shown for print-dialog:setup.

self

Passed: a <GtkPrintDialog>.

a <GtkPrintDialog>

accept-label

Passed: a string.

the new accept label

Method: print-dialog:set-modal self modal
Method: set-modal self modal

Sets whether the print dialog blocks interaction with the parent window while it is presented.

self

Passed: a <GtkPrintDialog>.

a <GtkPrintDialog>

modal

Passed: a boolean.

the new value

Method: print-dialog:set-page-setup self page-setup
Method: set-page-setup self page-setup

Set the page setup for the print dialog.

self

Passed: a <GtkPrintDialog>.

a <GtkPrintDialog>

page-setup

Passed: a <GtkPageSetup>.

the new page setup

Method: print-dialog:set-print-settings self print-settings
Method: set-print-settings self print-settings

Sets the print settings for the print dialog.

self

Passed: a <GtkPrintDialog>.

a <GtkPrintDialog>

print-settings

Passed: a <GtkPrintSettings>.

the new print settings

Method: print-dialog:set-title self title
Method: set-title self title

Sets the title that will be shown on the print dialog.

self

Passed: a <GtkPrintDialog>.

a <GtkPrintDialog>

title

Passed: a string.

the new title

Method: print-dialog:setup self [parent] [cancellable] [callback]
Method: setup self [parent] [cancellable] [callback]

This function presents a print dialog to let the user select a printer, and set up print settings and page setup.

The callback will be called when the dialog is dismissed. The obtained <GtkPrintSetup> can then be passed to print-dialog:print or print-dialog:print-file.

One possible use for this method is to have the user select a printer, then show a page setup UI in the application (e.g. to arrange images on a page), then call print-dialog:print on self to do the printing without further user interaction.

self

Passed: a <GtkPrintDialog>.

a <GtkPrintDialog>

parent

Passed, or left out: a <GtkWindow>, or #f.

the parent <GtkWindow>

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable> to cancel the operation

callback

Passed, or left out: a procedure, or #f.

a callback to call when the operation is complete

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

data to pass to callback

Method: print-dialog:setup-finish self result ⇒ %return
Method: setup-finish self result ⇒ %return

Finishes the print-dialog:setup call.

If the call was successful, it returns a <GtkPrintSetup> which contains the print settings and page setup information that will be used to print.

Note that this function returns a Gtk.DialogError.DISMISSED error if the user cancels the dialog.

self

Passed: a <GtkPrintDialog>.

a <GtkPrintDialog>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a <GtkPrintSetup>.

the resulting [struct@Gtk.PrintSetup]