#[repr(transparent)]
pub struct PrintSettings { /* private fields */ }
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

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

Sets the value of PRINT_SETTINGS_PAGE_RANGES.

page_ranges

an array of PageRanges

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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

Returns the type of the object.

Returns the ObjectClass of the object. Read more

Returns the class of the object.

Returns the class of the object in the given type T. Read more

Returns the interface T of the object. Read more

Similar to Self::set_property but fails instead of panicking.

Sets the property property_name of the object to value value. Read more

Similar to Self::set_property but fails instead of panicking.

Sets the property property_name of the object to value value. Read more

Similar to Self::set_properties but fails instead of panicking.

Sets multiple properties of the object at once. Read more

Similar to Self::set_properties_from_value but fails instead of panicking.

Sets multiple properties of the object at once. Read more

Similar to Self::property but fails instead of panicking.

Gets the property property_name of the object and cast it to the type V. Read more

Similar to Self::property_value but fails instead of panicking.

Gets the property property_name of the object. Read more

Check if the object has a property property_name of the given type_. Read more

Get the type of the property property_name of this object. Read more

Get the ParamSpec of the property property_name of this object.

Return all ParamSpec of the properties of this object.

Freeze all property notifications until the return guard object is dropped. Read more

Set arbitrary data on this object with the given key. Read more

Return previously set arbitrary data of this object with the given key. Read more

Retrieve previously set arbitrary data of this object with the given key. Read more

Set arbitrary data on this object with the given key. Read more

Return previously set arbitrary data of this object with the given key. Read more

Retrieve previously set arbitrary data of this object with the given key. Read more

Block a given signal handler. Read more

Unblock a given signal handler.

Stop emission of the currently emitted signal.

Stop emission of the currently emitted signal by the (possibly detailed) signal name.

Similar to Self::connect but fails instead of panicking.

Connect to the signal signal_name on this object. Read more

Similar to Self::connect_id but fails instead of panicking.

Connect to the signal signal_id on this object. Read more

Similar to Self::connect_local but fails instead of panicking.

Connect to the signal signal_name on this object. Read more

Similar to Self::connect_local_id but fails instead of panicking.

Connect to the signal signal_id on this object. Read more

Similar to Self::connect_unsafe but fails instead of panicking.

Connect to the signal signal_name on this object. Read more

Similar to Self::connect_unsafe_id but fails instead of panicking.

Similar to Self::connect_closure but fails instead of panicking.

Connect a closure to the signal signal_name on this object. Read more

Similar to Self::connect_closure_id but fails instead of panicking.

Connect a closure to the signal signal_id on this object. Read more

Limits the lifetime of closure to the lifetime of the object. When the object’s reference count drops to zero, the closure will be invalidated. An invalidated closure will ignore any calls to Closure::invoke. Read more

Connect to the signal signal_id on this object. Read more

Similar to Self::emit but fails instead of panicking.

Emit signal by signal id. Read more

Similar to Self::emit_with_values but fails instead of panicking.

Same as Self::emit but takes Value for the arguments.

Similar to Self::emit_by_name but fails instead of panicking.

Emit signal by its name. Read more

Similar to Self::emit_by_name_with_values but fails instead of panicking.

Emit signal by its name. Read more

Similar to Self::emit_with_details but fails instead of panicking.

Emit signal by signal id with details. Read more

Similar to Self::emit_with_details_and_values but fails instead of panicking.

Emit signal by signal id with details. Read more

Disconnect a previously connected signal handler.

Connect to the notify signal of the object. Read more

Connect to the notify signal of the object. Read more

Connect to the notify signal of the object. Read more

Notify that the given property has changed its value. Read more

Notify that the given property has changed its value. Read more

Downgrade this object to a weak reference.

Bind property source_property on this object to the target_property on the target object. Read more

Returns the strong reference count of this object.

Ensures that the type has been registered with the type system.

The resulting type after obtaining ownership.

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

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

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.