[]Struct gtk::PrintSettings

pub struct PrintSettings(_, _);

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.

Printing support was added in GTK+ 2.10.

Implements

glib::object::ObjectExt

Implementations

impl PrintSettings[src]

pub fn new() -> PrintSettings[src]

Creates a new PrintSettings object.

Returns

a new PrintSettings object

pub fn from_file<P: AsRef<Path>>(file_name: P) -> Result<PrintSettings, Error>[src]

pub fn from_gvariant(variant: &Variant) -> PrintSettings[src]

pub fn from_key_file(
    key_file: &KeyFile,
    group_name: Option<&str>
) -> Result<PrintSettings, Error>
[src]

pub fn copy(&self) -> Option<PrintSettings>[src]

Copies a PrintSettings object.

Returns

a newly allocated copy of self

pub fn foreach<P: FnMut(&str, &str)>(&self, func: P)[src]

Calls func for each key-value pair of self.

func

the function to call

user_data

user data for func

pub fn get(&self, key: &str) -> Option<GString>[src]

Looks up the string value associated with key.

key

a key

Returns

the string value for key

pub fn get_bool(&self, key: &str) -> bool[src]

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.

pub fn get_collate(&self) -> bool[src]

Gets the value of GTK_PRINT_SETTINGS_COLLATE.

Returns

whether to collate the printed pages

pub fn get_default_source(&self) -> Option<GString>[src]

Gets the value of GTK_PRINT_SETTINGS_DEFAULT_SOURCE.

Returns

the default source

pub fn get_dither(&self) -> Option<GString>[src]

Gets the value of GTK_PRINT_SETTINGS_DITHER.

Returns

the dithering that is used

pub fn get_double(&self, key: &str) -> f64[src]

Returns the double value associated with key, or 0.

key

a key

Returns

the double value of key

pub fn get_double_with_default(&self, key: &str, def: f64) -> f64[src]

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

pub fn get_duplex(&self) -> PrintDuplex[src]

Gets the value of GTK_PRINT_SETTINGS_DUPLEX.

Returns

whether to print the output in duplex.

pub fn get_finishings(&self) -> Option<GString>[src]

Gets the value of GTK_PRINT_SETTINGS_FINISHINGS.

Returns

the finishings

pub fn get_int(&self, key: &str) -> i32[src]

Returns the integer value of key, or 0.

key

a key

Returns

the integer value of key

pub fn get_int_with_default(&self, key: &str, def: i32) -> i32[src]

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

pub fn get_length(&self, key: &str, unit: Unit) -> f64[src]

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

pub fn get_media_type(&self) -> Option<GString>[src]

Gets the value of GTK_PRINT_SETTINGS_MEDIA_TYPE.

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

Returns

the media type

pub fn get_n_copies(&self) -> i32[src]

Gets the value of GTK_PRINT_SETTINGS_N_COPIES.

Returns

the number of copies to print

pub fn get_number_up(&self) -> i32[src]

Gets the value of GTK_PRINT_SETTINGS_NUMBER_UP.

Returns

the number of pages per sheet

pub fn get_number_up_layout(&self) -> NumberUpLayout[src]

Gets the value of GTK_PRINT_SETTINGS_NUMBER_UP_LAYOUT.

Returns

layout of page in number-up mode

pub fn get_orientation(&self) -> PageOrientation[src]

Get the value of GTK_PRINT_SETTINGS_ORIENTATION, converted to a PageOrientation.

Returns

the orientation

pub fn get_output_bin(&self) -> Option<GString>[src]

Gets the value of GTK_PRINT_SETTINGS_OUTPUT_BIN.

Returns

the output bin

pub fn get_page_ranges(&self) -> Vec<PageRange>[src]

Gets the value of GTK_PRINT_SETTINGS_PAGE_RANGES.

num_ranges

return location for the length of the returned array

Returns

an array of GtkPageRanges. Use g_free to free the array when it is no longer needed.

pub fn get_page_set(&self) -> PageSet[src]

Gets the value of GTK_PRINT_SETTINGS_PAGE_SET.

Returns

the set of pages to print

pub fn get_paper_height(&self, unit: Unit) -> f64[src]

Gets the value of GTK_PRINT_SETTINGS_PAPER_HEIGHT, converted to unit.

unit

the unit for the return value

Returns

the paper height, in units of unit

pub fn get_paper_size(&self) -> PaperSize[src]

Gets the value of GTK_PRINT_SETTINGS_PAPER_FORMAT, converted to a PaperSize.

Returns

the paper size

pub fn get_paper_width(&self, unit: Unit) -> f64[src]

Gets the value of GTK_PRINT_SETTINGS_PAPER_WIDTH, converted to unit.

unit

the unit for the return value

Returns

the paper width, in units of unit

pub fn get_print_pages(&self) -> PrintPages[src]

Gets the value of GTK_PRINT_SETTINGS_PRINT_PAGES.

Returns

which pages to print

pub fn get_printer(&self) -> Option<GString>[src]

Convenience function to obtain the value of GTK_PRINT_SETTINGS_PRINTER.

Returns

the printer name

pub fn get_printer_lpi(&self) -> f64[src]

Gets the value of GTK_PRINT_SETTINGS_PRINTER_LPI.

Returns

the resolution in lpi (lines per inch)

pub fn get_quality(&self) -> PrintQuality[src]

Gets the value of GTK_PRINT_SETTINGS_QUALITY.

Returns

the print quality

pub fn get_resolution(&self) -> i32[src]

Gets the value of GTK_PRINT_SETTINGS_RESOLUTION.

Returns

the resolution in dpi

pub fn get_resolution_x(&self) -> i32[src]

Gets the value of GTK_PRINT_SETTINGS_RESOLUTION_X.

Returns

the horizontal resolution in dpi

pub fn get_resolution_y(&self) -> i32[src]

Gets the value of GTK_PRINT_SETTINGS_RESOLUTION_Y.

Returns

the vertical resolution in dpi

pub fn get_reverse(&self) -> bool[src]

Gets the value of GTK_PRINT_SETTINGS_REVERSE.

Returns

whether to reverse the order of the printed pages

pub fn get_scale(&self) -> f64[src]

Gets the value of GTK_PRINT_SETTINGS_SCALE.

Returns

the scale in percent

pub fn get_use_color(&self) -> bool[src]

Gets the value of GTK_PRINT_SETTINGS_USE_COLOR.

Returns

whether to use color

pub fn has_key(&self, key: &str) -> bool[src]

Returns true, if a value is associated with key.

key

a key

Returns

true, if key has a value

pub fn load_file<P: AsRef<Path>>(&self, file_name: P) -> Result<(), Error>[src]

Reads the print settings from file_name. If the file could not be loaded then error is set to either a glib::FileError or glib::KeyFileError. See PrintSettings::to_file.

file_name

the filename to read the settings from

Returns

true on success

pub fn load_key_file(
    &self,
    key_file: &KeyFile,
    group_name: Option<&str>
) -> Result<(), Error>
[src]

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 glib::FileError or glib::KeyFileError.

key_file

the glib::KeyFile 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

pub fn set(&self, key: &str, value: Option<&str>)[src]

Associates value with key.

key

a key

value

a string value, or None

pub fn set_bool(&self, key: &str, value: bool)[src]

Sets key to a boolean value.

key

a key

value

a boolean

pub fn set_collate(&self, collate: bool)[src]

Sets the value of GTK_PRINT_SETTINGS_COLLATE.

collate

whether to collate the output

pub fn set_default_source(&self, default_source: &str)[src]

Sets the value of GTK_PRINT_SETTINGS_DEFAULT_SOURCE.

default_source

the default source

pub fn set_dither(&self, dither: &str)[src]

Sets the value of GTK_PRINT_SETTINGS_DITHER.

dither

the dithering that is used

pub fn set_double(&self, key: &str, value: f64)[src]

Sets key to a double value.

key

a key

value

a double value

pub fn set_duplex(&self, duplex: PrintDuplex)[src]

Sets the value of GTK_PRINT_SETTINGS_DUPLEX.

duplex

a PrintDuplex value

pub fn set_finishings(&self, finishings: &str)[src]

Sets the value of GTK_PRINT_SETTINGS_FINISHINGS.

finishings

the finishings

pub fn set_int(&self, key: &str, value: i32)[src]

Sets key to an integer value.

key

a key

value

an integer

pub fn set_length(&self, key: &str, value: f64, unit: Unit)[src]

Associates a length in units of unit with key.

key

a key

value

a length

unit

the unit of length

pub fn set_media_type(&self, media_type: &str)[src]

Sets the value of GTK_PRINT_SETTINGS_MEDIA_TYPE.

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

media_type

the media type

pub fn set_n_copies(&self, num_copies: i32)[src]

Sets the value of GTK_PRINT_SETTINGS_N_COPIES.

num_copies

the number of copies

pub fn set_number_up(&self, number_up: i32)[src]

Sets the value of GTK_PRINT_SETTINGS_NUMBER_UP.

number_up

the number of pages per sheet

pub fn set_number_up_layout(&self, number_up_layout: NumberUpLayout)[src]

Sets the value of GTK_PRINT_SETTINGS_NUMBER_UP_LAYOUT.

number_up_layout

a NumberUpLayout value

pub fn set_orientation(&self, orientation: PageOrientation)[src]

Sets the value of GTK_PRINT_SETTINGS_ORIENTATION.

orientation

a page orientation

pub fn set_output_bin(&self, output_bin: &str)[src]

Sets the value of GTK_PRINT_SETTINGS_OUTPUT_BIN.

output_bin

the output bin

pub fn set_page_set(&self, page_set: PageSet)[src]

Sets the value of GTK_PRINT_SETTINGS_PAGE_SET.

page_set

a PageSet value

pub fn set_paper_height(&self, height: f64, unit: Unit)[src]

Sets the value of GTK_PRINT_SETTINGS_PAPER_HEIGHT.

height

the paper height

unit

the units of height

pub fn set_paper_size(&self, paper_size: &PaperSize)[src]

Sets the value of GTK_PRINT_SETTINGS_PAPER_FORMAT, GTK_PRINT_SETTINGS_PAPER_WIDTH and GTK_PRINT_SETTINGS_PAPER_HEIGHT.

paper_size

a paper size

pub fn set_paper_width(&self, width: f64, unit: Unit)[src]

Sets the value of GTK_PRINT_SETTINGS_PAPER_WIDTH.

width

the paper width

unit

the units of width

pub fn set_print_pages(&self, pages: PrintPages)[src]

Sets the value of GTK_PRINT_SETTINGS_PRINT_PAGES.

pages

a PrintPages value

pub fn set_printer(&self, printer: &str)[src]

Convenience function to set GTK_PRINT_SETTINGS_PRINTER to printer.

printer

the printer name

pub fn set_printer_lpi(&self, lpi: f64)[src]

Sets the value of GTK_PRINT_SETTINGS_PRINTER_LPI.

lpi

the resolution in lpi (lines per inch)

pub fn set_quality(&self, quality: PrintQuality)[src]

Sets the value of GTK_PRINT_SETTINGS_QUALITY.

quality

a PrintQuality value

pub fn set_resolution(&self, resolution: i32)[src]

Sets the values of GTK_PRINT_SETTINGS_RESOLUTION, GTK_PRINT_SETTINGS_RESOLUTION_X and GTK_PRINT_SETTINGS_RESOLUTION_Y.

resolution

the resolution in dpi

pub fn set_resolution_xy(&self, resolution_x: i32, resolution_y: i32)[src]

Sets the values of GTK_PRINT_SETTINGS_RESOLUTION, GTK_PRINT_SETTINGS_RESOLUTION_X and GTK_PRINT_SETTINGS_RESOLUTION_Y.

resolution_x

the horizontal resolution in dpi

resolution_y

the vertical resolution in dpi

pub fn set_reverse(&self, reverse: bool)[src]

Sets the value of GTK_PRINT_SETTINGS_REVERSE.

reverse

whether to reverse the output

pub fn set_scale(&self, scale: f64)[src]

Sets the value of GTK_PRINT_SETTINGS_SCALE.

scale

the scale in percent

pub fn set_use_color(&self, use_color: bool)[src]

Sets the value of GTK_PRINT_SETTINGS_USE_COLOR.

use_color

whether to use color

pub fn to_file<P: AsRef<Path>>(&self, file_name: P) -> Result<(), Error>[src]

This function saves the print settings from self to file_name. If the file could not be loaded then error is set to either a glib::FileError or glib::KeyFileError.

file_name

the file to save to

Returns

true on success

pub fn to_gvariant(&self) -> Option<Variant>[src]

Serialize print settings to an a{sv} variant.

Feature: v3_22

Returns

a new, floating, glib::Variant

pub fn to_key_file(&self, key_file: &KeyFile, group_name: Option<&str>)[src]

This function adds the print settings from self to key_file.

key_file

the glib::KeyFile 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”

pub fn unset(&self, key: &str)[src]

Removes any value associated with key. This has the same effect as setting the value to None.

key

a key

impl PrintSettings[src]

pub fn set_page_ranges(&self, page_ranges: &[PageRange])[src]

Sets the value of GTK_PRINT_SETTINGS_PAGE_RANGES.

page_ranges

an array of GtkPageRanges

num_ranges

the length of page_ranges

Trait Implementations

impl Clone for PrintSettings

impl Debug for PrintSettings

impl Default for PrintSettings[src]

impl Display for PrintSettings[src]

impl Eq for PrintSettings

impl Hash for PrintSettings

impl Ord for PrintSettings

impl<T: ObjectType> PartialEq<T> for PrintSettings

impl<T: ObjectType> PartialOrd<T> for PrintSettings

impl StaticType for PrintSettings

Auto Trait Implementations

impl RefUnwindSafe for PrintSettings

impl !Send for PrintSettings

impl !Sync for PrintSettings

impl Unpin for PrintSettings

impl UnwindSafe for PrintSettings

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Super, Sub> CanDowncast<Sub> for Super where
    Sub: IsA<Super>,
    Super: IsA<Super>, 

impl<T> Cast for T where
    T: ObjectType, 

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ObjectExt for T where
    T: ObjectType, 

impl<'a, T> ToGlibContainerFromSlice<'a, *const GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *const GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<Array>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToSendValue for T where
    T: ToValue + SetValue + Send + ?Sized

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> ToValue for T where
    T: SetValue + ?Sized

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.