Struct gtk4::PrintSettings[][src]

pub struct PrintSettings(_);
Expand description

A PrintSettings object represents the settings of a print dialog in a system-independent way.

The main use for this object is that once you’ve printed you can get a settings object that represents the settings the user chose, and the next time you print you can pass that object in so that the user doesn’t have to re-set all his settings.

Its also possible to enumerate the settings so that you can easily save the settings for the next time your app runs, or even store them in a document. The predefined keys try to use shared values as much as possible so that moving such a document between systems still works.

Implements

glib::ObjectExt

Implementations

Creates a new PrintSettings object.

Returns

a new PrintSettings object

Reads the print settings from file_name.

Returns a new PrintSettings object with the restored settings, or None if an error occurred. If the file could not be loaded then error is set to either a GFileError or GKeyFileError.

See to_file().

file_name

the filename to read the settings from

Returns

the restored PrintSettings

Deserialize print settings from an a{sv} variant.

The variant must be in the format produced by to_gvariant().

variant

an a{sv} GVariant

Returns

a new PrintSettings object

Reads the print settings from the group group_name in key_file.

Returns a new PrintSettings object with the restored settings, or None if an error occurred. If the file could not be loaded then error is set to either GFileError or GKeyFileError.

key_file

the GKeyFile to retrieve the settings from

group_name

the name of the group to use, or None to use the default “Print Settings”

Returns

the restored PrintSettings

Copies a PrintSettings object.

Returns

a newly allocated copy of self

Calls func for each key-value pair of self.

func

the function to call

Looks up the string value associated with key.

key

a key

Returns

the string value for key

Returns the boolean represented by the value that is associated with key.

The string “true” represents true, any other string false.

key

a key

Returns

true, if key maps to a true value.

Gets the value of PRINT_SETTINGS_COLLATE.

Returns

whether to collate the printed pages

Gets the value of PRINT_SETTINGS_DEFAULT_SOURCE.

Returns

the default source

Gets the value of PRINT_SETTINGS_DITHER.

Returns

the dithering that is used

Returns the double value associated with key, or 0.

key

a key

Returns

the double value of key

Returns the floating point number represented by the value that is associated with key, or default_val if the value does not represent a floating point number.

Floating point numbers are parsed with g_ascii_strtod().

key

a key

def

the default value

Returns

the floating point number associated with key

Gets the value of PRINT_SETTINGS_DUPLEX.

Returns

whether to print the output in duplex.

Gets the value of PRINT_SETTINGS_FINISHINGS.

Returns

the finishings

Returns the integer value of key, or 0.

key

a key

Returns

the integer value of key

Returns the value of key, interpreted as an integer, or the default value.

key

a key

def

the default value

Returns

the integer value of key

Returns the value associated with key, interpreted as a length.

The returned value is converted to units.

key

a key

unit

the unit of the return value

Returns

the length value of key, converted to unit

Gets the value of PRINT_SETTINGS_MEDIA_TYPE.

The set of media types is defined in PWG 5101.1-2002 PWG.

Returns

the media type

Gets the value of PRINT_SETTINGS_N_COPIES.

Returns

the number of copies to print

Gets the value of PRINT_SETTINGS_NUMBER_UP.

Returns

the number of pages per sheet

Gets the value of PRINT_SETTINGS_NUMBER_UP_LAYOUT.

Returns

layout of page in number-up mode

Get the value of PRINT_SETTINGS_ORIENTATION, converted to a PageOrientation.

Returns

the orientation

Gets the value of PRINT_SETTINGS_OUTPUT_BIN.

Returns

the output bin

Gets the value of PRINT_SETTINGS_PAGE_RANGES.

Returns

an array of PageRanges. Use g_free() to free the array when it is no longer needed.

Gets the value of PRINT_SETTINGS_PAGE_SET.

Returns

the set of pages to print

Gets the value of PRINT_SETTINGS_PAPER_HEIGHT, converted to unit.

unit

the unit for the return value

Returns

the paper height, in units of unit

Gets the value of PRINT_SETTINGS_PAPER_FORMAT, converted to a PaperSize.

Returns

the paper size

Gets the value of PRINT_SETTINGS_PAPER_WIDTH, converted to unit.

unit

the unit for the return value

Returns

the paper width, in units of unit

Gets the value of PRINT_SETTINGS_PRINT_PAGES.

Returns

which pages to print

Convenience function to obtain the value of PRINT_SETTINGS_PRINTER.

Returns

the printer name

Gets the value of PRINT_SETTINGS_PRINTER_LPI.

Returns

the resolution in lpi (lines per inch)

Gets the value of PRINT_SETTINGS_QUALITY.

Returns

the print quality

Gets the value of PRINT_SETTINGS_RESOLUTION.

Returns

the resolution in dpi

Gets the value of PRINT_SETTINGS_RESOLUTION_X.

Returns

the horizontal resolution in dpi

Gets the value of PRINT_SETTINGS_RESOLUTION_Y.

Returns

the vertical resolution in dpi

Gets the value of PRINT_SETTINGS_REVERSE.

Returns

whether to reverse the order of the printed pages

Gets the value of PRINT_SETTINGS_SCALE.

Returns

the scale in percent

Gets the value of PRINT_SETTINGS_USE_COLOR.

Returns

whether to use color

Returns true, if a value is associated with key.

key

a key

Returns

true, if key has a value

Reads the print settings from file_name.

If the file could not be loaded then error is set to either a GFileError or GKeyFileError.

See to_file().

file_name

the filename to read the settings from

Returns

true on success

Reads the print settings from the group group_name in key_file.

If the file could not be loaded then error is set to either a GFileError or GKeyFileError.

key_file

the GKeyFile to retrieve the settings from

group_name

the name of the group to use, or None to use the default “Print Settings”

Returns

true on success

Associates value with key.

key

a key

value

a string value

Sets key to a boolean value.

key

a key

value

a boolean

Sets the value of PRINT_SETTINGS_COLLATE.

collate

whether to collate the output

Sets the value of PRINT_SETTINGS_DEFAULT_SOURCE.

default_source

the default source

Sets the value of PRINT_SETTINGS_DITHER.

dither

the dithering that is used

Sets key to a double value.

key

a key

value

a double value

Sets the value of PRINT_SETTINGS_DUPLEX.

duplex

a PrintDuplex value

Sets the value of PRINT_SETTINGS_FINISHINGS.

finishings

the finishings

Sets key to an integer value.

key

a key

value

an integer

Associates a length in units of unit with key.

key

a key

value

a length

unit

the unit of length

Sets the value of PRINT_SETTINGS_MEDIA_TYPE.

The set of media types is defined in PWG 5101.1-2002 PWG.

media_type

the media type

Sets the value of PRINT_SETTINGS_N_COPIES.

num_copies

the number of copies

Sets the value of PRINT_SETTINGS_NUMBER_UP.

number_up

the number of pages per sheet

Sets the value of PRINT_SETTINGS_ORIENTATION.

orientation

a page orientation

Sets the value of PRINT_SETTINGS_OUTPUT_BIN.

output_bin

the output bin

Sets the value of PRINT_SETTINGS_PAGE_SET.

page_set

a PageSet value

Sets the value of PRINT_SETTINGS_PAPER_HEIGHT.

height

the paper height

unit

the units of height

Sets the value of PRINT_SETTINGS_PAPER_WIDTH.

width

the paper width

unit

the units of width

Sets the value of PRINT_SETTINGS_PRINT_PAGES.

pages

a PrintPages value

Convenience function to set PRINT_SETTINGS_PRINTER to printer.

printer

the printer name

Sets the value of PRINT_SETTINGS_PRINTER_LPI.

lpi

the resolution in lpi (lines per inch)

Sets the value of PRINT_SETTINGS_QUALITY.

quality

a PrintQuality value

Sets the values of PRINT_SETTINGS_RESOLUTION, PRINT_SETTINGS_RESOLUTION_X and PRINT_SETTINGS_RESOLUTION_Y.

resolution_x

the horizontal resolution in dpi

resolution_y

the vertical resolution in dpi

Sets the value of PRINT_SETTINGS_REVERSE.

reverse

whether to reverse the output

Sets the value of PRINT_SETTINGS_SCALE.

scale

the scale in percent

Sets the value of PRINT_SETTINGS_USE_COLOR.

use_color

whether to use color

This function saves the print settings from self to file_name.

If the file could not be written then error is set to either a GFileError or GKeyFileError.

file_name

the file to save to

Returns

true on success

Serialize print settings to an a{sv} variant.

Returns

a new, floating, GVariant

This function adds the print settings from self to key_file.

key_file

the GKeyFile to save the print settings to

group_name

the group to add the settings to in key_file, or None to use the default “Print Settings”

Removes any value associated with key.

This has the same effect as setting the value to None.

key

a key

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Returns the type identifier of Self.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Upcasts an object to a superclass or interface T. Read more

Upcasts an object to a reference of its superclass or interface T. Read more

Tries to downcast to a subclass or interface implementor T. Read more

Tries to downcast to a reference of its subclass or interface implementor T. Read more

Tries to cast to an object of type T. This handles upcasting, downcasting and casting between interface and interface implementors. All checks are performed at runtime, while downcast and upcast will do many checks at compile-time already. Read more

Tries to cast to reference to an object of type T. This handles upcasting, downcasting and casting between interface and interface implementors. All checks are performed at runtime, while downcast and upcast will do many checks at compile-time already. Read more

Casts to T unconditionally. Read more

Casts to &T unconditionally. Read more

Performs the conversion.

Performs the conversion.

Returns true if the object is an instance of (can be cast to) T.

Safety Read more

Safety Read more

Safety Read more

Safety Read more

Safety Read more

Safety Read more

Same as connect but takes a SignalId instead of a signal name.

Same as connect_local but takes a SignalId instead of a signal name.

Same as connect_unsafe but takes a SignalId instead of a signal name.

Emit signal by signal id.

Same as emit but takes Value for the arguments.

Emit signal by its name.

Same as emit_by_name but takes Value for the arguments.

Emit signal with details by signal id.

Same as emit_with_details but takes Value for the arguments.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Returns a SendValue clone of self.

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.