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