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.FileChooserT;
26 
27 public  import gio.File;
28 public  import gio.FileIF;
29 public  import glib.ErrorG;
30 public  import glib.GException;
31 public  import glib.ListSG;
32 public  import glib.Str;
33 public  import gobject.ObjectG;
34 public  import gobject.Signals;
35 public  import gtk.FileFilter;
36 public  import gtk.Widget;
37 public  import gtkc.gtk;
38 public  import gtkc.gtktypes;
39 public  import std.algorithm;
40 
41 
42 /**
43  * #GtkFileChooser is an interface that can be implemented by file
44  * selection widgets.  In GTK+, the main objects that implement this
45  * interface are #GtkFileChooserWidget, #GtkFileChooserDialog, and
46  * #GtkFileChooserButton.  You do not need to write an object that
47  * implements the #GtkFileChooser interface unless you are trying to
48  * adapt an existing file selector to expose a standard programming
49  * interface.
50  * 
51  * #GtkFileChooser allows for shortcuts to various places in the filesystem.
52  * In the default implementation these are displayed in the left pane. It
53  * may be a bit confusing at first that these shortcuts come from various
54  * sources and in various flavours, so lets explain the terminology here:
55  * 
56  * - Bookmarks: are created by the user, by dragging folders from the
57  * right pane to the left pane, or by using the “Add”. Bookmarks
58  * can be renamed and deleted by the user.
59  * 
60  * - Shortcuts: can be provided by the application. For example, a Paint
61  * program may want to add a shortcut for a Clipart folder. Shortcuts
62  * cannot be modified by the user.
63  * 
64  * - Volumes: are provided by the underlying filesystem abstraction. They are
65  * the “roots” of the filesystem.
66  * 
67  * # File Names and Encodings
68  * 
69  * When the user is finished selecting files in a
70  * #GtkFileChooser, your program can get the selected names
71  * either as filenames or as URIs.  For URIs, the normal escaping
72  * rules are applied if the URI contains non-ASCII characters.
73  * However, filenames are always returned in
74  * the character set specified by the
75  * `G_FILENAME_ENCODING` environment variable.
76  * Please see the GLib documentation for more details about this
77  * variable.
78  * 
79  * This means that while you can pass the result of
80  * gtk_file_chooser_get_filename() to open() or fopen(),
81  * you may not be able to directly set it as the text of a
82  * #GtkLabel widget unless you convert it first to UTF-8,
83  * which all GTK+ widgets expect. You should use g_filename_to_utf8()
84  * to convert filenames into strings that can be passed to GTK+
85  * widgets.
86  * 
87  * # Adding a Preview Widget
88  * 
89  * You can add a custom preview widget to a file chooser and then
90  * get notification about when the preview needs to be updated.
91  * To install a preview widget, use
92  * gtk_file_chooser_set_preview_widget().  Then, connect to the
93  * #GtkFileChooser::update-preview signal to get notified when
94  * you need to update the contents of the preview.
95  * 
96  * Your callback should use
97  * gtk_file_chooser_get_preview_filename() to see what needs
98  * previewing.  Once you have generated the preview for the
99  * corresponding file, you must call
100  * gtk_file_chooser_set_preview_widget_active() with a boolean
101  * flag that indicates whether your callback could successfully
102  * generate a preview.
103  * 
104  * ## Example: Using a Preview Widget ## {#gtkfilechooser-preview}
105  * |[<!-- language="C" -->
106  * {
107  * GtkImage *preview;
108  * 
109  * ...
110  * 
111  * preview = gtk_image_new ();
112  * 
113  * gtk_file_chooser_set_preview_widget (my_file_chooser, preview);
114  * g_signal_connect (my_file_chooser, "update-preview",
115  * G_CALLBACK (update_preview_cb), preview);
116  * }
117  * 
118  * static void
119  * update_preview_cb (GtkFileChooser *file_chooser, gpointer data)
120  * {
121  * GtkWidget *preview;
122  * char *filename;
123  * GdkPixbuf *pixbuf;
124  * gboolean have_preview;
125  * 
126  * preview = GTK_WIDGET (data);
127  * filename = gtk_file_chooser_get_preview_filename (file_chooser);
128  * 
129  * pixbuf = gdk_pixbuf_new_from_file_at_size (filename, 128, 128, NULL);
130  * have_preview = (pixbuf != NULL);
131  * g_free (filename);
132  * 
133  * gtk_image_set_from_pixbuf (GTK_IMAGE (preview), pixbuf);
134  * if (pixbuf)
135  * g_object_unref (pixbuf);
136  * 
137  * gtk_file_chooser_set_preview_widget_active (file_chooser, have_preview);
138  * }
139  * ]|
140  * 
141  * # Adding Extra Widgets
142  * 
143  * You can add extra widgets to a file chooser to provide options
144  * that are not present in the default design.  For example, you
145  * can add a toggle button to give the user the option to open a
146  * file in read-only mode.  You can use
147  * gtk_file_chooser_set_extra_widget() to insert additional
148  * widgets in a file chooser.
149  * 
150  * An example for adding extra widgets:
151  * |[<!-- language="C" -->
152  * 
153  * GtkWidget *toggle;
154  * 
155  * ...
156  * 
157  * toggle = gtk_check_button_new_with_label ("Open file read-only");
158  * gtk_widget_show (toggle);
159  * gtk_file_chooser_set_extra_widget (my_file_chooser, toggle);
160  * }
161  * ]|
162  * 
163  * If you want to set more than one extra widget in the file
164  * chooser, you can a container such as a #GtkBox or a #GtkGrid
165  * and include your widgets in it.  Then, set the container as
166  * the whole extra widget.
167  */
168 public template FileChooserT(TStruct)
169 {
170 	/** Get the main Gtk struct */
171 	public GtkFileChooser* getFileChooserStruct()
172 	{
173 		return cast(GtkFileChooser*)getStruct();
174 	}
175 
176 
177 	/**
178 	 * Adds a 'choice' to the file chooser. This is typically implemented
179 	 * as a combobox or, for boolean choices, as a checkbutton. You can select
180 	 * a value using gtk_file_chooser_set_choice() before the dialog is shown,
181 	 * and you can obtain the user-selected value in the ::response signal handler
182 	 * using gtk_file_chooser_get_choice().
183 	 *
184 	 * Compare gtk_file_chooser_set_extra_widget().
185 	 *
186 	 * Params:
187 	 *     id = id for the added choice
188 	 *     label = user-visible label for the added choice
189 	 *     options = ids for the options of the choice, or %NULL for a boolean choice
190 	 *     optionLabels = user-visible labels for the options, must be the same length as @options
191 	 *
192 	 * Since: 3.22
193 	 */
194 	public void addChoice(string id, string label, string[] options, string[] optionLabels)
195 	{
196 		gtk_file_chooser_add_choice(getFileChooserStruct(), Str.toStringz(id), Str.toStringz(label), Str.toStringzArray(options), Str.toStringzArray(optionLabels));
197 	}
198 
199 	/**
200 	 * Adds @filter to the list of filters that the user can select between.
201 	 * When a filter is selected, only files that are passed by that
202 	 * filter are displayed.
203 	 *
204 	 * Note that the @chooser takes ownership of the filter, so you have to
205 	 * ref and sink it if you want to keep a reference.
206 	 *
207 	 * Params:
208 	 *     filter = a #GtkFileFilter
209 	 *
210 	 * Since: 2.4
211 	 */
212 	public void addFilter(FileFilter filter)
213 	{
214 		gtk_file_chooser_add_filter(getFileChooserStruct(), (filter is null) ? null : filter.getFileFilterStruct());
215 	}
216 
217 	/**
218 	 * Adds a folder to be displayed with the shortcut folders in a file chooser.
219 	 * Note that shortcut folders do not get saved, as they are provided by the
220 	 * application.  For example, you can use this to add a
221 	 * “/usr/share/mydrawprogram/Clipart” folder to the volume list.
222 	 *
223 	 * Params:
224 	 *     folder = filename of the folder to add
225 	 *
226 	 * Returns: %TRUE if the folder could be added successfully, %FALSE
227 	 *     otherwise.  In the latter case, the @error will be set as appropriate.
228 	 *
229 	 * Since: 2.4
230 	 *
231 	 * Throws: GException on failure.
232 	 */
233 	public bool addShortcutFolder(string folder)
234 	{
235 		GError* err = null;
236 		
237 		auto p = gtk_file_chooser_add_shortcut_folder(getFileChooserStruct(), Str.toStringz(folder), &err) != 0;
238 		
239 		if (err !is null)
240 		{
241 			throw new GException( new ErrorG(err) );
242 		}
243 		
244 		return p;
245 	}
246 
247 	/**
248 	 * Adds a folder URI to be displayed with the shortcut folders in a file
249 	 * chooser.  Note that shortcut folders do not get saved, as they are provided
250 	 * by the application.  For example, you can use this to add a
251 	 * “file:///usr/share/mydrawprogram/Clipart” folder to the volume list.
252 	 *
253 	 * Params:
254 	 *     uri = URI of the folder to add
255 	 *
256 	 * Returns: %TRUE if the folder could be added successfully, %FALSE
257 	 *     otherwise.  In the latter case, the @error will be set as appropriate.
258 	 *
259 	 * Since: 2.4
260 	 *
261 	 * Throws: GException on failure.
262 	 */
263 	public bool addShortcutFolderUri(string uri)
264 	{
265 		GError* err = null;
266 		
267 		auto p = gtk_file_chooser_add_shortcut_folder_uri(getFileChooserStruct(), Str.toStringz(uri), &err) != 0;
268 		
269 		if (err !is null)
270 		{
271 			throw new GException( new ErrorG(err) );
272 		}
273 		
274 		return p;
275 	}
276 
277 	/**
278 	 * Gets the type of operation that the file chooser is performing; see
279 	 * gtk_file_chooser_set_action().
280 	 *
281 	 * Returns: the action that the file selector is performing
282 	 *
283 	 * Since: 2.4
284 	 */
285 	public GtkFileChooserAction getFileChooserAction()
286 	{
287 		return gtk_file_chooser_get_action(getFileChooserStruct());
288 	}
289 
290 	/**
291 	 * Gets the currently selected option in the 'choice' with the given ID.
292 	 *
293 	 * Params:
294 	 *     id = the ID of the choice to get
295 	 *
296 	 * Returns: the ID of the currenly selected option
297 	 *
298 	 * Since: 3.22
299 	 */
300 	public string getChoice(string id)
301 	{
302 		return Str.toString(gtk_file_chooser_get_choice(getFileChooserStruct(), Str.toStringz(id)));
303 	}
304 
305 	/**
306 	 * Gets whether file choser will offer to create new folders.
307 	 * See gtk_file_chooser_set_create_folders().
308 	 *
309 	 * Returns: %TRUE if the Create Folder button should be displayed.
310 	 *
311 	 * Since: 2.18
312 	 */
313 	public bool getCreateFolders()
314 	{
315 		return gtk_file_chooser_get_create_folders(getFileChooserStruct()) != 0;
316 	}
317 
318 	/**
319 	 * Gets the current folder of @chooser as a local filename.
320 	 * See gtk_file_chooser_set_current_folder().
321 	 *
322 	 * Note that this is the folder that the file chooser is currently displaying
323 	 * (e.g. "/home/username/Documents"), which is not the same
324 	 * as the currently-selected folder if the chooser is in
325 	 * %GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER mode
326 	 * (e.g. "/home/username/Documents/selected-folder/".  To get the
327 	 * currently-selected folder in that mode, use gtk_file_chooser_get_uri() as the
328 	 * usual way to get the selection.
329 	 *
330 	 * Returns: the full path of the current
331 	 *     folder, or %NULL if the current path cannot be represented as a local
332 	 *     filename.  Free with g_free().  This function will also return
333 	 *     %NULL if the file chooser was unable to load the last folder that
334 	 *     was requested from it; for example, as would be for calling
335 	 *     gtk_file_chooser_set_current_folder() on a nonexistent folder.
336 	 *
337 	 * Since: 2.4
338 	 */
339 	public string getCurrentFolder()
340 	{
341 		auto retStr = gtk_file_chooser_get_current_folder(getFileChooserStruct());
342 		
343 		scope(exit) Str.freeString(retStr);
344 		return Str.toString(retStr);
345 	}
346 
347 	/**
348 	 * Gets the current folder of @chooser as #GFile.
349 	 * See gtk_file_chooser_get_current_folder_uri().
350 	 *
351 	 * Returns: the #GFile for the current folder.
352 	 *
353 	 * Since: 2.14
354 	 */
355 	public FileIF getCurrentFolderFile()
356 	{
357 		auto p = gtk_file_chooser_get_current_folder_file(getFileChooserStruct());
358 		
359 		if(p is null)
360 		{
361 			return null;
362 		}
363 		
364 		return ObjectG.getDObject!(File, FileIF)(cast(GFile*) p, true);
365 	}
366 
367 	/**
368 	 * Gets the current folder of @chooser as an URI.
369 	 * See gtk_file_chooser_set_current_folder_uri().
370 	 *
371 	 * Note that this is the folder that the file chooser is currently displaying
372 	 * (e.g. "file:///home/username/Documents"), which is not the same
373 	 * as the currently-selected folder if the chooser is in
374 	 * %GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER mode
375 	 * (e.g. "file:///home/username/Documents/selected-folder/".  To get the
376 	 * currently-selected folder in that mode, use gtk_file_chooser_get_uri() as the
377 	 * usual way to get the selection.
378 	 *
379 	 * Returns: the URI for the current folder.
380 	 *     Free with g_free().  This function will also return %NULL if the file chooser
381 	 *     was unable to load the last folder that was requested from it; for example,
382 	 *     as would be for calling gtk_file_chooser_set_current_folder_uri() on a
383 	 *     nonexistent folder.
384 	 *
385 	 * Since: 2.4
386 	 */
387 	public string getCurrentFolderUri()
388 	{
389 		auto retStr = gtk_file_chooser_get_current_folder_uri(getFileChooserStruct());
390 		
391 		scope(exit) Str.freeString(retStr);
392 		return Str.toString(retStr);
393 	}
394 
395 	/**
396 	 * Gets the current name in the file selector, as entered by the user in the
397 	 * text entry for “Name”.
398 	 *
399 	 * This is meant to be used in save dialogs, to get the currently typed filename
400 	 * when the file itself does not exist yet.  For example, an application that
401 	 * adds a custom extra widget to the file chooser for “file format” may want to
402 	 * change the extension of the typed filename based on the chosen format, say,
403 	 * from “.jpg” to “.png”.
404 	 *
405 	 * Returns: The raw text from the file chooser’s “Name” entry.  Free this with
406 	 *     g_free().  Note that this string is not a full pathname or URI; it is
407 	 *     whatever the contents of the entry are.  Note also that this string is in
408 	 *     UTF-8 encoding, which is not necessarily the system’s encoding for filenames.
409 	 *
410 	 * Since: 3.10
411 	 */
412 	public string getCurrentName()
413 	{
414 		auto retStr = gtk_file_chooser_get_current_name(getFileChooserStruct());
415 		
416 		scope(exit) Str.freeString(retStr);
417 		return Str.toString(retStr);
418 	}
419 
420 	/**
421 	 * Queries whether a file chooser is set to confirm for overwriting when the user
422 	 * types a file name that already exists.
423 	 *
424 	 * Returns: %TRUE if the file chooser will present a confirmation dialog;
425 	 *     %FALSE otherwise.
426 	 *
427 	 * Since: 2.8
428 	 */
429 	public bool getDoOverwriteConfirmation()
430 	{
431 		return gtk_file_chooser_get_do_overwrite_confirmation(getFileChooserStruct()) != 0;
432 	}
433 
434 	/**
435 	 * Gets the current preview widget; see
436 	 * gtk_file_chooser_set_extra_widget().
437 	 *
438 	 * Returns: the current extra widget, or %NULL
439 	 *
440 	 * Since: 2.4
441 	 */
442 	public Widget getExtraWidget()
443 	{
444 		auto p = gtk_file_chooser_get_extra_widget(getFileChooserStruct());
445 		
446 		if(p is null)
447 		{
448 			return null;
449 		}
450 		
451 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
452 	}
453 
454 	/**
455 	 * Gets the #GFile for the currently selected file in
456 	 * the file selector. If multiple files are selected,
457 	 * one of the files will be returned at random.
458 	 *
459 	 * If the file chooser is in folder mode, this function returns the selected
460 	 * folder.
461 	 *
462 	 * Returns: a selected #GFile. You own the returned file;
463 	 *     use g_object_unref() to release it.
464 	 *
465 	 * Since: 2.14
466 	 */
467 	public FileIF getFile()
468 	{
469 		auto p = gtk_file_chooser_get_file(getFileChooserStruct());
470 		
471 		if(p is null)
472 		{
473 			return null;
474 		}
475 		
476 		return ObjectG.getDObject!(File, FileIF)(cast(GFile*) p, true);
477 	}
478 
479 	/**
480 	 * Gets the filename for the currently selected file in
481 	 * the file selector. The filename is returned as an absolute path. If
482 	 * multiple files are selected, one of the filenames will be returned at
483 	 * random.
484 	 *
485 	 * If the file chooser is in folder mode, this function returns the selected
486 	 * folder.
487 	 *
488 	 * Returns: The currently selected filename,
489 	 *     or %NULL if no file is selected, or the selected file can't
490 	 *     be represented with a local filename. Free with g_free().
491 	 *
492 	 * Since: 2.4
493 	 */
494 	public string getFilename()
495 	{
496 		auto retStr = gtk_file_chooser_get_filename(getFileChooserStruct());
497 		
498 		scope(exit) Str.freeString(retStr);
499 		return Str.toString(retStr);
500 	}
501 
502 	/**
503 	 * Lists all the selected files and subfolders in the current folder of
504 	 * @chooser. The returned names are full absolute paths. If files in the current
505 	 * folder cannot be represented as local filenames they will be ignored. (See
506 	 * gtk_file_chooser_get_uris())
507 	 *
508 	 * Returns: a #GSList
509 	 *     containing the filenames of all selected files and subfolders in
510 	 *     the current folder. Free the returned list with g_slist_free(),
511 	 *     and the filenames with g_free().
512 	 *
513 	 * Since: 2.4
514 	 */
515 	public ListSG getFilenames()
516 	{
517 		auto p = gtk_file_chooser_get_filenames(getFileChooserStruct());
518 		
519 		if(p is null)
520 		{
521 			return null;
522 		}
523 		
524 		return new ListSG(cast(GSList*) p, true);
525 	}
526 
527 	/**
528 	 * Lists all the selected files and subfolders in the current folder of @chooser
529 	 * as #GFile. An internal function, see gtk_file_chooser_get_uris().
530 	 *
531 	 * Returns: a #GSList
532 	 *     containing a #GFile for each selected file and subfolder in the
533 	 *     current folder.  Free the returned list with g_slist_free(), and
534 	 *     the files with g_object_unref().
535 	 *
536 	 * Since: 2.14
537 	 */
538 	public ListSG getFiles()
539 	{
540 		auto p = gtk_file_chooser_get_files(getFileChooserStruct());
541 		
542 		if(p is null)
543 		{
544 			return null;
545 		}
546 		
547 		return new ListSG(cast(GSList*) p, true);
548 	}
549 
550 	/**
551 	 * Gets the current filter; see gtk_file_chooser_set_filter().
552 	 *
553 	 * Returns: the current filter, or %NULL
554 	 *
555 	 * Since: 2.4
556 	 */
557 	public FileFilter getFilter()
558 	{
559 		auto p = gtk_file_chooser_get_filter(getFileChooserStruct());
560 		
561 		if(p is null)
562 		{
563 			return null;
564 		}
565 		
566 		return ObjectG.getDObject!(FileFilter)(cast(GtkFileFilter*) p);
567 	}
568 
569 	/**
570 	 * Gets whether only local files can be selected in the
571 	 * file selector. See gtk_file_chooser_set_local_only()
572 	 *
573 	 * Returns: %TRUE if only local files can be selected.
574 	 *
575 	 * Since: 2.4
576 	 */
577 	public bool getLocalOnly()
578 	{
579 		return gtk_file_chooser_get_local_only(getFileChooserStruct()) != 0;
580 	}
581 
582 	/**
583 	 * Gets the #GFile that should be previewed in a custom preview
584 	 * Internal function, see gtk_file_chooser_get_preview_uri().
585 	 *
586 	 * Returns: the #GFile for the file to preview,
587 	 *     or %NULL if no file is selected. Free with g_object_unref().
588 	 *
589 	 * Since: 2.14
590 	 */
591 	public FileIF getPreviewFile()
592 	{
593 		auto p = gtk_file_chooser_get_preview_file(getFileChooserStruct());
594 		
595 		if(p is null)
596 		{
597 			return null;
598 		}
599 		
600 		return ObjectG.getDObject!(File, FileIF)(cast(GFile*) p, true);
601 	}
602 
603 	/**
604 	 * Gets the filename that should be previewed in a custom preview
605 	 * widget. See gtk_file_chooser_set_preview_widget().
606 	 *
607 	 * Returns: the filename to preview, or %NULL if
608 	 *     no file is selected, or if the selected file cannot be represented
609 	 *     as a local filename. Free with g_free()
610 	 *
611 	 * Since: 2.4
612 	 */
613 	public string getPreviewFilename()
614 	{
615 		auto retStr = gtk_file_chooser_get_preview_filename(getFileChooserStruct());
616 		
617 		scope(exit) Str.freeString(retStr);
618 		return Str.toString(retStr);
619 	}
620 
621 	/**
622 	 * Gets the URI that should be previewed in a custom preview
623 	 * widget. See gtk_file_chooser_set_preview_widget().
624 	 *
625 	 * Returns: the URI for the file to preview,
626 	 *     or %NULL if no file is selected. Free with g_free().
627 	 *
628 	 * Since: 2.4
629 	 */
630 	public string getPreviewUri()
631 	{
632 		auto retStr = gtk_file_chooser_get_preview_uri(getFileChooserStruct());
633 		
634 		scope(exit) Str.freeString(retStr);
635 		return Str.toString(retStr);
636 	}
637 
638 	/**
639 	 * Gets the current preview widget; see
640 	 * gtk_file_chooser_set_preview_widget().
641 	 *
642 	 * Returns: the current preview widget, or %NULL
643 	 *
644 	 * Since: 2.4
645 	 */
646 	public Widget getPreviewWidget()
647 	{
648 		auto p = gtk_file_chooser_get_preview_widget(getFileChooserStruct());
649 		
650 		if(p is null)
651 		{
652 			return null;
653 		}
654 		
655 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
656 	}
657 
658 	/**
659 	 * Gets whether the preview widget set by gtk_file_chooser_set_preview_widget()
660 	 * should be shown for the current filename. See
661 	 * gtk_file_chooser_set_preview_widget_active().
662 	 *
663 	 * Returns: %TRUE if the preview widget is active for the current filename.
664 	 *
665 	 * Since: 2.4
666 	 */
667 	public bool getPreviewWidgetActive()
668 	{
669 		return gtk_file_chooser_get_preview_widget_active(getFileChooserStruct()) != 0;
670 	}
671 
672 	/**
673 	 * Gets whether multiple files can be selected in the file
674 	 * selector. See gtk_file_chooser_set_select_multiple().
675 	 *
676 	 * Returns: %TRUE if multiple files can be selected.
677 	 *
678 	 * Since: 2.4
679 	 */
680 	public bool getSelectMultiple()
681 	{
682 		return gtk_file_chooser_get_select_multiple(getFileChooserStruct()) != 0;
683 	}
684 
685 	/**
686 	 * Gets whether hidden files and folders are displayed in the file selector.
687 	 * See gtk_file_chooser_set_show_hidden().
688 	 *
689 	 * Returns: %TRUE if hidden files and folders are displayed.
690 	 *
691 	 * Since: 2.6
692 	 */
693 	public bool getShowHidden()
694 	{
695 		return gtk_file_chooser_get_show_hidden(getFileChooserStruct()) != 0;
696 	}
697 
698 	/**
699 	 * Gets the URI for the currently selected file in
700 	 * the file selector. If multiple files are selected,
701 	 * one of the filenames will be returned at random.
702 	 *
703 	 * If the file chooser is in folder mode, this function returns the selected
704 	 * folder.
705 	 *
706 	 * Returns: The currently selected URI, or %NULL
707 	 *     if no file is selected. If gtk_file_chooser_set_local_only() is set to
708 	 *     %TRUE (the default) a local URI will be returned for any FUSE locations.
709 	 *     Free with g_free()
710 	 *
711 	 * Since: 2.4
712 	 */
713 	public string getUri()
714 	{
715 		auto retStr = gtk_file_chooser_get_uri(getFileChooserStruct());
716 		
717 		scope(exit) Str.freeString(retStr);
718 		return Str.toString(retStr);
719 	}
720 
721 	/**
722 	 * Lists all the selected files and subfolders in the current folder of
723 	 * @chooser. The returned names are full absolute URIs.
724 	 *
725 	 * Returns: a #GSList containing the URIs of all selected
726 	 *     files and subfolders in the current folder. Free the returned list
727 	 *     with g_slist_free(), and the filenames with g_free().
728 	 *
729 	 * Since: 2.4
730 	 */
731 	public ListSG getUris()
732 	{
733 		auto p = gtk_file_chooser_get_uris(getFileChooserStruct());
734 		
735 		if(p is null)
736 		{
737 			return null;
738 		}
739 		
740 		return new ListSG(cast(GSList*) p, true);
741 	}
742 
743 	/**
744 	 * Gets whether a stock label should be drawn with the name of the previewed
745 	 * file.  See gtk_file_chooser_set_use_preview_label().
746 	 *
747 	 * Returns: %TRUE if the file chooser is set to display a label with the
748 	 *     name of the previewed file, %FALSE otherwise.
749 	 */
750 	public bool getUsePreviewLabel()
751 	{
752 		return gtk_file_chooser_get_use_preview_label(getFileChooserStruct()) != 0;
753 	}
754 
755 	/**
756 	 * Lists the current set of user-selectable filters; see
757 	 * gtk_file_chooser_add_filter(), gtk_file_chooser_remove_filter().
758 	 *
759 	 * Returns: a
760 	 *     #GSList containing the current set of user selectable filters. The
761 	 *     contents of the list are owned by GTK+, but you must free the list
762 	 *     itself with g_slist_free() when you are done with it.
763 	 *
764 	 * Since: 2.4
765 	 */
766 	public ListSG listFilters()
767 	{
768 		auto p = gtk_file_chooser_list_filters(getFileChooserStruct());
769 		
770 		if(p is null)
771 		{
772 			return null;
773 		}
774 		
775 		return new ListSG(cast(GSList*) p);
776 	}
777 
778 	/**
779 	 * Queries the list of shortcut folders in the file chooser, as set by
780 	 * gtk_file_chooser_add_shortcut_folder_uri().
781 	 *
782 	 * Returns: A list of
783 	 *     folder URIs, or %NULL if there are no shortcut folders.  Free the
784 	 *     returned list with g_slist_free(), and the URIs with g_free().
785 	 *
786 	 * Since: 2.4
787 	 */
788 	public ListSG listShortcutFolderUris()
789 	{
790 		auto p = gtk_file_chooser_list_shortcut_folder_uris(getFileChooserStruct());
791 		
792 		if(p is null)
793 		{
794 			return null;
795 		}
796 		
797 		return new ListSG(cast(GSList*) p, true);
798 	}
799 
800 	/**
801 	 * Queries the list of shortcut folders in the file chooser, as set by
802 	 * gtk_file_chooser_add_shortcut_folder().
803 	 *
804 	 * Returns: A list
805 	 *     of folder filenames, or %NULL if there are no shortcut folders.
806 	 *     Free the returned list with g_slist_free(), and the filenames with
807 	 *     g_free().
808 	 *
809 	 * Since: 2.4
810 	 */
811 	public ListSG listShortcutFolders()
812 	{
813 		auto p = gtk_file_chooser_list_shortcut_folders(getFileChooserStruct());
814 		
815 		if(p is null)
816 		{
817 			return null;
818 		}
819 		
820 		return new ListSG(cast(GSList*) p, true);
821 	}
822 
823 	/**
824 	 * Removes a 'choice' that has been added with gtk_file_chooser_add_choice().
825 	 *
826 	 * Params:
827 	 *     id = the ID of the choice to remove
828 	 *
829 	 * Since: 3.22
830 	 */
831 	public void removeChoice(string id)
832 	{
833 		gtk_file_chooser_remove_choice(getFileChooserStruct(), Str.toStringz(id));
834 	}
835 
836 	/**
837 	 * Removes @filter from the list of filters that the user can select between.
838 	 *
839 	 * Params:
840 	 *     filter = a #GtkFileFilter
841 	 *
842 	 * Since: 2.4
843 	 */
844 	public void removeFilter(FileFilter filter)
845 	{
846 		gtk_file_chooser_remove_filter(getFileChooserStruct(), (filter is null) ? null : filter.getFileFilterStruct());
847 	}
848 
849 	/**
850 	 * Removes a folder from a file chooser’s list of shortcut folders.
851 	 *
852 	 * Params:
853 	 *     folder = filename of the folder to remove
854 	 *
855 	 * Returns: %TRUE if the operation succeeds, %FALSE otherwise.
856 	 *     In the latter case, the @error will be set as appropriate.
857 	 *
858 	 *     See also: gtk_file_chooser_add_shortcut_folder()
859 	 *
860 	 * Since: 2.4
861 	 *
862 	 * Throws: GException on failure.
863 	 */
864 	public bool removeShortcutFolder(string folder)
865 	{
866 		GError* err = null;
867 		
868 		auto p = gtk_file_chooser_remove_shortcut_folder(getFileChooserStruct(), Str.toStringz(folder), &err) != 0;
869 		
870 		if (err !is null)
871 		{
872 			throw new GException( new ErrorG(err) );
873 		}
874 		
875 		return p;
876 	}
877 
878 	/**
879 	 * Removes a folder URI from a file chooser’s list of shortcut folders.
880 	 *
881 	 * Params:
882 	 *     uri = URI of the folder to remove
883 	 *
884 	 * Returns: %TRUE if the operation succeeds, %FALSE otherwise.
885 	 *     In the latter case, the @error will be set as appropriate.
886 	 *
887 	 *     See also: gtk_file_chooser_add_shortcut_folder_uri()
888 	 *
889 	 * Since: 2.4
890 	 *
891 	 * Throws: GException on failure.
892 	 */
893 	public bool removeShortcutFolderUri(string uri)
894 	{
895 		GError* err = null;
896 		
897 		auto p = gtk_file_chooser_remove_shortcut_folder_uri(getFileChooserStruct(), Str.toStringz(uri), &err) != 0;
898 		
899 		if (err !is null)
900 		{
901 			throw new GException( new ErrorG(err) );
902 		}
903 		
904 		return p;
905 	}
906 
907 	/**
908 	 * Selects all the files in the current folder of a file chooser.
909 	 *
910 	 * Since: 2.4
911 	 */
912 	public void selectAll()
913 	{
914 		gtk_file_chooser_select_all(getFileChooserStruct());
915 	}
916 
917 	/**
918 	 * Selects the file referred to by @file. An internal function. See
919 	 * _gtk_file_chooser_select_uri().
920 	 *
921 	 * Params:
922 	 *     file = the file to select
923 	 *
924 	 * Returns: Not useful.
925 	 *
926 	 * Since: 2.14
927 	 *
928 	 * Throws: GException on failure.
929 	 */
930 	public bool selectFile(FileIF file)
931 	{
932 		GError* err = null;
933 		
934 		auto p = gtk_file_chooser_select_file(getFileChooserStruct(), (file is null) ? null : file.getFileStruct(), &err) != 0;
935 		
936 		if (err !is null)
937 		{
938 			throw new GException( new ErrorG(err) );
939 		}
940 		
941 		return p;
942 	}
943 
944 	/**
945 	 * Selects a filename. If the file name isn’t in the current
946 	 * folder of @chooser, then the current folder of @chooser will
947 	 * be changed to the folder containing @filename.
948 	 *
949 	 * Params:
950 	 *     filename = the filename to select
951 	 *
952 	 * Returns: Not useful.
953 	 *
954 	 *     See also: gtk_file_chooser_set_filename()
955 	 *
956 	 * Since: 2.4
957 	 */
958 	public bool selectFilename(string filename)
959 	{
960 		return gtk_file_chooser_select_filename(getFileChooserStruct(), Str.toStringz(filename)) != 0;
961 	}
962 
963 	/**
964 	 * Selects the file to by @uri. If the URI doesn’t refer to a
965 	 * file in the current folder of @chooser, then the current folder of
966 	 * @chooser will be changed to the folder containing @filename.
967 	 *
968 	 * Params:
969 	 *     uri = the URI to select
970 	 *
971 	 * Returns: Not useful.
972 	 *
973 	 * Since: 2.4
974 	 */
975 	public bool selectUri(string uri)
976 	{
977 		return gtk_file_chooser_select_uri(getFileChooserStruct(), Str.toStringz(uri)) != 0;
978 	}
979 
980 	/**
981 	 * Sets the type of operation that the chooser is performing; the
982 	 * user interface is adapted to suit the selected action. For example,
983 	 * an option to create a new folder might be shown if the action is
984 	 * %GTK_FILE_CHOOSER_ACTION_SAVE but not if the action is
985 	 * %GTK_FILE_CHOOSER_ACTION_OPEN.
986 	 *
987 	 * Params:
988 	 *     action = the action that the file selector is performing
989 	 *
990 	 * Since: 2.4
991 	 */
992 	public void setFileChooserAction(GtkFileChooserAction action)
993 	{
994 		gtk_file_chooser_set_action(getFileChooserStruct(), action);
995 	}
996 
997 	/**
998 	 * Selects an option in a 'choice' that has been added with
999 	 * gtk_file_chooser_add_choice(). For a boolean choice, the
1000 	 * possible options are "true" and "false".
1001 	 *
1002 	 * Params:
1003 	 *     id = the ID of the choice to set
1004 	 *     option = the ID of the option to select
1005 	 *
1006 	 * Since: 3.22
1007 	 */
1008 	public void setChoice(string id, string option)
1009 	{
1010 		gtk_file_chooser_set_choice(getFileChooserStruct(), Str.toStringz(id), Str.toStringz(option));
1011 	}
1012 
1013 	/**
1014 	 * Sets whether file choser will offer to create new folders.
1015 	 * This is only relevant if the action is not set to be
1016 	 * %GTK_FILE_CHOOSER_ACTION_OPEN.
1017 	 *
1018 	 * Params:
1019 	 *     createFolders = %TRUE if the Create Folder button should be displayed
1020 	 *
1021 	 * Since: 2.18
1022 	 */
1023 	public void setCreateFolders(bool createFolders)
1024 	{
1025 		gtk_file_chooser_set_create_folders(getFileChooserStruct(), createFolders);
1026 	}
1027 
1028 	/**
1029 	 * Sets the current folder for @chooser from a local filename.
1030 	 * The user will be shown the full contents of the current folder,
1031 	 * plus user interface elements for navigating to other folders.
1032 	 *
1033 	 * In general, you should not use this function.  See the
1034 	 * [section on setting up a file chooser dialog][gtkfilechooserdialog-setting-up]
1035 	 * for the rationale behind this.
1036 	 *
1037 	 * Params:
1038 	 *     filename = the full path of the new current folder
1039 	 *
1040 	 * Returns: Not useful.
1041 	 *
1042 	 * Since: 2.4
1043 	 */
1044 	public bool setCurrentFolder(string filename)
1045 	{
1046 		return gtk_file_chooser_set_current_folder(getFileChooserStruct(), Str.toStringz(filename)) != 0;
1047 	}
1048 
1049 	/**
1050 	 * Sets the current folder for @chooser from a #GFile.
1051 	 * Internal function, see gtk_file_chooser_set_current_folder_uri().
1052 	 *
1053 	 * Params:
1054 	 *     file = the #GFile for the new folder
1055 	 *
1056 	 * Returns: %TRUE if the folder could be changed successfully, %FALSE
1057 	 *     otherwise.
1058 	 *
1059 	 * Since: 2.14
1060 	 *
1061 	 * Throws: GException on failure.
1062 	 */
1063 	public bool setCurrentFolderFile(FileIF file)
1064 	{
1065 		GError* err = null;
1066 		
1067 		auto p = gtk_file_chooser_set_current_folder_file(getFileChooserStruct(), (file is null) ? null : file.getFileStruct(), &err) != 0;
1068 		
1069 		if (err !is null)
1070 		{
1071 			throw new GException( new ErrorG(err) );
1072 		}
1073 		
1074 		return p;
1075 	}
1076 
1077 	/**
1078 	 * Sets the current folder for @chooser from an URI.
1079 	 * The user will be shown the full contents of the current folder,
1080 	 * plus user interface elements for navigating to other folders.
1081 	 *
1082 	 * In general, you should not use this function.  See the
1083 	 * [section on setting up a file chooser dialog][gtkfilechooserdialog-setting-up]
1084 	 * for the rationale behind this.
1085 	 *
1086 	 * Params:
1087 	 *     uri = the URI for the new current folder
1088 	 *
1089 	 * Returns: %TRUE if the folder could be changed successfully, %FALSE
1090 	 *     otherwise.
1091 	 *
1092 	 * Since: 2.4
1093 	 */
1094 	public bool setCurrentFolderUri(string uri)
1095 	{
1096 		return gtk_file_chooser_set_current_folder_uri(getFileChooserStruct(), Str.toStringz(uri)) != 0;
1097 	}
1098 
1099 	/**
1100 	 * Sets the current name in the file selector, as if entered
1101 	 * by the user. Note that the name passed in here is a UTF-8
1102 	 * string rather than a filename. This function is meant for
1103 	 * such uses as a suggested name in a “Save As...” dialog.  You can
1104 	 * pass “Untitled.doc” or a similarly suitable suggestion for the @name.
1105 	 *
1106 	 * If you want to preselect a particular existing file, you should use
1107 	 * gtk_file_chooser_set_filename() or gtk_file_chooser_set_uri() instead.
1108 	 * Please see the documentation for those functions for an example of using
1109 	 * gtk_file_chooser_set_current_name() as well.
1110 	 *
1111 	 * Params:
1112 	 *     name = the filename to use, as a UTF-8 string
1113 	 *
1114 	 * Since: 2.4
1115 	 */
1116 	public void setCurrentName(string name)
1117 	{
1118 		gtk_file_chooser_set_current_name(getFileChooserStruct(), Str.toStringz(name));
1119 	}
1120 
1121 	/**
1122 	 * Sets whether a file chooser in %GTK_FILE_CHOOSER_ACTION_SAVE mode will present
1123 	 * a confirmation dialog if the user types a file name that already exists.  This
1124 	 * is %FALSE by default.
1125 	 *
1126 	 * If set to %TRUE, the @chooser will emit the
1127 	 * #GtkFileChooser::confirm-overwrite signal when appropriate.
1128 	 *
1129 	 * If all you need is the stock confirmation dialog, set this property to %TRUE.
1130 	 * You can override the way confirmation is done by actually handling the
1131 	 * #GtkFileChooser::confirm-overwrite signal; please refer to its documentation
1132 	 * for the details.
1133 	 *
1134 	 * Params:
1135 	 *     doOverwriteConfirmation = whether to confirm overwriting in save mode
1136 	 *
1137 	 * Since: 2.8
1138 	 */
1139 	public void setDoOverwriteConfirmation(bool doOverwriteConfirmation)
1140 	{
1141 		gtk_file_chooser_set_do_overwrite_confirmation(getFileChooserStruct(), doOverwriteConfirmation);
1142 	}
1143 
1144 	/**
1145 	 * Sets an application-supplied widget to provide extra options to the user.
1146 	 *
1147 	 * Params:
1148 	 *     extraWidget = widget for extra options
1149 	 *
1150 	 * Since: 2.4
1151 	 */
1152 	public void setExtraWidget(Widget extraWidget)
1153 	{
1154 		gtk_file_chooser_set_extra_widget(getFileChooserStruct(), (extraWidget is null) ? null : extraWidget.getWidgetStruct());
1155 	}
1156 
1157 	/**
1158 	 * Sets @file as the current filename for the file chooser, by changing
1159 	 * to the file’s parent folder and actually selecting the file in list.  If
1160 	 * the @chooser is in %GTK_FILE_CHOOSER_ACTION_SAVE mode, the file’s base name
1161 	 * will also appear in the dialog’s file name entry.
1162 	 *
1163 	 * If the file name isn’t in the current folder of @chooser, then the current
1164 	 * folder of @chooser will be changed to the folder containing @filename. This
1165 	 * is equivalent to a sequence of gtk_file_chooser_unselect_all() followed by
1166 	 * gtk_file_chooser_select_filename().
1167 	 *
1168 	 * Note that the file must exist, or nothing will be done except
1169 	 * for the directory change.
1170 	 *
1171 	 * If you are implementing a save dialog,
1172 	 * you should use this function if you already have a file name to which the
1173 	 * user may save; for example, when the user opens an existing file and then
1174 	 * does Save As...  If you don’t have
1175 	 * a file name already — for example, if the user just created a new
1176 	 * file and is saving it for the first time, do not call this function.
1177 	 * Instead, use something similar to this:
1178 	 * |[<!-- language="C" -->
1179 	 * if (document_is_new)
1180 	 * {
1181 	 * // the user just created a new document
1182 	 * gtk_file_chooser_set_current_folder_file (chooser, default_file_for_saving);
1183 	 * gtk_file_chooser_set_current_name (chooser, "Untitled document");
1184 	 * }
1185 	 * else
1186 	 * {
1187 	 * // the user edited an existing document
1188 	 * gtk_file_chooser_set_file (chooser, existing_file);
1189 	 * }
1190 	 * ]|
1191 	 *
1192 	 * Params:
1193 	 *     file = the #GFile to set as current
1194 	 *
1195 	 * Returns: Not useful.
1196 	 *
1197 	 * Since: 2.14
1198 	 *
1199 	 * Throws: GException on failure.
1200 	 */
1201 	public bool setFile(FileIF file)
1202 	{
1203 		GError* err = null;
1204 		
1205 		auto p = gtk_file_chooser_set_file(getFileChooserStruct(), (file is null) ? null : file.getFileStruct(), &err) != 0;
1206 		
1207 		if (err !is null)
1208 		{
1209 			throw new GException( new ErrorG(err) );
1210 		}
1211 		
1212 		return p;
1213 	}
1214 
1215 	/**
1216 	 * Sets @filename as the current filename for the file chooser, by changing to
1217 	 * the file’s parent folder and actually selecting the file in list; all other
1218 	 * files will be unselected.  If the @chooser is in
1219 	 * %GTK_FILE_CHOOSER_ACTION_SAVE mode, the file’s base name will also appear in
1220 	 * the dialog’s file name entry.
1221 	 *
1222 	 * Note that the file must exist, or nothing will be done except
1223 	 * for the directory change.
1224 	 *
1225 	 * You should use this function only when implementing a save
1226 	 * dialog for which you already have a file name to which
1227 	 * the user may save.  For example, when the user opens an existing file and
1228 	 * then does Save As... to save a copy or
1229 	 * a modified version.  If you don’t have a file name already — for
1230 	 * example, if the user just created a new file and is saving it for the first
1231 	 * time, do not call this function.  Instead, use something similar to this:
1232 	 * |[<!-- language="C" -->
1233 	 * if (document_is_new)
1234 	 * {
1235 	 * // the user just created a new document
1236 	 * gtk_file_chooser_set_current_name (chooser, "Untitled document");
1237 	 * }
1238 	 * else
1239 	 * {
1240 	 * // the user edited an existing document
1241 	 * gtk_file_chooser_set_filename (chooser, existing_filename);
1242 	 * }
1243 	 * ]|
1244 	 *
1245 	 * In the first case, the file chooser will present the user with useful suggestions
1246 	 * as to where to save his new file.  In the second case, the file’s existing location
1247 	 * is already known, so the file chooser will use it.
1248 	 *
1249 	 * Params:
1250 	 *     filename = the filename to set as current
1251 	 *
1252 	 * Returns: Not useful.
1253 	 *
1254 	 * Since: 2.4
1255 	 */
1256 	public bool setFilename(string filename)
1257 	{
1258 		return gtk_file_chooser_set_filename(getFileChooserStruct(), Str.toStringz(filename)) != 0;
1259 	}
1260 
1261 	/**
1262 	 * Sets the current filter; only the files that pass the
1263 	 * filter will be displayed. If the user-selectable list of filters
1264 	 * is non-empty, then the filter should be one of the filters
1265 	 * in that list. Setting the current filter when the list of
1266 	 * filters is empty is useful if you want to restrict the displayed
1267 	 * set of files without letting the user change it.
1268 	 *
1269 	 * Params:
1270 	 *     filter = a #GtkFileFilter
1271 	 *
1272 	 * Since: 2.4
1273 	 */
1274 	public void setFilter(FileFilter filter)
1275 	{
1276 		gtk_file_chooser_set_filter(getFileChooserStruct(), (filter is null) ? null : filter.getFileFilterStruct());
1277 	}
1278 
1279 	/**
1280 	 * Sets whether only local files can be selected in the
1281 	 * file selector. If @local_only is %TRUE (the default),
1282 	 * then the selected file or files are guaranteed to be
1283 	 * accessible through the operating systems native file
1284 	 * system and therefore the application only
1285 	 * needs to worry about the filename functions in
1286 	 * #GtkFileChooser, like gtk_file_chooser_get_filename(),
1287 	 * rather than the URI functions like
1288 	 * gtk_file_chooser_get_uri(),
1289 	 *
1290 	 * On some systems non-native files may still be
1291 	 * available using the native filesystem via a userspace
1292 	 * filesystem (FUSE).
1293 	 *
1294 	 * Params:
1295 	 *     localOnly = %TRUE if only local files can be selected
1296 	 *
1297 	 * Since: 2.4
1298 	 */
1299 	public void setLocalOnly(bool localOnly)
1300 	{
1301 		gtk_file_chooser_set_local_only(getFileChooserStruct(), localOnly);
1302 	}
1303 
1304 	/**
1305 	 * Sets an application-supplied widget to use to display a custom preview
1306 	 * of the currently selected file. To implement a preview, after setting the
1307 	 * preview widget, you connect to the #GtkFileChooser::update-preview
1308 	 * signal, and call gtk_file_chooser_get_preview_filename() or
1309 	 * gtk_file_chooser_get_preview_uri() on each change. If you can
1310 	 * display a preview of the new file, update your widget and
1311 	 * set the preview active using gtk_file_chooser_set_preview_widget_active().
1312 	 * Otherwise, set the preview inactive.
1313 	 *
1314 	 * When there is no application-supplied preview widget, or the
1315 	 * application-supplied preview widget is not active, the file chooser
1316 	 * will display no preview at all.
1317 	 *
1318 	 * Params:
1319 	 *     previewWidget = widget for displaying preview.
1320 	 *
1321 	 * Since: 2.4
1322 	 */
1323 	public void setPreviewWidget(Widget previewWidget)
1324 	{
1325 		gtk_file_chooser_set_preview_widget(getFileChooserStruct(), (previewWidget is null) ? null : previewWidget.getWidgetStruct());
1326 	}
1327 
1328 	/**
1329 	 * Sets whether the preview widget set by
1330 	 * gtk_file_chooser_set_preview_widget() should be shown for the
1331 	 * current filename. When @active is set to false, the file chooser
1332 	 * may display an internally generated preview of the current file
1333 	 * or it may display no preview at all. See
1334 	 * gtk_file_chooser_set_preview_widget() for more details.
1335 	 *
1336 	 * Params:
1337 	 *     active = whether to display the user-specified preview widget
1338 	 *
1339 	 * Since: 2.4
1340 	 */
1341 	public void setPreviewWidgetActive(bool active)
1342 	{
1343 		gtk_file_chooser_set_preview_widget_active(getFileChooserStruct(), active);
1344 	}
1345 
1346 	/**
1347 	 * Sets whether multiple files can be selected in the file selector.  This is
1348 	 * only relevant if the action is set to be %GTK_FILE_CHOOSER_ACTION_OPEN or
1349 	 * %GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER.
1350 	 *
1351 	 * Params:
1352 	 *     selectMultiple = %TRUE if multiple files can be selected.
1353 	 *
1354 	 * Since: 2.4
1355 	 */
1356 	public void setSelectMultiple(bool selectMultiple)
1357 	{
1358 		gtk_file_chooser_set_select_multiple(getFileChooserStruct(), selectMultiple);
1359 	}
1360 
1361 	/**
1362 	 * Sets whether hidden files and folders are displayed in the file selector.
1363 	 *
1364 	 * Params:
1365 	 *     showHidden = %TRUE if hidden files and folders should be displayed.
1366 	 *
1367 	 * Since: 2.6
1368 	 */
1369 	public void setShowHidden(bool showHidden)
1370 	{
1371 		gtk_file_chooser_set_show_hidden(getFileChooserStruct(), showHidden);
1372 	}
1373 
1374 	/**
1375 	 * Sets the file referred to by @uri as the current file for the file chooser,
1376 	 * by changing to the URI’s parent folder and actually selecting the URI in the
1377 	 * list.  If the @chooser is %GTK_FILE_CHOOSER_ACTION_SAVE mode, the URI’s base
1378 	 * name will also appear in the dialog’s file name entry.
1379 	 *
1380 	 * Note that the URI must exist, or nothing will be done except for the
1381 	 * directory change.
1382 	 *
1383 	 * You should use this function only when implementing a save
1384 	 * dialog for which you already have a file name to which
1385 	 * the user may save.  For example, when the user opens an existing file and then
1386 	 * does Save As... to save a copy or a
1387 	 * modified version.  If you don’t have a file name already — for example,
1388 	 * if the user just created a new file and is saving it for the first time, do
1389 	 * not call this function.  Instead, use something similar to this:
1390 	 * |[<!-- language="C" -->
1391 	 * if (document_is_new)
1392 	 * {
1393 	 * // the user just created a new document
1394 	 * gtk_file_chooser_set_current_name (chooser, "Untitled document");
1395 	 * }
1396 	 * else
1397 	 * {
1398 	 * // the user edited an existing document
1399 	 * gtk_file_chooser_set_uri (chooser, existing_uri);
1400 	 * }
1401 	 * ]|
1402 	 *
1403 	 *
1404 	 * In the first case, the file chooser will present the user with useful suggestions
1405 	 * as to where to save his new file.  In the second case, the file’s existing location
1406 	 * is already known, so the file chooser will use it.
1407 	 *
1408 	 * Params:
1409 	 *     uri = the URI to set as current
1410 	 *
1411 	 * Returns: Not useful.
1412 	 *
1413 	 * Since: 2.4
1414 	 */
1415 	public bool setUri(string uri)
1416 	{
1417 		return gtk_file_chooser_set_uri(getFileChooserStruct(), Str.toStringz(uri)) != 0;
1418 	}
1419 
1420 	/**
1421 	 * Sets whether the file chooser should display a stock label with the name of
1422 	 * the file that is being previewed; the default is %TRUE.  Applications that
1423 	 * want to draw the whole preview area themselves should set this to %FALSE and
1424 	 * display the name themselves in their preview widget.
1425 	 *
1426 	 * See also: gtk_file_chooser_set_preview_widget()
1427 	 *
1428 	 * Params:
1429 	 *     useLabel = whether to display a stock label with the name of the previewed file
1430 	 *
1431 	 * Since: 2.4
1432 	 */
1433 	public void setUsePreviewLabel(bool useLabel)
1434 	{
1435 		gtk_file_chooser_set_use_preview_label(getFileChooserStruct(), useLabel);
1436 	}
1437 
1438 	/**
1439 	 * Unselects all the files in the current folder of a file chooser.
1440 	 *
1441 	 * Since: 2.4
1442 	 */
1443 	public void unselectAll()
1444 	{
1445 		gtk_file_chooser_unselect_all(getFileChooserStruct());
1446 	}
1447 
1448 	/**
1449 	 * Unselects the file referred to by @file. If the file is not in the current
1450 	 * directory, does not exist, or is otherwise not currently selected, does nothing.
1451 	 *
1452 	 * Params:
1453 	 *     file = a #GFile
1454 	 *
1455 	 * Since: 2.14
1456 	 */
1457 	public void unselectFile(FileIF file)
1458 	{
1459 		gtk_file_chooser_unselect_file(getFileChooserStruct(), (file is null) ? null : file.getFileStruct());
1460 	}
1461 
1462 	/**
1463 	 * Unselects a currently selected filename. If the filename
1464 	 * is not in the current directory, does not exist, or
1465 	 * is otherwise not currently selected, does nothing.
1466 	 *
1467 	 * Params:
1468 	 *     filename = the filename to unselect
1469 	 *
1470 	 * Since: 2.4
1471 	 */
1472 	public void unselectFilename(string filename)
1473 	{
1474 		gtk_file_chooser_unselect_filename(getFileChooserStruct(), Str.toStringz(filename));
1475 	}
1476 
1477 	/**
1478 	 * Unselects the file referred to by @uri. If the file
1479 	 * is not in the current directory, does not exist, or
1480 	 * is otherwise not currently selected, does nothing.
1481 	 *
1482 	 * Params:
1483 	 *     uri = the URI to unselect
1484 	 *
1485 	 * Since: 2.4
1486 	 */
1487 	public void unselectUri(string uri)
1488 	{
1489 		gtk_file_chooser_unselect_uri(getFileChooserStruct(), Str.toStringz(uri));
1490 	}
1491 
1492 	protected class OnConfirmOverwriteDelegateWrapper
1493 	{
1494 		static OnConfirmOverwriteDelegateWrapper[] listeners;
1495 		GtkFileChooserConfirmation delegate(FileChooserIF) dlg;
1496 		gulong handlerId;
1497 		
1498 		this(GtkFileChooserConfirmation delegate(FileChooserIF) dlg)
1499 		{
1500 			this.dlg = dlg;
1501 			this.listeners ~= this;
1502 		}
1503 		
1504 		void remove(OnConfirmOverwriteDelegateWrapper source)
1505 		{
1506 			foreach(index, wrapper; listeners)
1507 			{
1508 				if (wrapper.handlerId == source.handlerId)
1509 				{
1510 					listeners[index] = null;
1511 					listeners = std.algorithm.remove(listeners, index);
1512 					break;
1513 				}
1514 			}
1515 		}
1516 	}
1517 
1518 	/**
1519 	 * This signal gets emitted whenever it is appropriate to present a
1520 	 * confirmation dialog when the user has selected a file name that
1521 	 * already exists.  The signal only gets emitted when the file
1522 	 * chooser is in %GTK_FILE_CHOOSER_ACTION_SAVE mode.
1523 	 *
1524 	 * Most applications just need to turn on the
1525 	 * #GtkFileChooser:do-overwrite-confirmation property (or call the
1526 	 * gtk_file_chooser_set_do_overwrite_confirmation() function), and
1527 	 * they will automatically get a stock confirmation dialog.
1528 	 * Applications which need to customize this behavior should do
1529 	 * that, and also connect to the #GtkFileChooser::confirm-overwrite
1530 	 * signal.
1531 	 *
1532 	 * A signal handler for this signal must return a
1533 	 * #GtkFileChooserConfirmation value, which indicates the action to
1534 	 * take.  If the handler determines that the user wants to select a
1535 	 * different filename, it should return
1536 	 * %GTK_FILE_CHOOSER_CONFIRMATION_SELECT_AGAIN.  If it determines
1537 	 * that the user is satisfied with his choice of file name, it
1538 	 * should return %GTK_FILE_CHOOSER_CONFIRMATION_ACCEPT_FILENAME.
1539 	 * On the other hand, if it determines that the stock confirmation
1540 	 * dialog should be used, it should return
1541 	 * %GTK_FILE_CHOOSER_CONFIRMATION_CONFIRM. The following example
1542 	 * illustrates this.
1543 	 *
1544 	 * ## Custom confirmation ## {#gtkfilechooser-confirmation}
1545 	 *
1546 	 * |[<!-- language="C" -->
1547 	 * static GtkFileChooserConfirmation
1548 	 * confirm_overwrite_callback (GtkFileChooser *chooser, gpointer data)
1549 	 * {
1550 	 * char *uri;
1551 	 *
1552 	 * uri = gtk_file_chooser_get_uri (chooser);
1553 	 *
1554 	 * if (is_uri_read_only (uri))
1555 	 * {
1556 	 * if (user_wants_to_replace_read_only_file (uri))
1557 	 * return GTK_FILE_CHOOSER_CONFIRMATION_ACCEPT_FILENAME;
1558 	 * else
1559 	 * return GTK_FILE_CHOOSER_CONFIRMATION_SELECT_AGAIN;
1560 	 * } else
1561 	 * return GTK_FILE_CHOOSER_CONFIRMATION_CONFIRM; // fall back to the default dialog
1562 	 * }
1563 	 *
1564 	 * ...
1565 	 *
1566 	 * chooser = gtk_file_chooser_dialog_new (...);
1567 	 *
1568 	 * gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE);
1569 	 * g_signal_connect (chooser, "confirm-overwrite",
1570 	 * G_CALLBACK (confirm_overwrite_callback), NULL);
1571 	 *
1572 	 * if (gtk_dialog_run (chooser) == GTK_RESPONSE_ACCEPT)
1573 	 * save_to_file (gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooser));
1574 	 *
1575 	 * gtk_widget_destroy (chooser);
1576 	 * ]|
1577 	 *
1578 	 * Returns: a #GtkFileChooserConfirmation value that indicates which
1579 	 *     action to take after emitting the signal.
1580 	 *
1581 	 * Since: 2.8
1582 	 */
1583 	gulong addOnConfirmOverwrite(GtkFileChooserConfirmation delegate(FileChooserIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1584 	{
1585 		auto wrapper = new OnConfirmOverwriteDelegateWrapper(dlg);
1586 		wrapper.handlerId = Signals.connectData(
1587 			this,
1588 			"confirm-overwrite",
1589 			cast(GCallback)&callBackConfirmOverwrite,
1590 			cast(void*)wrapper,
1591 			cast(GClosureNotify)&callBackConfirmOverwriteDestroy,
1592 			connectFlags);
1593 		return wrapper.handlerId;
1594 	}
1595 	
1596 	extern(C) static GtkFileChooserConfirmation callBackConfirmOverwrite(GtkFileChooser* filechooserStruct, OnConfirmOverwriteDelegateWrapper wrapper)
1597 	{
1598 		return wrapper.dlg(wrapper.outer);
1599 	}
1600 	
1601 	extern(C) static void callBackConfirmOverwriteDestroy(OnConfirmOverwriteDelegateWrapper wrapper, GClosure* closure)
1602 	{
1603 		wrapper.remove(wrapper);
1604 	}
1605 
1606 	protected class OnCurrentFolderChangedDelegateWrapper
1607 	{
1608 		static OnCurrentFolderChangedDelegateWrapper[] listeners;
1609 		void delegate(FileChooserIF) dlg;
1610 		gulong handlerId;
1611 		
1612 		this(void delegate(FileChooserIF) dlg)
1613 		{
1614 			this.dlg = dlg;
1615 			this.listeners ~= this;
1616 		}
1617 		
1618 		void remove(OnCurrentFolderChangedDelegateWrapper source)
1619 		{
1620 			foreach(index, wrapper; listeners)
1621 			{
1622 				if (wrapper.handlerId == source.handlerId)
1623 				{
1624 					listeners[index] = null;
1625 					listeners = std.algorithm.remove(listeners, index);
1626 					break;
1627 				}
1628 			}
1629 		}
1630 	}
1631 
1632 	/**
1633 	 * This signal is emitted when the current folder in a #GtkFileChooser
1634 	 * changes.  This can happen due to the user performing some action that
1635 	 * changes folders, such as selecting a bookmark or visiting a folder on the
1636 	 * file list.  It can also happen as a result of calling a function to
1637 	 * explicitly change the current folder in a file chooser.
1638 	 *
1639 	 * Normally you do not need to connect to this signal, unless you need to keep
1640 	 * track of which folder a file chooser is showing.
1641 	 *
1642 	 * See also:  gtk_file_chooser_set_current_folder(),
1643 	 * gtk_file_chooser_get_current_folder(),
1644 	 * gtk_file_chooser_set_current_folder_uri(),
1645 	 * gtk_file_chooser_get_current_folder_uri().
1646 	 */
1647 	gulong addOnCurrentFolderChanged(void delegate(FileChooserIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1648 	{
1649 		auto wrapper = new OnCurrentFolderChangedDelegateWrapper(dlg);
1650 		wrapper.handlerId = Signals.connectData(
1651 			this,
1652 			"current-folder-changed",
1653 			cast(GCallback)&callBackCurrentFolderChanged,
1654 			cast(void*)wrapper,
1655 			cast(GClosureNotify)&callBackCurrentFolderChangedDestroy,
1656 			connectFlags);
1657 		return wrapper.handlerId;
1658 	}
1659 	
1660 	extern(C) static void callBackCurrentFolderChanged(GtkFileChooser* filechooserStruct, OnCurrentFolderChangedDelegateWrapper wrapper)
1661 	{
1662 		wrapper.dlg(wrapper.outer);
1663 	}
1664 	
1665 	extern(C) static void callBackCurrentFolderChangedDestroy(OnCurrentFolderChangedDelegateWrapper wrapper, GClosure* closure)
1666 	{
1667 		wrapper.remove(wrapper);
1668 	}
1669 
1670 	protected class OnFileActivatedDelegateWrapper
1671 	{
1672 		static OnFileActivatedDelegateWrapper[] listeners;
1673 		void delegate(FileChooserIF) dlg;
1674 		gulong handlerId;
1675 		
1676 		this(void delegate(FileChooserIF) dlg)
1677 		{
1678 			this.dlg = dlg;
1679 			this.listeners ~= this;
1680 		}
1681 		
1682 		void remove(OnFileActivatedDelegateWrapper source)
1683 		{
1684 			foreach(index, wrapper; listeners)
1685 			{
1686 				if (wrapper.handlerId == source.handlerId)
1687 				{
1688 					listeners[index] = null;
1689 					listeners = std.algorithm.remove(listeners, index);
1690 					break;
1691 				}
1692 			}
1693 		}
1694 	}
1695 
1696 	/**
1697 	 * This signal is emitted when the user "activates" a file in the file
1698 	 * chooser.  This can happen by double-clicking on a file in the file list, or
1699 	 * by pressing `Enter`.
1700 	 *
1701 	 * Normally you do not need to connect to this signal.  It is used internally
1702 	 * by #GtkFileChooserDialog to know when to activate the default button in the
1703 	 * dialog.
1704 	 *
1705 	 * See also: gtk_file_chooser_get_filename(),
1706 	 * gtk_file_chooser_get_filenames(), gtk_file_chooser_get_uri(),
1707 	 * gtk_file_chooser_get_uris().
1708 	 */
1709 	gulong addOnFileActivated(void delegate(FileChooserIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1710 	{
1711 		auto wrapper = new OnFileActivatedDelegateWrapper(dlg);
1712 		wrapper.handlerId = Signals.connectData(
1713 			this,
1714 			"file-activated",
1715 			cast(GCallback)&callBackFileActivated,
1716 			cast(void*)wrapper,
1717 			cast(GClosureNotify)&callBackFileActivatedDestroy,
1718 			connectFlags);
1719 		return wrapper.handlerId;
1720 	}
1721 	
1722 	extern(C) static void callBackFileActivated(GtkFileChooser* filechooserStruct, OnFileActivatedDelegateWrapper wrapper)
1723 	{
1724 		wrapper.dlg(wrapper.outer);
1725 	}
1726 	
1727 	extern(C) static void callBackFileActivatedDestroy(OnFileActivatedDelegateWrapper wrapper, GClosure* closure)
1728 	{
1729 		wrapper.remove(wrapper);
1730 	}
1731 
1732 	protected class OnSelectionChangedDelegateWrapper
1733 	{
1734 		static OnSelectionChangedDelegateWrapper[] listeners;
1735 		void delegate(FileChooserIF) dlg;
1736 		gulong handlerId;
1737 		
1738 		this(void delegate(FileChooserIF) dlg)
1739 		{
1740 			this.dlg = dlg;
1741 			this.listeners ~= this;
1742 		}
1743 		
1744 		void remove(OnSelectionChangedDelegateWrapper source)
1745 		{
1746 			foreach(index, wrapper; listeners)
1747 			{
1748 				if (wrapper.handlerId == source.handlerId)
1749 				{
1750 					listeners[index] = null;
1751 					listeners = std.algorithm.remove(listeners, index);
1752 					break;
1753 				}
1754 			}
1755 		}
1756 	}
1757 
1758 	/**
1759 	 * This signal is emitted when there is a change in the set of selected files
1760 	 * in a #GtkFileChooser.  This can happen when the user modifies the selection
1761 	 * with the mouse or the keyboard, or when explicitly calling functions to
1762 	 * change the selection.
1763 	 *
1764 	 * Normally you do not need to connect to this signal, as it is easier to wait
1765 	 * for the file chooser to finish running, and then to get the list of
1766 	 * selected files using the functions mentioned below.
1767 	 *
1768 	 * See also: gtk_file_chooser_select_filename(),
1769 	 * gtk_file_chooser_unselect_filename(), gtk_file_chooser_get_filename(),
1770 	 * gtk_file_chooser_get_filenames(), gtk_file_chooser_select_uri(),
1771 	 * gtk_file_chooser_unselect_uri(), gtk_file_chooser_get_uri(),
1772 	 * gtk_file_chooser_get_uris().
1773 	 */
1774 	gulong addOnSelectionChanged(void delegate(FileChooserIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1775 	{
1776 		auto wrapper = new OnSelectionChangedDelegateWrapper(dlg);
1777 		wrapper.handlerId = Signals.connectData(
1778 			this,
1779 			"selection-changed",
1780 			cast(GCallback)&callBackSelectionChanged,
1781 			cast(void*)wrapper,
1782 			cast(GClosureNotify)&callBackSelectionChangedDestroy,
1783 			connectFlags);
1784 		return wrapper.handlerId;
1785 	}
1786 	
1787 	extern(C) static void callBackSelectionChanged(GtkFileChooser* filechooserStruct, OnSelectionChangedDelegateWrapper wrapper)
1788 	{
1789 		wrapper.dlg(wrapper.outer);
1790 	}
1791 	
1792 	extern(C) static void callBackSelectionChangedDestroy(OnSelectionChangedDelegateWrapper wrapper, GClosure* closure)
1793 	{
1794 		wrapper.remove(wrapper);
1795 	}
1796 
1797 	protected class OnUpdatePreviewDelegateWrapper
1798 	{
1799 		static OnUpdatePreviewDelegateWrapper[] listeners;
1800 		void delegate(FileChooserIF) dlg;
1801 		gulong handlerId;
1802 		
1803 		this(void delegate(FileChooserIF) dlg)
1804 		{
1805 			this.dlg = dlg;
1806 			this.listeners ~= this;
1807 		}
1808 		
1809 		void remove(OnUpdatePreviewDelegateWrapper source)
1810 		{
1811 			foreach(index, wrapper; listeners)
1812 			{
1813 				if (wrapper.handlerId == source.handlerId)
1814 				{
1815 					listeners[index] = null;
1816 					listeners = std.algorithm.remove(listeners, index);
1817 					break;
1818 				}
1819 			}
1820 		}
1821 	}
1822 
1823 	/**
1824 	 * This signal is emitted when the preview in a file chooser should be
1825 	 * regenerated.  For example, this can happen when the currently selected file
1826 	 * changes.  You should use this signal if you want your file chooser to have
1827 	 * a preview widget.
1828 	 *
1829 	 * Once you have installed a preview widget with
1830 	 * gtk_file_chooser_set_preview_widget(), you should update it when this
1831 	 * signal is emitted.  You can use the functions
1832 	 * gtk_file_chooser_get_preview_filename() or
1833 	 * gtk_file_chooser_get_preview_uri() to get the name of the file to preview.
1834 	 * Your widget may not be able to preview all kinds of files; your callback
1835 	 * must call gtk_file_chooser_set_preview_widget_active() to inform the file
1836 	 * chooser about whether the preview was generated successfully or not.
1837 	 *
1838 	 * Please see the example code in
1839 	 * [Using a Preview Widget][gtkfilechooser-preview].
1840 	 *
1841 	 * See also: gtk_file_chooser_set_preview_widget(),
1842 	 * gtk_file_chooser_set_preview_widget_active(),
1843 	 * gtk_file_chooser_set_use_preview_label(),
1844 	 * gtk_file_chooser_get_preview_filename(),
1845 	 * gtk_file_chooser_get_preview_uri().
1846 	 */
1847 	gulong addOnUpdatePreview(void delegate(FileChooserIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1848 	{
1849 		auto wrapper = new OnUpdatePreviewDelegateWrapper(dlg);
1850 		wrapper.handlerId = Signals.connectData(
1851 			this,
1852 			"update-preview",
1853 			cast(GCallback)&callBackUpdatePreview,
1854 			cast(void*)wrapper,
1855 			cast(GClosureNotify)&callBackUpdatePreviewDestroy,
1856 			connectFlags);
1857 		return wrapper.handlerId;
1858 	}
1859 	
1860 	extern(C) static void callBackUpdatePreview(GtkFileChooser* filechooserStruct, OnUpdatePreviewDelegateWrapper wrapper)
1861 	{
1862 		wrapper.dlg(wrapper.outer);
1863 	}
1864 	
1865 	extern(C) static void callBackUpdatePreviewDestroy(OnUpdatePreviewDelegateWrapper wrapper, GClosure* closure)
1866 	{
1867 		wrapper.remove(wrapper);
1868 	}
1869 }