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 		static OnDesktopFolderDelegateWrapper[] listeners;
123 		void delegate(FileChooserWidget) dlg;
124 		gulong handlerId;
125 		
126 		this(void delegate(FileChooserWidget) dlg)
127 		{
128 			this.dlg = dlg;
129 			this.listeners ~= this;
130 		}
131 		
132 		void remove(OnDesktopFolderDelegateWrapper source)
133 		{
134 			foreach(index, wrapper; listeners)
135 			{
136 				if (wrapper.handlerId == source.handlerId)
137 				{
138 					listeners[index] = null;
139 					listeners = std.algorithm.remove(listeners, index);
140 					break;
141 				}
142 			}
143 		}
144 	}
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 		static OnDownFolderDelegateWrapper[] listeners;
181 		void delegate(FileChooserWidget) dlg;
182 		gulong handlerId;
183 		
184 		this(void delegate(FileChooserWidget) dlg)
185 		{
186 			this.dlg = dlg;
187 			this.listeners ~= this;
188 		}
189 		
190 		void remove(OnDownFolderDelegateWrapper source)
191 		{
192 			foreach(index, wrapper; listeners)
193 			{
194 				if (wrapper.handlerId == source.handlerId)
195 				{
196 					listeners[index] = null;
197 					listeners = std.algorithm.remove(listeners, index);
198 					break;
199 				}
200 			}
201 		}
202 	}
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 		static OnHomeFolderDelegateWrapper[] listeners;
242 		void delegate(FileChooserWidget) dlg;
243 		gulong handlerId;
244 		
245 		this(void delegate(FileChooserWidget) dlg)
246 		{
247 			this.dlg = dlg;
248 			this.listeners ~= this;
249 		}
250 		
251 		void remove(OnHomeFolderDelegateWrapper source)
252 		{
253 			foreach(index, wrapper; listeners)
254 			{
255 				if (wrapper.handlerId == source.handlerId)
256 				{
257 					listeners[index] = null;
258 					listeners = std.algorithm.remove(listeners, index);
259 					break;
260 				}
261 			}
262 		}
263 	}
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 		static OnLocationPopupDelegateWrapper[] listeners;
300 		void delegate(string, FileChooserWidget) dlg;
301 		gulong handlerId;
302 		
303 		this(void delegate(string, FileChooserWidget) dlg)
304 		{
305 			this.dlg = dlg;
306 			this.listeners ~= this;
307 		}
308 		
309 		void remove(OnLocationPopupDelegateWrapper source)
310 		{
311 			foreach(index, wrapper; listeners)
312 			{
313 				if (wrapper.handlerId == source.handlerId)
314 				{
315 					listeners[index] = null;
316 					listeners = std.algorithm.remove(listeners, index);
317 					break;
318 				}
319 			}
320 		}
321 	}
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 		static OnLocationPopupOnPasteDelegateWrapper[] listeners;
365 		void delegate(FileChooserWidget) dlg;
366 		gulong handlerId;
367 		
368 		this(void delegate(FileChooserWidget) dlg)
369 		{
370 			this.dlg = dlg;
371 			this.listeners ~= this;
372 		}
373 		
374 		void remove(OnLocationPopupOnPasteDelegateWrapper source)
375 		{
376 			foreach(index, wrapper; listeners)
377 			{
378 				if (wrapper.handlerId == source.handlerId)
379 				{
380 					listeners[index] = null;
381 					listeners = std.algorithm.remove(listeners, index);
382 					break;
383 				}
384 			}
385 		}
386 	}
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 		static OnLocationTogglePopupDelegateWrapper[] listeners;
423 		void delegate(FileChooserWidget) dlg;
424 		gulong handlerId;
425 		
426 		this(void delegate(FileChooserWidget) dlg)
427 		{
428 			this.dlg = dlg;
429 			this.listeners ~= this;
430 		}
431 		
432 		void remove(OnLocationTogglePopupDelegateWrapper source)
433 		{
434 			foreach(index, wrapper; listeners)
435 			{
436 				if (wrapper.handlerId == source.handlerId)
437 				{
438 					listeners[index] = null;
439 					listeners = std.algorithm.remove(listeners, index);
440 					break;
441 				}
442 			}
443 		}
444 	}
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 		static OnPlacesShortcutDelegateWrapper[] listeners;
481 		void delegate(FileChooserWidget) dlg;
482 		gulong handlerId;
483 		
484 		this(void delegate(FileChooserWidget) dlg)
485 		{
486 			this.dlg = dlg;
487 			this.listeners ~= this;
488 		}
489 		
490 		void remove(OnPlacesShortcutDelegateWrapper source)
491 		{
492 			foreach(index, wrapper; listeners)
493 			{
494 				if (wrapper.handlerId == source.handlerId)
495 				{
496 					listeners[index] = null;
497 					listeners = std.algorithm.remove(listeners, index);
498 					break;
499 				}
500 			}
501 		}
502 	}
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 		static OnQuickBookmarkDelegateWrapper[] listeners;
538 		void delegate(int, FileChooserWidget) dlg;
539 		gulong handlerId;
540 		
541 		this(void delegate(int, FileChooserWidget) dlg)
542 		{
543 			this.dlg = dlg;
544 			this.listeners ~= this;
545 		}
546 		
547 		void remove(OnQuickBookmarkDelegateWrapper source)
548 		{
549 			foreach(index, wrapper; listeners)
550 			{
551 				if (wrapper.handlerId == source.handlerId)
552 				{
553 					listeners[index] = null;
554 					listeners = std.algorithm.remove(listeners, index);
555 					break;
556 				}
557 			}
558 		}
559 	}
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 		static OnRecentShortcutDelegateWrapper[] listeners;
604 		void delegate(FileChooserWidget) dlg;
605 		gulong handlerId;
606 		
607 		this(void delegate(FileChooserWidget) dlg)
608 		{
609 			this.dlg = dlg;
610 			this.listeners ~= this;
611 		}
612 		
613 		void remove(OnRecentShortcutDelegateWrapper source)
614 		{
615 			foreach(index, wrapper; listeners)
616 			{
617 				if (wrapper.handlerId == source.handlerId)
618 				{
619 					listeners[index] = null;
620 					listeners = std.algorithm.remove(listeners, index);
621 					break;
622 				}
623 			}
624 		}
625 	}
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 		static OnSearchShortcutDelegateWrapper[] listeners;
661 		void delegate(FileChooserWidget) dlg;
662 		gulong handlerId;
663 		
664 		this(void delegate(FileChooserWidget) dlg)
665 		{
666 			this.dlg = dlg;
667 			this.listeners ~= this;
668 		}
669 		
670 		void remove(OnSearchShortcutDelegateWrapper source)
671 		{
672 			foreach(index, wrapper; listeners)
673 			{
674 				if (wrapper.handlerId == source.handlerId)
675 				{
676 					listeners[index] = null;
677 					listeners = std.algorithm.remove(listeners, index);
678 					break;
679 				}
680 			}
681 		}
682 	}
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 		static OnShowHiddenDelegateWrapper[] listeners;
718 		void delegate(FileChooserWidget) dlg;
719 		gulong handlerId;
720 		
721 		this(void delegate(FileChooserWidget) dlg)
722 		{
723 			this.dlg = dlg;
724 			this.listeners ~= this;
725 		}
726 		
727 		void remove(OnShowHiddenDelegateWrapper source)
728 		{
729 			foreach(index, wrapper; listeners)
730 			{
731 				if (wrapper.handlerId == source.handlerId)
732 				{
733 					listeners[index] = null;
734 					listeners = std.algorithm.remove(listeners, index);
735 					break;
736 				}
737 			}
738 		}
739 	}
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 		static OnUpFolderDelegateWrapper[] listeners;
775 		void delegate(FileChooserWidget) dlg;
776 		gulong handlerId;
777 		
778 		this(void delegate(FileChooserWidget) dlg)
779 		{
780 			this.dlg = dlg;
781 			this.listeners ~= this;
782 		}
783 		
784 		void remove(OnUpFolderDelegateWrapper source)
785 		{
786 			foreach(index, wrapper; listeners)
787 			{
788 				if (wrapper.handlerId == source.handlerId)
789 				{
790 					listeners[index] = null;
791 					listeners = std.algorithm.remove(listeners, index);
792 					break;
793 				}
794 			}
795 		}
796 	}
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 }