1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gtk.PrintSettings;
26 
27 private import glib.ConstructionException;
28 private import glib.ErrorG;
29 private import glib.GException;
30 private import glib.KeyFile;
31 private import glib.Str;
32 private import glib.Variant;
33 private import glib.c.functions;
34 private import gobject.ObjectG;
35 private import gtk.PaperSize;
36 private import gtk.c.functions;
37 public  import gtk.c.types;
38 
39 
40 /**
41  * A `GtkPrintSettings` object represents the settings of a print dialog in
42  * a system-independent way.
43  * 
44  * The main use for this object is that once you’ve printed you can get a
45  * settings object that represents the settings the user chose, and the next
46  * time you print you can pass that object in so that the user doesn’t have
47  * to re-set all his settings.
48  * 
49  * Its also possible to enumerate the settings so that you can easily save
50  * the settings for the next time your app runs, or even store them in a
51  * document. The predefined keys try to use shared values as much as possible
52  * so that moving such a document between systems still works.
53  */
54 public class PrintSettings : ObjectG
55 {
56 	/** the main Gtk struct */
57 	protected GtkPrintSettings* gtkPrintSettings;
58 
59 	/** Get the main Gtk struct */
60 	public GtkPrintSettings* getPrintSettingsStruct(bool transferOwnership = false)
61 	{
62 		if (transferOwnership)
63 			ownedRef = false;
64 		return gtkPrintSettings;
65 	}
66 
67 	/** the main Gtk struct as a void* */
68 	protected override void* getStruct()
69 	{
70 		return cast(void*)gtkPrintSettings;
71 	}
72 
73 	/**
74 	 * Sets our main struct and passes it to the parent class.
75 	 */
76 	public this (GtkPrintSettings* gtkPrintSettings, bool ownedRef = false)
77 	{
78 		this.gtkPrintSettings = gtkPrintSettings;
79 		super(cast(GObject*)gtkPrintSettings, ownedRef);
80 	}
81 
82 
83 	/** */
84 	public static GType getType()
85 	{
86 		return gtk_print_settings_get_type();
87 	}
88 
89 	/**
90 	 * Creates a new `GtkPrintSettings` object.
91 	 *
92 	 * Returns: a new `GtkPrintSettings` object
93 	 *
94 	 * Throws: ConstructionException GTK+ fails to create the object.
95 	 */
96 	public this()
97 	{
98 		auto __p = gtk_print_settings_new();
99 
100 		if(__p is null)
101 		{
102 			throw new ConstructionException("null returned by new");
103 		}
104 
105 		this(cast(GtkPrintSettings*) __p, true);
106 	}
107 
108 	/**
109 	 * Reads the print settings from @file_name.
110 	 *
111 	 * Returns a new `GtkPrintSettings` object with the restored settings,
112 	 * or %NULL if an error occurred. If the file could not be loaded then
113 	 * error is set to either a `GFileError` or `GKeyFileError`.
114 	 *
115 	 * See [method@Gtk.PrintSettings.to_file].
116 	 *
117 	 * Params:
118 	 *     fileName = the filename to read the settings from
119 	 *
120 	 * Returns: the restored `GtkPrintSettings`
121 	 *
122 	 * Throws: GException on failure.
123 	 * Throws: ConstructionException GTK+ fails to create the object.
124 	 */
125 	public this(string fileName)
126 	{
127 		GError* err = null;
128 
129 		auto __p = gtk_print_settings_new_from_file(Str.toStringz(fileName), &err);
130 
131 		if (err !is null)
132 		{
133 			throw new GException( new ErrorG(err) );
134 		}
135 
136 		if(__p is null)
137 		{
138 			throw new ConstructionException("null returned by new_from_file");
139 		}
140 
141 		this(cast(GtkPrintSettings*) __p, true);
142 	}
143 
144 	/**
145 	 * Deserialize print settings from an a{sv} variant.
146 	 *
147 	 * The variant must be in the format produced by
148 	 * [method@Gtk.PrintSettings.to_gvariant].
149 	 *
150 	 * Params:
151 	 *     variant = an a{sv} `GVariant`
152 	 *
153 	 * Returns: a new `GtkPrintSettings` object
154 	 *
155 	 * Throws: ConstructionException GTK+ fails to create the object.
156 	 */
157 	public this(Variant variant)
158 	{
159 		auto __p = gtk_print_settings_new_from_gvariant((variant is null) ? null : variant.getVariantStruct());
160 
161 		if(__p is null)
162 		{
163 			throw new ConstructionException("null returned by new_from_gvariant");
164 		}
165 
166 		this(cast(GtkPrintSettings*) __p, true);
167 	}
168 
169 	/**
170 	 * Reads the print settings from the group @group_name in @key_file.
171 	 *
172 	 * Returns a new `GtkPrintSettings` object with the restored settings,
173 	 * or %NULL if an error occurred. If the file could not be loaded then
174 	 * error is set to either `GFileError` or `GKeyFileError`.
175 	 *
176 	 * Params:
177 	 *     keyFile = the `GKeyFile` to retrieve the settings from
178 	 *     groupName = the name of the group to use, or %NULL to use
179 	 *         the default “Print Settings”
180 	 *
181 	 * Returns: the restored `GtkPrintSettings`
182 	 *
183 	 * Throws: GException on failure.
184 	 * Throws: ConstructionException GTK+ fails to create the object.
185 	 */
186 	public this(KeyFile keyFile, string groupName)
187 	{
188 		GError* err = null;
189 
190 		auto __p = gtk_print_settings_new_from_key_file((keyFile is null) ? null : keyFile.getKeyFileStruct(), Str.toStringz(groupName), &err);
191 
192 		if (err !is null)
193 		{
194 			throw new GException( new ErrorG(err) );
195 		}
196 
197 		if(__p is null)
198 		{
199 			throw new ConstructionException("null returned by new_from_key_file");
200 		}
201 
202 		this(cast(GtkPrintSettings*) __p, true);
203 	}
204 
205 	/**
206 	 * Copies a `GtkPrintSettings` object.
207 	 *
208 	 * Returns: a newly allocated copy of @other
209 	 */
210 	public PrintSettings copy()
211 	{
212 		auto __p = gtk_print_settings_copy(gtkPrintSettings);
213 
214 		if(__p is null)
215 		{
216 			return null;
217 		}
218 
219 		return ObjectG.getDObject!(PrintSettings)(cast(GtkPrintSettings*) __p, true);
220 	}
221 
222 	alias foreac = foreach_;
223 	/**
224 	 * Calls @func for each key-value pair of @settings.
225 	 *
226 	 * Params:
227 	 *     func = the function to call
228 	 *     userData = user data for @func
229 	 */
230 	public void foreach_(GtkPrintSettingsFunc func, void* userData)
231 	{
232 		gtk_print_settings_foreach(gtkPrintSettings, func, userData);
233 	}
234 
235 	/**
236 	 * Looks up the string value associated with @key.
237 	 *
238 	 * Params:
239 	 *     key = a key
240 	 *
241 	 * Returns: the string value for @key
242 	 */
243 	public string get(string key)
244 	{
245 		return Str.toString(gtk_print_settings_get(gtkPrintSettings, Str.toStringz(key)));
246 	}
247 
248 	/**
249 	 * Returns the boolean represented by the value
250 	 * that is associated with @key.
251 	 *
252 	 * The string “true” represents %TRUE, any other
253 	 * string %FALSE.
254 	 *
255 	 * Params:
256 	 *     key = a key
257 	 *
258 	 * Returns: %TRUE, if @key maps to a true value.
259 	 */
260 	public bool getBool(string key)
261 	{
262 		return gtk_print_settings_get_bool(gtkPrintSettings, Str.toStringz(key)) != 0;
263 	}
264 
265 	/**
266 	 * Gets the value of %GTK_PRINT_SETTINGS_COLLATE.
267 	 *
268 	 * Returns: whether to collate the printed pages
269 	 */
270 	public bool getCollate()
271 	{
272 		return gtk_print_settings_get_collate(gtkPrintSettings) != 0;
273 	}
274 
275 	/**
276 	 * Gets the value of %GTK_PRINT_SETTINGS_DEFAULT_SOURCE.
277 	 *
278 	 * Returns: the default source
279 	 */
280 	public string getDefaultSource()
281 	{
282 		return Str.toString(gtk_print_settings_get_default_source(gtkPrintSettings));
283 	}
284 
285 	/**
286 	 * Gets the value of %GTK_PRINT_SETTINGS_DITHER.
287 	 *
288 	 * Returns: the dithering that is used
289 	 */
290 	public string getDither()
291 	{
292 		return Str.toString(gtk_print_settings_get_dither(gtkPrintSettings));
293 	}
294 
295 	/**
296 	 * Returns the double value associated with @key, or 0.
297 	 *
298 	 * Params:
299 	 *     key = a key
300 	 *
301 	 * Returns: the double value of @key
302 	 */
303 	public double getDouble(string key)
304 	{
305 		return gtk_print_settings_get_double(gtkPrintSettings, Str.toStringz(key));
306 	}
307 
308 	/**
309 	 * Returns the floating point number represented by
310 	 * the value that is associated with @key, or @default_val
311 	 * if the value does not represent a floating point number.
312 	 *
313 	 * Floating point numbers are parsed with g_ascii_strtod().
314 	 *
315 	 * Params:
316 	 *     key = a key
317 	 *     def = the default value
318 	 *
319 	 * Returns: the floating point number associated with @key
320 	 */
321 	public double getDoubleWithDefault(string key, double def)
322 	{
323 		return gtk_print_settings_get_double_with_default(gtkPrintSettings, Str.toStringz(key), def);
324 	}
325 
326 	/**
327 	 * Gets the value of %GTK_PRINT_SETTINGS_DUPLEX.
328 	 *
329 	 * Returns: whether to print the output in duplex.
330 	 */
331 	public GtkPrintDuplex getDuplex()
332 	{
333 		return gtk_print_settings_get_duplex(gtkPrintSettings);
334 	}
335 
336 	/**
337 	 * Gets the value of %GTK_PRINT_SETTINGS_FINISHINGS.
338 	 *
339 	 * Returns: the finishings
340 	 */
341 	public string getFinishings()
342 	{
343 		return Str.toString(gtk_print_settings_get_finishings(gtkPrintSettings));
344 	}
345 
346 	/**
347 	 * Returns the integer value of @key, or 0.
348 	 *
349 	 * Params:
350 	 *     key = a key
351 	 *
352 	 * Returns: the integer value of @key
353 	 */
354 	public int getInt(string key)
355 	{
356 		return gtk_print_settings_get_int(gtkPrintSettings, Str.toStringz(key));
357 	}
358 
359 	/**
360 	 * Returns the value of @key, interpreted as
361 	 * an integer, or the default value.
362 	 *
363 	 * Params:
364 	 *     key = a key
365 	 *     def = the default value
366 	 *
367 	 * Returns: the integer value of @key
368 	 */
369 	public int getIntWithDefault(string key, int def)
370 	{
371 		return gtk_print_settings_get_int_with_default(gtkPrintSettings, Str.toStringz(key), def);
372 	}
373 
374 	/**
375 	 * Returns the value associated with @key, interpreted
376 	 * as a length.
377 	 *
378 	 * The returned value is converted to @units.
379 	 *
380 	 * Params:
381 	 *     key = a key
382 	 *     unit = the unit of the return value
383 	 *
384 	 * Returns: the length value of @key, converted to @unit
385 	 */
386 	public double getLength(string key, GtkUnit unit)
387 	{
388 		return gtk_print_settings_get_length(gtkPrintSettings, Str.toStringz(key), unit);
389 	}
390 
391 	/**
392 	 * Gets the value of %GTK_PRINT_SETTINGS_MEDIA_TYPE.
393 	 *
394 	 * The set of media types is defined in PWG 5101.1-2002 PWG.
395 	 *
396 	 * Returns: the media type
397 	 */
398 	public string getMediaType()
399 	{
400 		return Str.toString(gtk_print_settings_get_media_type(gtkPrintSettings));
401 	}
402 
403 	/**
404 	 * Gets the value of %GTK_PRINT_SETTINGS_N_COPIES.
405 	 *
406 	 * Returns: the number of copies to print
407 	 */
408 	public int getNCopies()
409 	{
410 		return gtk_print_settings_get_n_copies(gtkPrintSettings);
411 	}
412 
413 	/**
414 	 * Gets the value of %GTK_PRINT_SETTINGS_NUMBER_UP.
415 	 *
416 	 * Returns: the number of pages per sheet
417 	 */
418 	public int getNumberUp()
419 	{
420 		return gtk_print_settings_get_number_up(gtkPrintSettings);
421 	}
422 
423 	/**
424 	 * Gets the value of %GTK_PRINT_SETTINGS_NUMBER_UP_LAYOUT.
425 	 *
426 	 * Returns: layout of page in number-up mode
427 	 */
428 	public GtkNumberUpLayout getNumberUpLayout()
429 	{
430 		return gtk_print_settings_get_number_up_layout(gtkPrintSettings);
431 	}
432 
433 	/**
434 	 * Get the value of %GTK_PRINT_SETTINGS_ORIENTATION,
435 	 * converted to a `GtkPageOrientation`.
436 	 *
437 	 * Returns: the orientation
438 	 */
439 	public GtkPageOrientation getOrientation()
440 	{
441 		return gtk_print_settings_get_orientation(gtkPrintSettings);
442 	}
443 
444 	/**
445 	 * Gets the value of %GTK_PRINT_SETTINGS_OUTPUT_BIN.
446 	 *
447 	 * Returns: the output bin
448 	 */
449 	public string getOutputBin()
450 	{
451 		return Str.toString(gtk_print_settings_get_output_bin(gtkPrintSettings));
452 	}
453 
454 	/**
455 	 * Gets the value of %GTK_PRINT_SETTINGS_PAGE_RANGES.
456 	 *
457 	 * Returns: an array
458 	 *     of `GtkPageRange`s. Use g_free() to free the array when
459 	 *     it is no longer needed.
460 	 */
461 	public GtkPageRange[] getPageRanges()
462 	{
463 		int numRanges;
464 
465 		auto __p = gtk_print_settings_get_page_ranges(gtkPrintSettings, &numRanges);
466 
467 		return __p[0 .. numRanges];
468 	}
469 
470 	/**
471 	 * Gets the value of %GTK_PRINT_SETTINGS_PAGE_SET.
472 	 *
473 	 * Returns: the set of pages to print
474 	 */
475 	public GtkPageSet getPageSet()
476 	{
477 		return gtk_print_settings_get_page_set(gtkPrintSettings);
478 	}
479 
480 	/**
481 	 * Gets the value of %GTK_PRINT_SETTINGS_PAPER_HEIGHT,
482 	 * converted to @unit.
483 	 *
484 	 * Params:
485 	 *     unit = the unit for the return value
486 	 *
487 	 * Returns: the paper height, in units of @unit
488 	 */
489 	public double getPaperHeight(GtkUnit unit)
490 	{
491 		return gtk_print_settings_get_paper_height(gtkPrintSettings, unit);
492 	}
493 
494 	/**
495 	 * Gets the value of %GTK_PRINT_SETTINGS_PAPER_FORMAT,
496 	 * converted to a `GtkPaperSize`.
497 	 *
498 	 * Returns: the paper size
499 	 */
500 	public PaperSize getPaperSize()
501 	{
502 		auto __p = gtk_print_settings_get_paper_size(gtkPrintSettings);
503 
504 		if(__p is null)
505 		{
506 			return null;
507 		}
508 
509 		return ObjectG.getDObject!(PaperSize)(cast(GtkPaperSize*) __p, true);
510 	}
511 
512 	/**
513 	 * Gets the value of %GTK_PRINT_SETTINGS_PAPER_WIDTH,
514 	 * converted to @unit.
515 	 *
516 	 * Params:
517 	 *     unit = the unit for the return value
518 	 *
519 	 * Returns: the paper width, in units of @unit
520 	 */
521 	public double getPaperWidth(GtkUnit unit)
522 	{
523 		return gtk_print_settings_get_paper_width(gtkPrintSettings, unit);
524 	}
525 
526 	/**
527 	 * Gets the value of %GTK_PRINT_SETTINGS_PRINT_PAGES.
528 	 *
529 	 * Returns: which pages to print
530 	 */
531 	public GtkPrintPages getPrintPages()
532 	{
533 		return gtk_print_settings_get_print_pages(gtkPrintSettings);
534 	}
535 
536 	/**
537 	 * Convenience function to obtain the value of
538 	 * %GTK_PRINT_SETTINGS_PRINTER.
539 	 *
540 	 * Returns: the printer name
541 	 */
542 	public string getPrinter()
543 	{
544 		return Str.toString(gtk_print_settings_get_printer(gtkPrintSettings));
545 	}
546 
547 	/**
548 	 * Gets the value of %GTK_PRINT_SETTINGS_PRINTER_LPI.
549 	 *
550 	 * Returns: the resolution in lpi (lines per inch)
551 	 */
552 	public double getPrinterLpi()
553 	{
554 		return gtk_print_settings_get_printer_lpi(gtkPrintSettings);
555 	}
556 
557 	/**
558 	 * Gets the value of %GTK_PRINT_SETTINGS_QUALITY.
559 	 *
560 	 * Returns: the print quality
561 	 */
562 	public GtkPrintQuality getQuality()
563 	{
564 		return gtk_print_settings_get_quality(gtkPrintSettings);
565 	}
566 
567 	/**
568 	 * Gets the value of %GTK_PRINT_SETTINGS_RESOLUTION.
569 	 *
570 	 * Returns: the resolution in dpi
571 	 */
572 	public int getResolution()
573 	{
574 		return gtk_print_settings_get_resolution(gtkPrintSettings);
575 	}
576 
577 	/**
578 	 * Gets the value of %GTK_PRINT_SETTINGS_RESOLUTION_X.
579 	 *
580 	 * Returns: the horizontal resolution in dpi
581 	 */
582 	public int getResolutionX()
583 	{
584 		return gtk_print_settings_get_resolution_x(gtkPrintSettings);
585 	}
586 
587 	/**
588 	 * Gets the value of %GTK_PRINT_SETTINGS_RESOLUTION_Y.
589 	 *
590 	 * Returns: the vertical resolution in dpi
591 	 */
592 	public int getResolutionY()
593 	{
594 		return gtk_print_settings_get_resolution_y(gtkPrintSettings);
595 	}
596 
597 	/**
598 	 * Gets the value of %GTK_PRINT_SETTINGS_REVERSE.
599 	 *
600 	 * Returns: whether to reverse the order of the printed pages
601 	 */
602 	public bool getReverse()
603 	{
604 		return gtk_print_settings_get_reverse(gtkPrintSettings) != 0;
605 	}
606 
607 	/**
608 	 * Gets the value of %GTK_PRINT_SETTINGS_SCALE.
609 	 *
610 	 * Returns: the scale in percent
611 	 */
612 	public double getScale()
613 	{
614 		return gtk_print_settings_get_scale(gtkPrintSettings);
615 	}
616 
617 	/**
618 	 * Gets the value of %GTK_PRINT_SETTINGS_USE_COLOR.
619 	 *
620 	 * Returns: whether to use color
621 	 */
622 	public bool getUseColor()
623 	{
624 		return gtk_print_settings_get_use_color(gtkPrintSettings) != 0;
625 	}
626 
627 	/**
628 	 * Returns %TRUE, if a value is associated with @key.
629 	 *
630 	 * Params:
631 	 *     key = a key
632 	 *
633 	 * Returns: %TRUE, if @key has a value
634 	 */
635 	public bool hasKey(string key)
636 	{
637 		return gtk_print_settings_has_key(gtkPrintSettings, Str.toStringz(key)) != 0;
638 	}
639 
640 	/**
641 	 * Reads the print settings from @file_name.
642 	 *
643 	 * If the file could not be loaded then error is set to either
644 	 * a `GFileError` or `GKeyFileError`.
645 	 *
646 	 * See [method@Gtk.PrintSettings.to_file].
647 	 *
648 	 * Params:
649 	 *     fileName = the filename to read the settings from
650 	 *
651 	 * Returns: %TRUE on success
652 	 *
653 	 * Throws: GException on failure.
654 	 */
655 	public bool loadFile(string fileName)
656 	{
657 		GError* err = null;
658 
659 		auto __p = gtk_print_settings_load_file(gtkPrintSettings, Str.toStringz(fileName), &err) != 0;
660 
661 		if (err !is null)
662 		{
663 			throw new GException( new ErrorG(err) );
664 		}
665 
666 		return __p;
667 	}
668 
669 	/**
670 	 * Reads the print settings from the group @group_name in @key_file.
671 	 *
672 	 * If the file could not be loaded then error is set to either a
673 	 * `GFileError` or `GKeyFileError`.
674 	 *
675 	 * Params:
676 	 *     keyFile = the `GKeyFile` to retrieve the settings from
677 	 *     groupName = the name of the group to use, or %NULL
678 	 *         to use the default “Print Settings”
679 	 *
680 	 * Returns: %TRUE on success
681 	 *
682 	 * Throws: GException on failure.
683 	 */
684 	public bool loadKeyFile(KeyFile keyFile, string groupName)
685 	{
686 		GError* err = null;
687 
688 		auto __p = gtk_print_settings_load_key_file(gtkPrintSettings, (keyFile is null) ? null : keyFile.getKeyFileStruct(), Str.toStringz(groupName), &err) != 0;
689 
690 		if (err !is null)
691 		{
692 			throw new GException( new ErrorG(err) );
693 		}
694 
695 		return __p;
696 	}
697 
698 	/**
699 	 * Associates @value with @key.
700 	 *
701 	 * Params:
702 	 *     key = a key
703 	 *     value = a string value, or %NULL
704 	 */
705 	public void set(string key, string value)
706 	{
707 		gtk_print_settings_set(gtkPrintSettings, Str.toStringz(key), Str.toStringz(value));
708 	}
709 
710 	/**
711 	 * Sets @key to a boolean value.
712 	 *
713 	 * Params:
714 	 *     key = a key
715 	 *     value = a boolean
716 	 */
717 	public void setBool(string key, bool value)
718 	{
719 		gtk_print_settings_set_bool(gtkPrintSettings, Str.toStringz(key), value);
720 	}
721 
722 	/**
723 	 * Sets the value of %GTK_PRINT_SETTINGS_COLLATE.
724 	 *
725 	 * Params:
726 	 *     collate = whether to collate the output
727 	 */
728 	public void setCollate(bool collate)
729 	{
730 		gtk_print_settings_set_collate(gtkPrintSettings, collate);
731 	}
732 
733 	/**
734 	 * Sets the value of %GTK_PRINT_SETTINGS_DEFAULT_SOURCE.
735 	 *
736 	 * Params:
737 	 *     defaultSource = the default source
738 	 */
739 	public void setDefaultSource(string defaultSource)
740 	{
741 		gtk_print_settings_set_default_source(gtkPrintSettings, Str.toStringz(defaultSource));
742 	}
743 
744 	/**
745 	 * Sets the value of %GTK_PRINT_SETTINGS_DITHER.
746 	 *
747 	 * Params:
748 	 *     dither = the dithering that is used
749 	 */
750 	public void setDither(string dither)
751 	{
752 		gtk_print_settings_set_dither(gtkPrintSettings, Str.toStringz(dither));
753 	}
754 
755 	/**
756 	 * Sets @key to a double value.
757 	 *
758 	 * Params:
759 	 *     key = a key
760 	 *     value = a double value
761 	 */
762 	public void setDouble(string key, double value)
763 	{
764 		gtk_print_settings_set_double(gtkPrintSettings, Str.toStringz(key), value);
765 	}
766 
767 	/**
768 	 * Sets the value of %GTK_PRINT_SETTINGS_DUPLEX.
769 	 *
770 	 * Params:
771 	 *     duplex = a #GtkPrintDuplex value
772 	 */
773 	public void setDuplex(GtkPrintDuplex duplex)
774 	{
775 		gtk_print_settings_set_duplex(gtkPrintSettings, duplex);
776 	}
777 
778 	/**
779 	 * Sets the value of %GTK_PRINT_SETTINGS_FINISHINGS.
780 	 *
781 	 * Params:
782 	 *     finishings = the finishings
783 	 */
784 	public void setFinishings(string finishings)
785 	{
786 		gtk_print_settings_set_finishings(gtkPrintSettings, Str.toStringz(finishings));
787 	}
788 
789 	/**
790 	 * Sets @key to an integer value.
791 	 *
792 	 * Params:
793 	 *     key = a key
794 	 *     value = an integer
795 	 */
796 	public void setInt(string key, int value)
797 	{
798 		gtk_print_settings_set_int(gtkPrintSettings, Str.toStringz(key), value);
799 	}
800 
801 	/**
802 	 * Associates a length in units of @unit with @key.
803 	 *
804 	 * Params:
805 	 *     key = a key
806 	 *     value = a length
807 	 *     unit = the unit of @length
808 	 */
809 	public void setLength(string key, double value, GtkUnit unit)
810 	{
811 		gtk_print_settings_set_length(gtkPrintSettings, Str.toStringz(key), value, unit);
812 	}
813 
814 	/**
815 	 * Sets the value of %GTK_PRINT_SETTINGS_MEDIA_TYPE.
816 	 *
817 	 * The set of media types is defined in PWG 5101.1-2002 PWG.
818 	 *
819 	 * Params:
820 	 *     mediaType = the media type
821 	 */
822 	public void setMediaType(string mediaType)
823 	{
824 		gtk_print_settings_set_media_type(gtkPrintSettings, Str.toStringz(mediaType));
825 	}
826 
827 	/**
828 	 * Sets the value of %GTK_PRINT_SETTINGS_N_COPIES.
829 	 *
830 	 * Params:
831 	 *     numCopies = the number of copies
832 	 */
833 	public void setNCopies(int numCopies)
834 	{
835 		gtk_print_settings_set_n_copies(gtkPrintSettings, numCopies);
836 	}
837 
838 	/**
839 	 * Sets the value of %GTK_PRINT_SETTINGS_NUMBER_UP.
840 	 *
841 	 * Params:
842 	 *     numberUp = the number of pages per sheet
843 	 */
844 	public void setNumberUp(int numberUp)
845 	{
846 		gtk_print_settings_set_number_up(gtkPrintSettings, numberUp);
847 	}
848 
849 	/**
850 	 * Sets the value of %GTK_PRINT_SETTINGS_NUMBER_UP_LAYOUT.
851 	 *
852 	 * Params:
853 	 *     numberUpLayout = a #GtkNumberUpLayout value
854 	 */
855 	public void setNumberUpLayout(GtkNumberUpLayout numberUpLayout)
856 	{
857 		gtk_print_settings_set_number_up_layout(gtkPrintSettings, numberUpLayout);
858 	}
859 
860 	/**
861 	 * Sets the value of %GTK_PRINT_SETTINGS_ORIENTATION.
862 	 *
863 	 * Params:
864 	 *     orientation = a page orientation
865 	 */
866 	public void setOrientation(GtkPageOrientation orientation)
867 	{
868 		gtk_print_settings_set_orientation(gtkPrintSettings, orientation);
869 	}
870 
871 	/**
872 	 * Sets the value of %GTK_PRINT_SETTINGS_OUTPUT_BIN.
873 	 *
874 	 * Params:
875 	 *     outputBin = the output bin
876 	 */
877 	public void setOutputBin(string outputBin)
878 	{
879 		gtk_print_settings_set_output_bin(gtkPrintSettings, Str.toStringz(outputBin));
880 	}
881 
882 	/**
883 	 * Sets the value of %GTK_PRINT_SETTINGS_PAGE_RANGES.
884 	 *
885 	 * Params:
886 	 *     pageRanges = an array of `GtkPageRange`s
887 	 */
888 	public void setPageRanges(GtkPageRange[] pageRanges)
889 	{
890 		gtk_print_settings_set_page_ranges(gtkPrintSettings, pageRanges.ptr, cast(int)pageRanges.length);
891 	}
892 
893 	/**
894 	 * Sets the value of %GTK_PRINT_SETTINGS_PAGE_SET.
895 	 *
896 	 * Params:
897 	 *     pageSet = a #GtkPageSet value
898 	 */
899 	public void setPageSet(GtkPageSet pageSet)
900 	{
901 		gtk_print_settings_set_page_set(gtkPrintSettings, pageSet);
902 	}
903 
904 	/**
905 	 * Sets the value of %GTK_PRINT_SETTINGS_PAPER_HEIGHT.
906 	 *
907 	 * Params:
908 	 *     height = the paper height
909 	 *     unit = the units of @height
910 	 */
911 	public void setPaperHeight(double height, GtkUnit unit)
912 	{
913 		gtk_print_settings_set_paper_height(gtkPrintSettings, height, unit);
914 	}
915 
916 	/**
917 	 * Sets the value of %GTK_PRINT_SETTINGS_PAPER_FORMAT,
918 	 * %GTK_PRINT_SETTINGS_PAPER_WIDTH and
919 	 * %GTK_PRINT_SETTINGS_PAPER_HEIGHT.
920 	 *
921 	 * Params:
922 	 *     paperSize = a paper size
923 	 */
924 	public void setPaperSize(PaperSize paperSize)
925 	{
926 		gtk_print_settings_set_paper_size(gtkPrintSettings, (paperSize is null) ? null : paperSize.getPaperSizeStruct());
927 	}
928 
929 	/**
930 	 * Sets the value of %GTK_PRINT_SETTINGS_PAPER_WIDTH.
931 	 *
932 	 * Params:
933 	 *     width = the paper width
934 	 *     unit = the units of @width
935 	 */
936 	public void setPaperWidth(double width, GtkUnit unit)
937 	{
938 		gtk_print_settings_set_paper_width(gtkPrintSettings, width, unit);
939 	}
940 
941 	/**
942 	 * Sets the value of %GTK_PRINT_SETTINGS_PRINT_PAGES.
943 	 *
944 	 * Params:
945 	 *     pages = a #GtkPrintPages value
946 	 */
947 	public void setPrintPages(GtkPrintPages pages)
948 	{
949 		gtk_print_settings_set_print_pages(gtkPrintSettings, pages);
950 	}
951 
952 	/**
953 	 * Convenience function to set %GTK_PRINT_SETTINGS_PRINTER
954 	 * to @printer.
955 	 *
956 	 * Params:
957 	 *     printer = the printer name
958 	 */
959 	public void setPrinter(string printer)
960 	{
961 		gtk_print_settings_set_printer(gtkPrintSettings, Str.toStringz(printer));
962 	}
963 
964 	/**
965 	 * Sets the value of %GTK_PRINT_SETTINGS_PRINTER_LPI.
966 	 *
967 	 * Params:
968 	 *     lpi = the resolution in lpi (lines per inch)
969 	 */
970 	public void setPrinterLpi(double lpi)
971 	{
972 		gtk_print_settings_set_printer_lpi(gtkPrintSettings, lpi);
973 	}
974 
975 	/**
976 	 * Sets the value of %GTK_PRINT_SETTINGS_QUALITY.
977 	 *
978 	 * Params:
979 	 *     quality = a #GtkPrintQuality value
980 	 */
981 	public void setQuality(GtkPrintQuality quality)
982 	{
983 		gtk_print_settings_set_quality(gtkPrintSettings, quality);
984 	}
985 
986 	/**
987 	 * Sets the values of %GTK_PRINT_SETTINGS_RESOLUTION,
988 	 * %GTK_PRINT_SETTINGS_RESOLUTION_X and
989 	 * %GTK_PRINT_SETTINGS_RESOLUTION_Y.
990 	 *
991 	 * Params:
992 	 *     resolution = the resolution in dpi
993 	 */
994 	public void setResolution(int resolution)
995 	{
996 		gtk_print_settings_set_resolution(gtkPrintSettings, resolution);
997 	}
998 
999 	/**
1000 	 * Sets the values of %GTK_PRINT_SETTINGS_RESOLUTION,
1001 	 * %GTK_PRINT_SETTINGS_RESOLUTION_X and
1002 	 * %GTK_PRINT_SETTINGS_RESOLUTION_Y.
1003 	 *
1004 	 * Params:
1005 	 *     resolutionX = the horizontal resolution in dpi
1006 	 *     resolutionY = the vertical resolution in dpi
1007 	 */
1008 	public void setResolutionXy(int resolutionX, int resolutionY)
1009 	{
1010 		gtk_print_settings_set_resolution_xy(gtkPrintSettings, resolutionX, resolutionY);
1011 	}
1012 
1013 	/**
1014 	 * Sets the value of %GTK_PRINT_SETTINGS_REVERSE.
1015 	 *
1016 	 * Params:
1017 	 *     reverse = whether to reverse the output
1018 	 */
1019 	public void setReverse(bool reverse)
1020 	{
1021 		gtk_print_settings_set_reverse(gtkPrintSettings, reverse);
1022 	}
1023 
1024 	/**
1025 	 * Sets the value of %GTK_PRINT_SETTINGS_SCALE.
1026 	 *
1027 	 * Params:
1028 	 *     scale = the scale in percent
1029 	 */
1030 	public void setScale(double scale)
1031 	{
1032 		gtk_print_settings_set_scale(gtkPrintSettings, scale);
1033 	}
1034 
1035 	/**
1036 	 * Sets the value of %GTK_PRINT_SETTINGS_USE_COLOR.
1037 	 *
1038 	 * Params:
1039 	 *     useColor = whether to use color
1040 	 */
1041 	public void setUseColor(bool useColor)
1042 	{
1043 		gtk_print_settings_set_use_color(gtkPrintSettings, useColor);
1044 	}
1045 
1046 	/**
1047 	 * This function saves the print settings from @settings to @file_name.
1048 	 *
1049 	 * If the file could not be written then error is set to either a
1050 	 * `GFileError` or `GKeyFileError`.
1051 	 *
1052 	 * Params:
1053 	 *     fileName = the file to save to
1054 	 *
1055 	 * Returns: %TRUE on success
1056 	 *
1057 	 * Throws: GException on failure.
1058 	 */
1059 	public bool toFile(string fileName)
1060 	{
1061 		GError* err = null;
1062 
1063 		auto __p = gtk_print_settings_to_file(gtkPrintSettings, Str.toStringz(fileName), &err) != 0;
1064 
1065 		if (err !is null)
1066 		{
1067 			throw new GException( new ErrorG(err) );
1068 		}
1069 
1070 		return __p;
1071 	}
1072 
1073 	/**
1074 	 * Serialize print settings to an a{sv} variant.
1075 	 *
1076 	 * Returns: a new, floating, `GVariant`
1077 	 */
1078 	public Variant toGvariant()
1079 	{
1080 		auto __p = gtk_print_settings_to_gvariant(gtkPrintSettings);
1081 
1082 		if(__p is null)
1083 		{
1084 			return null;
1085 		}
1086 
1087 		return new Variant(cast(GVariant*) __p);
1088 	}
1089 
1090 	/**
1091 	 * This function adds the print settings from @settings to @key_file.
1092 	 *
1093 	 * Params:
1094 	 *     keyFile = the `GKeyFile` to save the print settings to
1095 	 *     groupName = the group to add the settings to in @key_file, or
1096 	 *         %NULL to use the default “Print Settings”
1097 	 */
1098 	public void toKeyFile(KeyFile keyFile, string groupName)
1099 	{
1100 		gtk_print_settings_to_key_file(gtkPrintSettings, (keyFile is null) ? null : keyFile.getKeyFileStruct(), Str.toStringz(groupName));
1101 	}
1102 
1103 	/**
1104 	 * Removes any value associated with @key.
1105 	 *
1106 	 * This has the same effect as setting the value to %NULL.
1107 	 *
1108 	 * Params:
1109 	 *     key = a key
1110 	 */
1111 	public void unset(string key)
1112 	{
1113 		gtk_print_settings_unset(gtkPrintSettings, Str.toStringz(key));
1114 	}
1115 }