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.FileChooserWidget;
26 
27 private import glib.ConstructionException;
28 private import glib.Str;
29 private import gobject.ObjectG;
30 private import gobject.Signals;
31 private import gtk.Box;
32 private import gtk.FileChooserIF;
33 private import gtk.FileChooserT;
34 private import gtk.Widget;
35 private import gtk.c.functions;
36 public  import gtk.c.types;
37 public  import gtkc.gtktypes;
38 private import std.algorithm;
39 
40 
41 /**
42  * #GtkFileChooserWidget is a widget for choosing files.
43  * It exposes the #GtkFileChooser interface, and you should
44  * use the methods of this interface to interact with the
45  * widget.
46  * 
47  * # CSS nodes
48  * 
49  * GtkFileChooserWidget has a single CSS node with name filechooser.
50  */
51 public class FileChooserWidget : Box, FileChooserIF
52 {
53 	/** the main Gtk struct */
54 	protected GtkFileChooserWidget* gtkFileChooserWidget;
55 
56 	/** Get the main Gtk struct */
57 	public GtkFileChooserWidget* getFileChooserWidgetStruct(bool transferOwnership = false)
58 	{
59 		if (transferOwnership)
60 			ownedRef = false;
61 		return gtkFileChooserWidget;
62 	}
63 
64 	/** the main Gtk struct as a void* */
65 	protected override void* getStruct()
66 	{
67 		return cast(void*)gtkFileChooserWidget;
68 	}
69 
70 	/**
71 	 * Sets our main struct and passes it to the parent class.
72 	 */
73 	public this (GtkFileChooserWidget* gtkFileChooserWidget, bool ownedRef = false)
74 	{
75 		this.gtkFileChooserWidget = gtkFileChooserWidget;
76 		super(cast(GtkBox*)gtkFileChooserWidget, ownedRef);
77 	}
78 
79 	// add the FileChooser capabilities
80 	mixin FileChooserT!(GtkFileChooserWidget);
81 
82 
83 	/** */
84 	public static GType getType()
85 	{
86 		return gtk_file_chooser_widget_get_type();
87 	}
88 
89 	/**
90 	 * Creates a new #GtkFileChooserWidget. This is a file chooser widget that can
91 	 * be embedded in custom windows, and it is the same widget that is used by
92 	 * #GtkFileChooserDialog.
93 	 *
94 	 * Params:
95 	 *     action = Open or save mode for the widget
96 	 *
97 	 * Returns: a new #GtkFileChooserWidget
98 	 *
99 	 * Since: 2.4
100 	 *
101 	 * Throws: ConstructionException GTK+ fails to create the object.
102 	 */
103 	public this(GtkFileChooserAction action)
104 	{
105 		auto p = gtk_file_chooser_widget_new(action);
106 
107 		if(p is null)
108 		{
109 			throw new ConstructionException("null returned by new");
110 		}
111 
112 		this(cast(GtkFileChooserWidget*) p);
113 	}
114 
115 	protected class OnDesktopFolderDelegateWrapper
116 	{
117 		void delegate(FileChooserWidget) dlg;
118 		gulong handlerId;
119 
120 		this(void delegate(FileChooserWidget) dlg)
121 		{
122 			this.dlg = dlg;
123 			onDesktopFolderListeners ~= this;
124 		}
125 
126 		void remove(OnDesktopFolderDelegateWrapper source)
127 		{
128 			foreach(index, wrapper; onDesktopFolderListeners)
129 			{
130 				if (wrapper.handlerId == source.handlerId)
131 				{
132 					onDesktopFolderListeners[index] = null;
133 					onDesktopFolderListeners = std.algorithm.remove(onDesktopFolderListeners, index);
134 					break;
135 				}
136 			}
137 		}
138 	}
139 	OnDesktopFolderDelegateWrapper[] onDesktopFolderListeners;
140 
141 	/**
142 	 * The ::desktop-folder signal is a [keybinding signal][GtkBindingSignal]
143 	 * which gets emitted when the user asks for it.
144 	 *
145 	 * This is used to make the file chooser show the user's Desktop
146 	 * folder in the file list.
147 	 *
148 	 * The default binding for this signal is `Alt + D`.
149 	 */
150 	gulong addOnDesktopFolder(void delegate(FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
151 	{
152 		auto wrapper = new OnDesktopFolderDelegateWrapper(dlg);
153 		wrapper.handlerId = Signals.connectData(
154 			this,
155 			"desktop-folder",
156 			cast(GCallback)&callBackDesktopFolder,
157 			cast(void*)wrapper,
158 			cast(GClosureNotify)&callBackDesktopFolderDestroy,
159 			connectFlags);
160 		return wrapper.handlerId;
161 	}
162 
163 	extern(C) static void callBackDesktopFolder(GtkFileChooserWidget* filechooserwidgetStruct, OnDesktopFolderDelegateWrapper wrapper)
164 	{
165 		wrapper.dlg(wrapper.outer);
166 	}
167 
168 	extern(C) static void callBackDesktopFolderDestroy(OnDesktopFolderDelegateWrapper wrapper, GClosure* closure)
169 	{
170 		wrapper.remove(wrapper);
171 	}
172 
173 	protected class OnDownFolderDelegateWrapper
174 	{
175 		void delegate(FileChooserWidget) dlg;
176 		gulong handlerId;
177 
178 		this(void delegate(FileChooserWidget) dlg)
179 		{
180 			this.dlg = dlg;
181 			onDownFolderListeners ~= this;
182 		}
183 
184 		void remove(OnDownFolderDelegateWrapper source)
185 		{
186 			foreach(index, wrapper; onDownFolderListeners)
187 			{
188 				if (wrapper.handlerId == source.handlerId)
189 				{
190 					onDownFolderListeners[index] = null;
191 					onDownFolderListeners = std.algorithm.remove(onDownFolderListeners, index);
192 					break;
193 				}
194 			}
195 		}
196 	}
197 	OnDownFolderDelegateWrapper[] onDownFolderListeners;
198 
199 	/**
200 	 * The ::down-folder signal is a [keybinding signal][GtkBindingSignal]
201 	 * which gets emitted when the user asks for it.
202 	 *
203 	 * This is used to make the file chooser go to a child of the current folder
204 	 * in the file hierarchy. The subfolder that will be used is displayed in the
205 	 * path bar widget of the file chooser. For example, if the path bar is showing
206 	 * "/foo/bar/baz", with bar currently displayed, then this will cause the file
207 	 * chooser to switch to the "baz" subfolder.
208 	 *
209 	 * The default binding for this signal is `Alt + Down`.
210 	 */
211 	gulong addOnDownFolder(void delegate(FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
212 	{
213 		auto wrapper = new OnDownFolderDelegateWrapper(dlg);
214 		wrapper.handlerId = Signals.connectData(
215 			this,
216 			"down-folder",
217 			cast(GCallback)&callBackDownFolder,
218 			cast(void*)wrapper,
219 			cast(GClosureNotify)&callBackDownFolderDestroy,
220 			connectFlags);
221 		return wrapper.handlerId;
222 	}
223 
224 	extern(C) static void callBackDownFolder(GtkFileChooserWidget* filechooserwidgetStruct, OnDownFolderDelegateWrapper wrapper)
225 	{
226 		wrapper.dlg(wrapper.outer);
227 	}
228 
229 	extern(C) static void callBackDownFolderDestroy(OnDownFolderDelegateWrapper wrapper, GClosure* closure)
230 	{
231 		wrapper.remove(wrapper);
232 	}
233 
234 	protected class OnHomeFolderDelegateWrapper
235 	{
236 		void delegate(FileChooserWidget) dlg;
237 		gulong handlerId;
238 
239 		this(void delegate(FileChooserWidget) dlg)
240 		{
241 			this.dlg = dlg;
242 			onHomeFolderListeners ~= this;
243 		}
244 
245 		void remove(OnHomeFolderDelegateWrapper source)
246 		{
247 			foreach(index, wrapper; onHomeFolderListeners)
248 			{
249 				if (wrapper.handlerId == source.handlerId)
250 				{
251 					onHomeFolderListeners[index] = null;
252 					onHomeFolderListeners = std.algorithm.remove(onHomeFolderListeners, index);
253 					break;
254 				}
255 			}
256 		}
257 	}
258 	OnHomeFolderDelegateWrapper[] onHomeFolderListeners;
259 
260 	/**
261 	 * The ::home-folder signal is a [keybinding signal][GtkBindingSignal]
262 	 * which gets emitted when the user asks for it.
263 	 *
264 	 * This is used to make the file chooser show the user's home
265 	 * folder in the file list.
266 	 *
267 	 * The default binding for this signal is `Alt + Home`.
268 	 */
269 	gulong addOnHomeFolder(void delegate(FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
270 	{
271 		auto wrapper = new OnHomeFolderDelegateWrapper(dlg);
272 		wrapper.handlerId = Signals.connectData(
273 			this,
274 			"home-folder",
275 			cast(GCallback)&callBackHomeFolder,
276 			cast(void*)wrapper,
277 			cast(GClosureNotify)&callBackHomeFolderDestroy,
278 			connectFlags);
279 		return wrapper.handlerId;
280 	}
281 
282 	extern(C) static void callBackHomeFolder(GtkFileChooserWidget* filechooserwidgetStruct, OnHomeFolderDelegateWrapper wrapper)
283 	{
284 		wrapper.dlg(wrapper.outer);
285 	}
286 
287 	extern(C) static void callBackHomeFolderDestroy(OnHomeFolderDelegateWrapper wrapper, GClosure* closure)
288 	{
289 		wrapper.remove(wrapper);
290 	}
291 
292 	protected class OnLocationPopupDelegateWrapper
293 	{
294 		void delegate(string, FileChooserWidget) dlg;
295 		gulong handlerId;
296 
297 		this(void delegate(string, FileChooserWidget) dlg)
298 		{
299 			this.dlg = dlg;
300 			onLocationPopupListeners ~= this;
301 		}
302 
303 		void remove(OnLocationPopupDelegateWrapper source)
304 		{
305 			foreach(index, wrapper; onLocationPopupListeners)
306 			{
307 				if (wrapper.handlerId == source.handlerId)
308 				{
309 					onLocationPopupListeners[index] = null;
310 					onLocationPopupListeners = std.algorithm.remove(onLocationPopupListeners, index);
311 					break;
312 				}
313 			}
314 		}
315 	}
316 	OnLocationPopupDelegateWrapper[] onLocationPopupListeners;
317 
318 	/**
319 	 * The ::location-popup signal is a [keybinding signal][GtkBindingSignal]
320 	 * which gets emitted when the user asks for it.
321 	 *
322 	 * This is used to make the file chooser show a "Location" prompt which
323 	 * the user can use to manually type the name of the file he wishes to select.
324 	 *
325 	 * The default bindings for this signal are `Control + L` with a @path string
326 	 * of "" (the empty string).  It is also bound to `/` with a @path string of
327 	 * "`/`" (a slash):  this lets you type `/` and immediately type a path name.
328 	 * On Unix systems, this is bound to `~` (tilde) with a @path string of "~"
329 	 * itself for access to home directories.
330 	 *
331 	 * Params:
332 	 *     path = a string that gets put in the text entry for the file name
333 	 */
334 	gulong addOnLocationPopup(void delegate(string, FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
335 	{
336 		auto wrapper = new OnLocationPopupDelegateWrapper(dlg);
337 		wrapper.handlerId = Signals.connectData(
338 			this,
339 			"location-popup",
340 			cast(GCallback)&callBackLocationPopup,
341 			cast(void*)wrapper,
342 			cast(GClosureNotify)&callBackLocationPopupDestroy,
343 			connectFlags);
344 		return wrapper.handlerId;
345 	}
346 
347 	extern(C) static void callBackLocationPopup(GtkFileChooserWidget* filechooserwidgetStruct, char* path, OnLocationPopupDelegateWrapper wrapper)
348 	{
349 		wrapper.dlg(Str.toString(path), wrapper.outer);
350 	}
351 
352 	extern(C) static void callBackLocationPopupDestroy(OnLocationPopupDelegateWrapper wrapper, GClosure* closure)
353 	{
354 		wrapper.remove(wrapper);
355 	}
356 
357 	protected class OnLocationPopupOnPasteDelegateWrapper
358 	{
359 		void delegate(FileChooserWidget) dlg;
360 		gulong handlerId;
361 
362 		this(void delegate(FileChooserWidget) dlg)
363 		{
364 			this.dlg = dlg;
365 			onLocationPopupOnPasteListeners ~= this;
366 		}
367 
368 		void remove(OnLocationPopupOnPasteDelegateWrapper source)
369 		{
370 			foreach(index, wrapper; onLocationPopupOnPasteListeners)
371 			{
372 				if (wrapper.handlerId == source.handlerId)
373 				{
374 					onLocationPopupOnPasteListeners[index] = null;
375 					onLocationPopupOnPasteListeners = std.algorithm.remove(onLocationPopupOnPasteListeners, index);
376 					break;
377 				}
378 			}
379 		}
380 	}
381 	OnLocationPopupOnPasteDelegateWrapper[] onLocationPopupOnPasteListeners;
382 
383 	/**
384 	 * The ::location-popup-on-paste signal is a [keybinding signal][GtkBindingSignal]
385 	 * which gets emitted when the user asks for it.
386 	 *
387 	 * This is used to make the file chooser show a "Location" prompt when the user
388 	 * pastes into a #GtkFileChooserWidget.
389 	 *
390 	 * The default binding for this signal is `Control + V`.
391 	 */
392 	gulong addOnLocationPopupOnPaste(void delegate(FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
393 	{
394 		auto wrapper = new OnLocationPopupOnPasteDelegateWrapper(dlg);
395 		wrapper.handlerId = Signals.connectData(
396 			this,
397 			"location-popup-on-paste",
398 			cast(GCallback)&callBackLocationPopupOnPaste,
399 			cast(void*)wrapper,
400 			cast(GClosureNotify)&callBackLocationPopupOnPasteDestroy,
401 			connectFlags);
402 		return wrapper.handlerId;
403 	}
404 
405 	extern(C) static void callBackLocationPopupOnPaste(GtkFileChooserWidget* filechooserwidgetStruct, OnLocationPopupOnPasteDelegateWrapper wrapper)
406 	{
407 		wrapper.dlg(wrapper.outer);
408 	}
409 
410 	extern(C) static void callBackLocationPopupOnPasteDestroy(OnLocationPopupOnPasteDelegateWrapper wrapper, GClosure* closure)
411 	{
412 		wrapper.remove(wrapper);
413 	}
414 
415 	protected class OnLocationTogglePopupDelegateWrapper
416 	{
417 		void delegate(FileChooserWidget) dlg;
418 		gulong handlerId;
419 
420 		this(void delegate(FileChooserWidget) dlg)
421 		{
422 			this.dlg = dlg;
423 			onLocationTogglePopupListeners ~= this;
424 		}
425 
426 		void remove(OnLocationTogglePopupDelegateWrapper source)
427 		{
428 			foreach(index, wrapper; onLocationTogglePopupListeners)
429 			{
430 				if (wrapper.handlerId == source.handlerId)
431 				{
432 					onLocationTogglePopupListeners[index] = null;
433 					onLocationTogglePopupListeners = std.algorithm.remove(onLocationTogglePopupListeners, index);
434 					break;
435 				}
436 			}
437 		}
438 	}
439 	OnLocationTogglePopupDelegateWrapper[] onLocationTogglePopupListeners;
440 
441 	/**
442 	 * The ::location-toggle-popup signal is a [keybinding signal][GtkBindingSignal]
443 	 * which gets emitted when the user asks for it.
444 	 *
445 	 * This is used to toggle the visibility of a "Location" prompt which the user
446 	 * can use to manually type the name of the file he wishes to select.
447 	 *
448 	 * The default binding for this signal is `Control + L`.
449 	 */
450 	gulong addOnLocationTogglePopup(void delegate(FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
451 	{
452 		auto wrapper = new OnLocationTogglePopupDelegateWrapper(dlg);
453 		wrapper.handlerId = Signals.connectData(
454 			this,
455 			"location-toggle-popup",
456 			cast(GCallback)&callBackLocationTogglePopup,
457 			cast(void*)wrapper,
458 			cast(GClosureNotify)&callBackLocationTogglePopupDestroy,
459 			connectFlags);
460 		return wrapper.handlerId;
461 	}
462 
463 	extern(C) static void callBackLocationTogglePopup(GtkFileChooserWidget* filechooserwidgetStruct, OnLocationTogglePopupDelegateWrapper wrapper)
464 	{
465 		wrapper.dlg(wrapper.outer);
466 	}
467 
468 	extern(C) static void callBackLocationTogglePopupDestroy(OnLocationTogglePopupDelegateWrapper wrapper, GClosure* closure)
469 	{
470 		wrapper.remove(wrapper);
471 	}
472 
473 	protected class OnPlacesShortcutDelegateWrapper
474 	{
475 		void delegate(FileChooserWidget) dlg;
476 		gulong handlerId;
477 
478 		this(void delegate(FileChooserWidget) dlg)
479 		{
480 			this.dlg = dlg;
481 			onPlacesShortcutListeners ~= this;
482 		}
483 
484 		void remove(OnPlacesShortcutDelegateWrapper source)
485 		{
486 			foreach(index, wrapper; onPlacesShortcutListeners)
487 			{
488 				if (wrapper.handlerId == source.handlerId)
489 				{
490 					onPlacesShortcutListeners[index] = null;
491 					onPlacesShortcutListeners = std.algorithm.remove(onPlacesShortcutListeners, index);
492 					break;
493 				}
494 			}
495 		}
496 	}
497 	OnPlacesShortcutDelegateWrapper[] onPlacesShortcutListeners;
498 
499 	/**
500 	 * The ::places-shortcut signal is a [keybinding signal][GtkBindingSignal]
501 	 * which gets emitted when the user asks for it.
502 	 *
503 	 * This is used to move the focus to the places sidebar.
504 	 *
505 	 * The default binding for this signal is `Alt + P`.
506 	 */
507 	gulong addOnPlacesShortcut(void delegate(FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
508 	{
509 		auto wrapper = new OnPlacesShortcutDelegateWrapper(dlg);
510 		wrapper.handlerId = Signals.connectData(
511 			this,
512 			"places-shortcut",
513 			cast(GCallback)&callBackPlacesShortcut,
514 			cast(void*)wrapper,
515 			cast(GClosureNotify)&callBackPlacesShortcutDestroy,
516 			connectFlags);
517 		return wrapper.handlerId;
518 	}
519 
520 	extern(C) static void callBackPlacesShortcut(GtkFileChooserWidget* filechooserwidgetStruct, OnPlacesShortcutDelegateWrapper wrapper)
521 	{
522 		wrapper.dlg(wrapper.outer);
523 	}
524 
525 	extern(C) static void callBackPlacesShortcutDestroy(OnPlacesShortcutDelegateWrapper wrapper, GClosure* closure)
526 	{
527 		wrapper.remove(wrapper);
528 	}
529 
530 	protected class OnQuickBookmarkDelegateWrapper
531 	{
532 		void delegate(int, FileChooserWidget) dlg;
533 		gulong handlerId;
534 
535 		this(void delegate(int, FileChooserWidget) dlg)
536 		{
537 			this.dlg = dlg;
538 			onQuickBookmarkListeners ~= this;
539 		}
540 
541 		void remove(OnQuickBookmarkDelegateWrapper source)
542 		{
543 			foreach(index, wrapper; onQuickBookmarkListeners)
544 			{
545 				if (wrapper.handlerId == source.handlerId)
546 				{
547 					onQuickBookmarkListeners[index] = null;
548 					onQuickBookmarkListeners = std.algorithm.remove(onQuickBookmarkListeners, index);
549 					break;
550 				}
551 			}
552 		}
553 	}
554 	OnQuickBookmarkDelegateWrapper[] onQuickBookmarkListeners;
555 
556 	/**
557 	 * The ::quick-bookmark signal is a [keybinding signal][GtkBindingSignal]
558 	 * which gets emitted when the user asks for it.
559 	 *
560 	 * This is used to make the file chooser switch to the bookmark specified
561 	 * in the @bookmark_index parameter. For example, if you have three bookmarks,
562 	 * you can pass 0, 1, 2 to this signal to switch to each of them, respectively.
563 	 *
564 	 * The default binding for this signal is `Alt + 1`, `Alt + 2`,
565 	 * etc. until `Alt + 0`.  Note that in the default binding, that
566 	 * `Alt + 1` is actually defined to switch to the bookmark at index
567 	 * 0, and so on successively; `Alt + 0` is defined to switch to the
568 	 * bookmark at index 10.
569 	 *
570 	 * Params:
571 	 *     bookmarkIndex = the number of the bookmark to switch to
572 	 */
573 	gulong addOnQuickBookmark(void delegate(int, FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
574 	{
575 		auto wrapper = new OnQuickBookmarkDelegateWrapper(dlg);
576 		wrapper.handlerId = Signals.connectData(
577 			this,
578 			"quick-bookmark",
579 			cast(GCallback)&callBackQuickBookmark,
580 			cast(void*)wrapper,
581 			cast(GClosureNotify)&callBackQuickBookmarkDestroy,
582 			connectFlags);
583 		return wrapper.handlerId;
584 	}
585 
586 	extern(C) static void callBackQuickBookmark(GtkFileChooserWidget* filechooserwidgetStruct, int bookmarkIndex, OnQuickBookmarkDelegateWrapper wrapper)
587 	{
588 		wrapper.dlg(bookmarkIndex, wrapper.outer);
589 	}
590 
591 	extern(C) static void callBackQuickBookmarkDestroy(OnQuickBookmarkDelegateWrapper wrapper, GClosure* closure)
592 	{
593 		wrapper.remove(wrapper);
594 	}
595 
596 	protected class OnRecentShortcutDelegateWrapper
597 	{
598 		void delegate(FileChooserWidget) dlg;
599 		gulong handlerId;
600 
601 		this(void delegate(FileChooserWidget) dlg)
602 		{
603 			this.dlg = dlg;
604 			onRecentShortcutListeners ~= this;
605 		}
606 
607 		void remove(OnRecentShortcutDelegateWrapper source)
608 		{
609 			foreach(index, wrapper; onRecentShortcutListeners)
610 			{
611 				if (wrapper.handlerId == source.handlerId)
612 				{
613 					onRecentShortcutListeners[index] = null;
614 					onRecentShortcutListeners = std.algorithm.remove(onRecentShortcutListeners, index);
615 					break;
616 				}
617 			}
618 		}
619 	}
620 	OnRecentShortcutDelegateWrapper[] onRecentShortcutListeners;
621 
622 	/**
623 	 * The ::recent-shortcut signal is a [keybinding signal][GtkBindingSignal]
624 	 * which gets emitted when the user asks for it.
625 	 *
626 	 * This is used to make the file chooser show the Recent location.
627 	 *
628 	 * The default binding for this signal is `Alt + R`.
629 	 */
630 	gulong addOnRecentShortcut(void delegate(FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
631 	{
632 		auto wrapper = new OnRecentShortcutDelegateWrapper(dlg);
633 		wrapper.handlerId = Signals.connectData(
634 			this,
635 			"recent-shortcut",
636 			cast(GCallback)&callBackRecentShortcut,
637 			cast(void*)wrapper,
638 			cast(GClosureNotify)&callBackRecentShortcutDestroy,
639 			connectFlags);
640 		return wrapper.handlerId;
641 	}
642 
643 	extern(C) static void callBackRecentShortcut(GtkFileChooserWidget* filechooserwidgetStruct, OnRecentShortcutDelegateWrapper wrapper)
644 	{
645 		wrapper.dlg(wrapper.outer);
646 	}
647 
648 	extern(C) static void callBackRecentShortcutDestroy(OnRecentShortcutDelegateWrapper wrapper, GClosure* closure)
649 	{
650 		wrapper.remove(wrapper);
651 	}
652 
653 	protected class OnSearchShortcutDelegateWrapper
654 	{
655 		void delegate(FileChooserWidget) dlg;
656 		gulong handlerId;
657 
658 		this(void delegate(FileChooserWidget) dlg)
659 		{
660 			this.dlg = dlg;
661 			onSearchShortcutListeners ~= this;
662 		}
663 
664 		void remove(OnSearchShortcutDelegateWrapper source)
665 		{
666 			foreach(index, wrapper; onSearchShortcutListeners)
667 			{
668 				if (wrapper.handlerId == source.handlerId)
669 				{
670 					onSearchShortcutListeners[index] = null;
671 					onSearchShortcutListeners = std.algorithm.remove(onSearchShortcutListeners, index);
672 					break;
673 				}
674 			}
675 		}
676 	}
677 	OnSearchShortcutDelegateWrapper[] onSearchShortcutListeners;
678 
679 	/**
680 	 * The ::search-shortcut signal is a [keybinding signal][GtkBindingSignal]
681 	 * which gets emitted when the user asks for it.
682 	 *
683 	 * This is used to make the file chooser show the search entry.
684 	 *
685 	 * The default binding for this signal is `Alt + S`.
686 	 */
687 	gulong addOnSearchShortcut(void delegate(FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
688 	{
689 		auto wrapper = new OnSearchShortcutDelegateWrapper(dlg);
690 		wrapper.handlerId = Signals.connectData(
691 			this,
692 			"search-shortcut",
693 			cast(GCallback)&callBackSearchShortcut,
694 			cast(void*)wrapper,
695 			cast(GClosureNotify)&callBackSearchShortcutDestroy,
696 			connectFlags);
697 		return wrapper.handlerId;
698 	}
699 
700 	extern(C) static void callBackSearchShortcut(GtkFileChooserWidget* filechooserwidgetStruct, OnSearchShortcutDelegateWrapper wrapper)
701 	{
702 		wrapper.dlg(wrapper.outer);
703 	}
704 
705 	extern(C) static void callBackSearchShortcutDestroy(OnSearchShortcutDelegateWrapper wrapper, GClosure* closure)
706 	{
707 		wrapper.remove(wrapper);
708 	}
709 
710 	protected class OnShowHiddenDelegateWrapper
711 	{
712 		void delegate(FileChooserWidget) dlg;
713 		gulong handlerId;
714 
715 		this(void delegate(FileChooserWidget) dlg)
716 		{
717 			this.dlg = dlg;
718 			onShowHiddenListeners ~= this;
719 		}
720 
721 		void remove(OnShowHiddenDelegateWrapper source)
722 		{
723 			foreach(index, wrapper; onShowHiddenListeners)
724 			{
725 				if (wrapper.handlerId == source.handlerId)
726 				{
727 					onShowHiddenListeners[index] = null;
728 					onShowHiddenListeners = std.algorithm.remove(onShowHiddenListeners, index);
729 					break;
730 				}
731 			}
732 		}
733 	}
734 	OnShowHiddenDelegateWrapper[] onShowHiddenListeners;
735 
736 	/**
737 	 * The ::show-hidden signal is a [keybinding signal][GtkBindingSignal]
738 	 * which gets emitted when the user asks for it.
739 	 *
740 	 * This is used to make the file chooser display hidden files.
741 	 *
742 	 * The default binding for this signal is `Control + H`.
743 	 */
744 	gulong addOnShowHidden(void delegate(FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
745 	{
746 		auto wrapper = new OnShowHiddenDelegateWrapper(dlg);
747 		wrapper.handlerId = Signals.connectData(
748 			this,
749 			"show-hidden",
750 			cast(GCallback)&callBackShowHidden,
751 			cast(void*)wrapper,
752 			cast(GClosureNotify)&callBackShowHiddenDestroy,
753 			connectFlags);
754 		return wrapper.handlerId;
755 	}
756 
757 	extern(C) static void callBackShowHidden(GtkFileChooserWidget* filechooserwidgetStruct, OnShowHiddenDelegateWrapper wrapper)
758 	{
759 		wrapper.dlg(wrapper.outer);
760 	}
761 
762 	extern(C) static void callBackShowHiddenDestroy(OnShowHiddenDelegateWrapper wrapper, GClosure* closure)
763 	{
764 		wrapper.remove(wrapper);
765 	}
766 
767 	protected class OnUpFolderDelegateWrapper
768 	{
769 		void delegate(FileChooserWidget) dlg;
770 		gulong handlerId;
771 
772 		this(void delegate(FileChooserWidget) dlg)
773 		{
774 			this.dlg = dlg;
775 			onUpFolderListeners ~= this;
776 		}
777 
778 		void remove(OnUpFolderDelegateWrapper source)
779 		{
780 			foreach(index, wrapper; onUpFolderListeners)
781 			{
782 				if (wrapper.handlerId == source.handlerId)
783 				{
784 					onUpFolderListeners[index] = null;
785 					onUpFolderListeners = std.algorithm.remove(onUpFolderListeners, index);
786 					break;
787 				}
788 			}
789 		}
790 	}
791 	OnUpFolderDelegateWrapper[] onUpFolderListeners;
792 
793 	/**
794 	 * The ::up-folder signal is a [keybinding signal][GtkBindingSignal]
795 	 * which gets emitted when the user asks for it.
796 	 *
797 	 * This is used to make the file chooser go to the parent of the current folder
798 	 * in the file hierarchy.
799 	 *
800 	 * The default binding for this signal is `Alt + Up`.
801 	 */
802 	gulong addOnUpFolder(void delegate(FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
803 	{
804 		auto wrapper = new OnUpFolderDelegateWrapper(dlg);
805 		wrapper.handlerId = Signals.connectData(
806 			this,
807 			"up-folder",
808 			cast(GCallback)&callBackUpFolder,
809 			cast(void*)wrapper,
810 			cast(GClosureNotify)&callBackUpFolderDestroy,
811 			connectFlags);
812 		return wrapper.handlerId;
813 	}
814 
815 	extern(C) static void callBackUpFolder(GtkFileChooserWidget* filechooserwidgetStruct, OnUpFolderDelegateWrapper wrapper)
816 	{
817 		wrapper.dlg(wrapper.outer);
818 	}
819 
820 	extern(C) static void callBackUpFolderDestroy(OnUpFolderDelegateWrapper wrapper, GClosure* closure)
821 	{
822 		wrapper.remove(wrapper);
823 	}
824 }