Top |
Functions
Types and Values
Description
A GtkPrintSettings 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.
Functions
GtkPrintSettingsFunc ()
void (*GtkPrintSettingsFunc) (const char *key
,const char *value
,gpointer user_data
);
gtk_print_settings_new ()
GtkPrintSettings *
gtk_print_settings_new (void
);
Creates a new GtkPrintSettings object.
gtk_print_settings_copy ()
GtkPrintSettings *
gtk_print_settings_copy (GtkPrintSettings *other
);
Copies a GtkPrintSettings object.
gtk_print_settings_has_key ()
gboolean gtk_print_settings_has_key (GtkPrintSettings *settings
,const char *key
);
Returns TRUE
, if a value is associated with key
.
gtk_print_settings_get ()
const char * gtk_print_settings_get (GtkPrintSettings *settings
,const char *key
);
Looks up the string value associated with key
.
gtk_print_settings_set ()
void gtk_print_settings_set (GtkPrintSettings *settings
,const char *key
,const char *value
);
Associates value
with key
.
gtk_print_settings_unset ()
void gtk_print_settings_unset (GtkPrintSettings *settings
,const char *key
);
Removes any value associated with key
.
This has the same effect as setting the value to NULL
.
gtk_print_settings_foreach ()
void gtk_print_settings_foreach (GtkPrintSettings *settings
,GtkPrintSettingsFunc func
,gpointer user_data
);
Calls func
for each key-value pair of settings
.
gtk_print_settings_get_bool ()
gboolean gtk_print_settings_get_bool (GtkPrintSettings *settings
,const char *key
);
Returns the boolean represented by the value
that is associated with key
.
The string “true” represents TRUE
, any other
string FALSE
.
gtk_print_settings_set_bool ()
void gtk_print_settings_set_bool (GtkPrintSettings *settings
,const char *key
,gboolean value
);
Sets key
to a boolean value.
gtk_print_settings_get_double ()
double gtk_print_settings_get_double (GtkPrintSettings *settings
,const char *key
);
Returns the double value associated with key
, or 0.
gtk_print_settings_get_double_with_default ()
double gtk_print_settings_get_double_with_default (GtkPrintSettings *settings
,const char *key
,double def
);
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()
.
gtk_print_settings_set_double ()
void gtk_print_settings_set_double (GtkPrintSettings *settings
,const char *key
,double value
);
Sets key
to a double value.
gtk_print_settings_get_length ()
double gtk_print_settings_get_length (GtkPrintSettings *settings
,const char *key
,GtkUnit unit
);
Returns the value associated with key
, interpreted
as a length. The returned value is converted to units
.
gtk_print_settings_set_length ()
void gtk_print_settings_set_length (GtkPrintSettings *settings
,const char *key
,double value
,GtkUnit unit
);
Associates a length in units of unit
with key
.
gtk_print_settings_get_int ()
int gtk_print_settings_get_int (GtkPrintSettings *settings
,const char *key
);
Returns the integer value of key
, or 0.
gtk_print_settings_get_int_with_default ()
int gtk_print_settings_get_int_with_default (GtkPrintSettings *settings
,const char *key
,int def
);
Returns the value of key
, interpreted as
an integer, or the default value.
gtk_print_settings_set_int ()
void gtk_print_settings_set_int (GtkPrintSettings *settings
,const char *key
,int value
);
Sets key
to an integer value.
gtk_print_settings_get_printer ()
const char *
gtk_print_settings_get_printer (GtkPrintSettings *settings
);
Convenience function to obtain the value of
GTK_PRINT_SETTINGS_PRINTER
.
gtk_print_settings_set_printer ()
void gtk_print_settings_set_printer (GtkPrintSettings *settings
,const char *printer
);
Convenience function to set GTK_PRINT_SETTINGS_PRINTER
to printer
.
gtk_print_settings_get_orientation ()
GtkPageOrientation
gtk_print_settings_get_orientation (GtkPrintSettings *settings
);
Get the value of GTK_PRINT_SETTINGS_ORIENTATION
,
converted to a GtkPageOrientation.
gtk_print_settings_set_orientation ()
void gtk_print_settings_set_orientation (GtkPrintSettings *settings
,GtkPageOrientation orientation
);
Sets the value of GTK_PRINT_SETTINGS_ORIENTATION
.
gtk_print_settings_get_paper_size ()
GtkPaperSize *
gtk_print_settings_get_paper_size (GtkPrintSettings *settings
);
Gets the value of GTK_PRINT_SETTINGS_PAPER_FORMAT
,
converted to a GtkPaperSize.
gtk_print_settings_set_paper_size ()
void gtk_print_settings_set_paper_size (GtkPrintSettings *settings
,GtkPaperSize *paper_size
);
Sets the value of GTK_PRINT_SETTINGS_PAPER_FORMAT
,
GTK_PRINT_SETTINGS_PAPER_WIDTH
and
GTK_PRINT_SETTINGS_PAPER_HEIGHT
.
gtk_print_settings_get_paper_width ()
double gtk_print_settings_get_paper_width (GtkPrintSettings *settings
,GtkUnit unit
);
Gets the value of GTK_PRINT_SETTINGS_PAPER_WIDTH
,
converted to unit
.
gtk_print_settings_set_paper_width ()
void gtk_print_settings_set_paper_width (GtkPrintSettings *settings
,double width
,GtkUnit unit
);
Sets the value of GTK_PRINT_SETTINGS_PAPER_WIDTH
.
gtk_print_settings_get_paper_height ()
double gtk_print_settings_get_paper_height (GtkPrintSettings *settings
,GtkUnit unit
);
Gets the value of GTK_PRINT_SETTINGS_PAPER_HEIGHT
,
converted to unit
.
gtk_print_settings_set_paper_height ()
void gtk_print_settings_set_paper_height (GtkPrintSettings *settings
,double height
,GtkUnit unit
);
Sets the value of GTK_PRINT_SETTINGS_PAPER_HEIGHT
.
gtk_print_settings_get_use_color ()
gboolean
gtk_print_settings_get_use_color (GtkPrintSettings *settings
);
Gets the value of GTK_PRINT_SETTINGS_USE_COLOR
.
gtk_print_settings_set_use_color ()
void gtk_print_settings_set_use_color (GtkPrintSettings *settings
,gboolean use_color
);
Sets the value of GTK_PRINT_SETTINGS_USE_COLOR
.
gtk_print_settings_get_collate ()
gboolean
gtk_print_settings_get_collate (GtkPrintSettings *settings
);
Gets the value of GTK_PRINT_SETTINGS_COLLATE
.
gtk_print_settings_set_collate ()
void gtk_print_settings_set_collate (GtkPrintSettings *settings
,gboolean collate
);
Sets the value of GTK_PRINT_SETTINGS_COLLATE
.
gtk_print_settings_get_reverse ()
gboolean
gtk_print_settings_get_reverse (GtkPrintSettings *settings
);
Gets the value of GTK_PRINT_SETTINGS_REVERSE
.
gtk_print_settings_set_reverse ()
void gtk_print_settings_set_reverse (GtkPrintSettings *settings
,gboolean reverse
);
Sets the value of GTK_PRINT_SETTINGS_REVERSE
.
gtk_print_settings_get_duplex ()
GtkPrintDuplex
gtk_print_settings_get_duplex (GtkPrintSettings *settings
);
Gets the value of GTK_PRINT_SETTINGS_DUPLEX
.
gtk_print_settings_set_duplex ()
void gtk_print_settings_set_duplex (GtkPrintSettings *settings
,GtkPrintDuplex duplex
);
Sets the value of GTK_PRINT_SETTINGS_DUPLEX
.
gtk_print_settings_get_quality ()
GtkPrintQuality
gtk_print_settings_get_quality (GtkPrintSettings *settings
);
Gets the value of GTK_PRINT_SETTINGS_QUALITY
.
gtk_print_settings_set_quality ()
void gtk_print_settings_set_quality (GtkPrintSettings *settings
,GtkPrintQuality quality
);
Sets the value of GTK_PRINT_SETTINGS_QUALITY
.
gtk_print_settings_get_n_copies ()
int
gtk_print_settings_get_n_copies (GtkPrintSettings *settings
);
Gets the value of GTK_PRINT_SETTINGS_N_COPIES
.
gtk_print_settings_set_n_copies ()
void gtk_print_settings_set_n_copies (GtkPrintSettings *settings
,int num_copies
);
Sets the value of GTK_PRINT_SETTINGS_N_COPIES
.
gtk_print_settings_get_number_up ()
int
gtk_print_settings_get_number_up (GtkPrintSettings *settings
);
Gets the value of GTK_PRINT_SETTINGS_NUMBER_UP
.
gtk_print_settings_set_number_up ()
void gtk_print_settings_set_number_up (GtkPrintSettings *settings
,int number_up
);
Sets the value of GTK_PRINT_SETTINGS_NUMBER_UP
.
gtk_print_settings_get_number_up_layout ()
GtkNumberUpLayout
gtk_print_settings_get_number_up_layout
(GtkPrintSettings *settings
);
Gets the value of GTK_PRINT_SETTINGS_NUMBER_UP_LAYOUT
.
gtk_print_settings_set_number_up_layout ()
void gtk_print_settings_set_number_up_layout (GtkPrintSettings *settings
,GtkNumberUpLayout number_up_layout
);
Sets the value of GTK_PRINT_SETTINGS_NUMBER_UP_LAYOUT
.
gtk_print_settings_get_resolution ()
int
gtk_print_settings_get_resolution (GtkPrintSettings *settings
);
Gets the value of GTK_PRINT_SETTINGS_RESOLUTION
.
gtk_print_settings_set_resolution ()
void gtk_print_settings_set_resolution (GtkPrintSettings *settings
,int resolution
);
Sets the values of GTK_PRINT_SETTINGS_RESOLUTION
,
GTK_PRINT_SETTINGS_RESOLUTION_X
and
GTK_PRINT_SETTINGS_RESOLUTION_Y
.
gtk_print_settings_set_resolution_xy ()
void gtk_print_settings_set_resolution_xy (GtkPrintSettings *settings
,int resolution_x
,int resolution_y
);
Sets the values of GTK_PRINT_SETTINGS_RESOLUTION
,
GTK_PRINT_SETTINGS_RESOLUTION_X
and
GTK_PRINT_SETTINGS_RESOLUTION_Y
.
gtk_print_settings_get_resolution_x ()
int
gtk_print_settings_get_resolution_x (GtkPrintSettings *settings
);
Gets the value of GTK_PRINT_SETTINGS_RESOLUTION_X
.
gtk_print_settings_get_resolution_y ()
int
gtk_print_settings_get_resolution_y (GtkPrintSettings *settings
);
Gets the value of GTK_PRINT_SETTINGS_RESOLUTION_Y
.
gtk_print_settings_get_printer_lpi ()
double
gtk_print_settings_get_printer_lpi (GtkPrintSettings *settings
);
Gets the value of GTK_PRINT_SETTINGS_PRINTER_LPI
.
gtk_print_settings_set_printer_lpi ()
void gtk_print_settings_set_printer_lpi (GtkPrintSettings *settings
,double lpi
);
Sets the value of GTK_PRINT_SETTINGS_PRINTER_LPI
.
gtk_print_settings_get_scale ()
double
gtk_print_settings_get_scale (GtkPrintSettings *settings
);
Gets the value of GTK_PRINT_SETTINGS_SCALE
.
gtk_print_settings_set_scale ()
void gtk_print_settings_set_scale (GtkPrintSettings *settings
,double scale
);
Sets the value of GTK_PRINT_SETTINGS_SCALE
.
gtk_print_settings_get_print_pages ()
GtkPrintPages
gtk_print_settings_get_print_pages (GtkPrintSettings *settings
);
Gets the value of GTK_PRINT_SETTINGS_PRINT_PAGES
.
gtk_print_settings_set_print_pages ()
void gtk_print_settings_set_print_pages (GtkPrintSettings *settings
,GtkPrintPages pages
);
Sets the value of GTK_PRINT_SETTINGS_PRINT_PAGES
.
gtk_print_settings_get_page_ranges ()
GtkPageRange * gtk_print_settings_get_page_ranges (GtkPrintSettings *settings
,int *num_ranges
);
Gets the value of GTK_PRINT_SETTINGS_PAGE_RANGES
.
gtk_print_settings_set_page_ranges ()
void gtk_print_settings_set_page_ranges (GtkPrintSettings *settings
,GtkPageRange *page_ranges
,int num_ranges
);
Sets the value of GTK_PRINT_SETTINGS_PAGE_RANGES
.
gtk_print_settings_get_page_set ()
GtkPageSet
gtk_print_settings_get_page_set (GtkPrintSettings *settings
);
Gets the value of GTK_PRINT_SETTINGS_PAGE_SET
.
gtk_print_settings_set_page_set ()
void gtk_print_settings_set_page_set (GtkPrintSettings *settings
,GtkPageSet page_set
);
Sets the value of GTK_PRINT_SETTINGS_PAGE_SET
.
gtk_print_settings_get_default_source ()
const char *
gtk_print_settings_get_default_source (GtkPrintSettings *settings
);
Gets the value of GTK_PRINT_SETTINGS_DEFAULT_SOURCE
.
gtk_print_settings_set_default_source ()
void gtk_print_settings_set_default_source (GtkPrintSettings *settings
,const char *default_source
);
Sets the value of GTK_PRINT_SETTINGS_DEFAULT_SOURCE
.
gtk_print_settings_get_media_type ()
const char *
gtk_print_settings_get_media_type (GtkPrintSettings *settings
);
Gets the value of GTK_PRINT_SETTINGS_MEDIA_TYPE
.
The set of media types is defined in PWG 5101.1-2002 PWG.
gtk_print_settings_set_media_type ()
void gtk_print_settings_set_media_type (GtkPrintSettings *settings
,const char *media_type
);
Sets the value of GTK_PRINT_SETTINGS_MEDIA_TYPE
.
The set of media types is defined in PWG 5101.1-2002 PWG.
gtk_print_settings_get_dither ()
const char *
gtk_print_settings_get_dither (GtkPrintSettings *settings
);
Gets the value of GTK_PRINT_SETTINGS_DITHER
.
gtk_print_settings_set_dither ()
void gtk_print_settings_set_dither (GtkPrintSettings *settings
,const char *dither
);
Sets the value of GTK_PRINT_SETTINGS_DITHER
.
gtk_print_settings_get_finishings ()
const char *
gtk_print_settings_get_finishings (GtkPrintSettings *settings
);
Gets the value of GTK_PRINT_SETTINGS_FINISHINGS
.
gtk_print_settings_set_finishings ()
void gtk_print_settings_set_finishings (GtkPrintSettings *settings
,const char *finishings
);
Sets the value of GTK_PRINT_SETTINGS_FINISHINGS
.
gtk_print_settings_get_output_bin ()
const char *
gtk_print_settings_get_output_bin (GtkPrintSettings *settings
);
Gets the value of GTK_PRINT_SETTINGS_OUTPUT_BIN
.
gtk_print_settings_set_output_bin ()
void gtk_print_settings_set_output_bin (GtkPrintSettings *settings
,const char *output_bin
);
Sets the value of GTK_PRINT_SETTINGS_OUTPUT_BIN
.
gtk_print_settings_new_from_file ()
GtkPrintSettings * gtk_print_settings_new_from_file (const char *file_name
,GError **error
);
Reads the print settings from file_name
. Returns a new GtkPrintSettings
object with the restored settings, or NULL
if an error occurred. If the
file could not be loaded then error is set to either a GFileError or
GKeyFileError. See gtk_print_settings_to_file()
.
gtk_print_settings_new_from_key_file ()
GtkPrintSettings * gtk_print_settings_new_from_key_file (GKeyFile *key_file
,const char *group_name
,GError **error
);
Reads the print settings from the group group_name
in key_file
. Returns a
new GtkPrintSettings object with the restored settings, or NULL
if an
error occurred. If the file could not be loaded then error is set to either
a GFileError or GKeyFileError.
gtk_print_settings_new_from_gvariant ()
GtkPrintSettings *
gtk_print_settings_new_from_gvariant (GVariant *variant
);
Deserialize print settings from an a{sv} variant in
the format produced by gtk_print_settings_to_gvariant()
.
gtk_print_settings_load_file ()
gboolean gtk_print_settings_load_file (GtkPrintSettings *settings
,const char *file_name
,GError **error
);
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 gtk_print_settings_to_file()
.
gtk_print_settings_load_key_file ()
gboolean gtk_print_settings_load_key_file (GtkPrintSettings *settings
,GKeyFile *key_file
,const char *group_name
,GError **error
);
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.
gtk_print_settings_to_file ()
gboolean gtk_print_settings_to_file (GtkPrintSettings *settings
,const char *file_name
,GError **error
);
This function saves the print settings from settings
to file_name
. If the
file could not be loaded then error is set to either a GFileError or
GKeyFileError.
gtk_print_settings_to_key_file ()
void gtk_print_settings_to_key_file (GtkPrintSettings *settings
,GKeyFile *key_file
,const char *group_name
);
This function adds the print settings from settings
to key_file
.
gtk_print_settings_to_gvariant ()
GVariant *
gtk_print_settings_to_gvariant (GtkPrintSettings *settings
);
Serialize print settings to an a{sv} variant.
Types and Values
enum GtkNumberUpLayout
Used to determine the layout of pages on a sheet when printing multiple pages per sheet.
struct GtkPageRange
struct GtkPageRange { int start; int end; };
See also gtk_print_settings_set_page_ranges()
.
GTK_PRINT_SETTINGS_OUTPUT_DIR
#define GTK_PRINT_SETTINGS_OUTPUT_DIR "output-dir"
The key used by the “Print to file” printer to store the directory to which the output should be written.
GTK_PRINT_SETTINGS_OUTPUT_BASENAME
#define GTK_PRINT_SETTINGS_OUTPUT_BASENAME "output-basename"
The key used by the “Print to file” printer to store the file name of the output without the path to the directory and the file extension.
GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT
#define GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT "output-file-format"
The key used by the “Print to file” printer to store the format of the output. The supported values are “PS” and “PDF”.
GTK_PRINT_SETTINGS_OUTPUT_URI
#define GTK_PRINT_SETTINGS_OUTPUT_URI "output-uri"
The key used by the “Print to file” printer to store the URI to which the output should be written. GTK itself supports only “file://” URIs.
GTK_PRINT_SETTINGS_WIN32_DRIVER_EXTRA
#define GTK_PRINT_SETTINGS_WIN32_DRIVER_EXTRA "win32-driver-extra"