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