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