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.PlacesSidebar;
26 
27 private import gdk.DragContext;
28 private import gio.FileIF;
29 private import gio.MountOperation;
30 private import gio.VolumeIF;
31 private import glib.ConstructionException;
32 private import glib.ListG;
33 private import glib.ListSG;
34 private import glib.Str;
35 private import gobject.ObjectG;
36 private import gobject.Signals;
37 private import gtk.ScrolledWindow;
38 private import gtk.Widget;
39 private import gtk.c.functions;
40 public  import gtk.c.types;
41 public  import gtkc.gtktypes;
42 private import std.algorithm;
43 
44 
45 /**
46  * #GtkPlacesSidebar is a widget that displays a list of frequently-used places in the
47  * file system:  the user’s home directory, the user’s bookmarks, and volumes and drives.
48  * This widget is used as a sidebar in #GtkFileChooser and may be used by file managers
49  * and similar programs.
50  * 
51  * The places sidebar displays drives and volumes, and will automatically mount
52  * or unmount them when the user selects them.
53  * 
54  * Applications can hook to various signals in the places sidebar to customize
55  * its behavior.  For example, they can add extra commands to the context menu
56  * of the sidebar.
57  * 
58  * While bookmarks are completely in control of the user, the places sidebar also
59  * allows individual applications to provide extra shortcut folders that are unique
60  * to each application.  For example, a Paint program may want to add a shortcut
61  * for a Clipart folder.  You can do this with gtk_places_sidebar_add_shortcut().
62  * 
63  * To make use of the places sidebar, an application at least needs to connect
64  * to the #GtkPlacesSidebar::open-location signal.  This is emitted when the
65  * user selects in the sidebar a location to open.  The application should also
66  * call gtk_places_sidebar_set_location() when it changes the currently-viewed
67  * location.
68  * 
69  * # CSS nodes
70  * 
71  * GtkPlacesSidebar uses a single CSS node with name placessidebar and style
72  * class .sidebar.
73  * 
74  * Among the children of the places sidebar, the following style classes can
75  * be used:
76  * - .sidebar-new-bookmark-row for the 'Add new bookmark' row
77  * - .sidebar-placeholder-row for a row that is a placeholder
78  * - .has-open-popup when a popup is open for a row
79  */
80 public class PlacesSidebar : ScrolledWindow
81 {
82 	/** the main Gtk struct */
83 	protected GtkPlacesSidebar* gtkPlacesSidebar;
84 
85 	/** Get the main Gtk struct */
86 	public GtkPlacesSidebar* getPlacesSidebarStruct(bool transferOwnership = false)
87 	{
88 		if (transferOwnership)
89 			ownedRef = false;
90 		return gtkPlacesSidebar;
91 	}
92 
93 	/** the main Gtk struct as a void* */
94 	protected override void* getStruct()
95 	{
96 		return cast(void*)gtkPlacesSidebar;
97 	}
98 
99 	protected override void setStruct(GObject* obj)
100 	{
101 		gtkPlacesSidebar = cast(GtkPlacesSidebar*)obj;
102 		super.setStruct(obj);
103 	}
104 
105 	/**
106 	 * Sets our main struct and passes it to the parent class.
107 	 */
108 	public this (GtkPlacesSidebar* gtkPlacesSidebar, bool ownedRef = false)
109 	{
110 		this.gtkPlacesSidebar = gtkPlacesSidebar;
111 		super(cast(GtkScrolledWindow*)gtkPlacesSidebar, ownedRef);
112 	}
113 
114 
115 	/** */
116 	public static GType getType()
117 	{
118 		return gtk_places_sidebar_get_type();
119 	}
120 
121 	/**
122 	 * Creates a new #GtkPlacesSidebar widget.
123 	 *
124 	 * The application should connect to at least the
125 	 * #GtkPlacesSidebar::open-location signal to be notified
126 	 * when the user makes a selection in the sidebar.
127 	 *
128 	 * Returns: a newly created #GtkPlacesSidebar
129 	 *
130 	 * Since: 3.10
131 	 *
132 	 * Throws: ConstructionException GTK+ fails to create the object.
133 	 */
134 	public this()
135 	{
136 		auto p = gtk_places_sidebar_new();
137 
138 		if(p is null)
139 		{
140 			throw new ConstructionException("null returned by new");
141 		}
142 
143 		this(cast(GtkPlacesSidebar*) p);
144 	}
145 
146 	/**
147 	 * Applications may want to present some folders in the places sidebar if
148 	 * they could be immediately useful to users.  For example, a drawing
149 	 * program could add a “/usr/share/clipart” location when the sidebar is
150 	 * being used in an “Insert Clipart” dialog box.
151 	 *
152 	 * This function adds the specified @location to a special place for immutable
153 	 * shortcuts.  The shortcuts are application-specific; they are not shared
154 	 * across applications, and they are not persistent.  If this function
155 	 * is called multiple times with different locations, then they are added
156 	 * to the sidebar’s list in the same order as the function is called.
157 	 *
158 	 * Params:
159 	 *     location = location to add as an application-specific shortcut
160 	 *
161 	 * Since: 3.10
162 	 */
163 	public void addShortcut(FileIF location)
164 	{
165 		gtk_places_sidebar_add_shortcut(gtkPlacesSidebar, (location is null) ? null : location.getFileStruct());
166 	}
167 
168 	/**
169 	 * Returns the value previously set with gtk_places_sidebar_set_local_only().
170 	 *
171 	 * Returns: %TRUE if the sidebar will only show local files.
172 	 *
173 	 * Since: 3.12
174 	 */
175 	public bool getLocalOnly()
176 	{
177 		return gtk_places_sidebar_get_local_only(gtkPlacesSidebar) != 0;
178 	}
179 
180 	/**
181 	 * Gets the currently-selected location in the @sidebar.  This can be #NULL when
182 	 * nothing is selected, for example, when gtk_places_sidebar_set_location() has
183 	 * been called with a location that is not among the sidebar’s list of places to
184 	 * show.
185 	 *
186 	 * You can use this function to get the selection in the @sidebar.  Also, if you
187 	 * connect to the #GtkPlacesSidebar::populate-popup signal, you can use this
188 	 * function to get the location that is being referred to during the callbacks
189 	 * for your menu items.
190 	 *
191 	 * Returns: a GFile with the selected location, or
192 	 *     %NULL if nothing is visually selected.
193 	 *
194 	 * Since: 3.10
195 	 */
196 	public FileIF getLocation()
197 	{
198 		auto p = gtk_places_sidebar_get_location(gtkPlacesSidebar);
199 
200 		if(p is null)
201 		{
202 			return null;
203 		}
204 
205 		return ObjectG.getDObject!(FileIF)(cast(GFile*) p, true);
206 	}
207 
208 	/**
209 	 * This function queries the bookmarks added by the user to the places sidebar,
210 	 * and returns one of them.  This function is used by #GtkFileChooser to implement
211 	 * the “Alt-1”, “Alt-2”, etc. shortcuts, which activate the cooresponding bookmark.
212 	 *
213 	 * Params:
214 	 *     n = index of the bookmark to query
215 	 *
216 	 * Returns: The bookmark specified by the index @n, or
217 	 *     %NULL if no such index exist.  Note that the indices start at 0, even though
218 	 *     the file chooser starts them with the keyboard shortcut "Alt-1".
219 	 *
220 	 * Since: 3.10
221 	 */
222 	public FileIF getNthBookmark(int n)
223 	{
224 		auto p = gtk_places_sidebar_get_nth_bookmark(gtkPlacesSidebar, n);
225 
226 		if(p is null)
227 		{
228 			return null;
229 		}
230 
231 		return ObjectG.getDObject!(FileIF)(cast(GFile*) p, true);
232 	}
233 
234 	/**
235 	 * Gets the open flags.
236 	 *
237 	 * Returns: the #GtkPlacesOpenFlags of @sidebar
238 	 *
239 	 * Since: 3.10
240 	 */
241 	public GtkPlacesOpenFlags getOpenFlags()
242 	{
243 		return gtk_places_sidebar_get_open_flags(gtkPlacesSidebar);
244 	}
245 
246 	/**
247 	 * Returns the value previously set with gtk_places_sidebar_set_show_connect_to_server()
248 	 *
249 	 * Deprecated: It is recommended to group this functionality with the drives
250 	 * and network location under the new 'Other Location' item
251 	 *
252 	 * Returns: %TRUE if the sidebar will display a “Connect to Server” item.
253 	 */
254 	public bool getShowConnectToServer()
255 	{
256 		return gtk_places_sidebar_get_show_connect_to_server(gtkPlacesSidebar) != 0;
257 	}
258 
259 	/**
260 	 * Returns the value previously set with gtk_places_sidebar_set_show_desktop()
261 	 *
262 	 * Returns: %TRUE if the sidebar will display a builtin shortcut to the desktop folder.
263 	 *
264 	 * Since: 3.10
265 	 */
266 	public bool getShowDesktop()
267 	{
268 		return gtk_places_sidebar_get_show_desktop(gtkPlacesSidebar) != 0;
269 	}
270 
271 	/**
272 	 * Returns the value previously set with gtk_places_sidebar_set_show_enter_location()
273 	 *
274 	 * Returns: %TRUE if the sidebar will display an “Enter Location” item.
275 	 *
276 	 * Since: 3.14
277 	 */
278 	public bool getShowEnterLocation()
279 	{
280 		return gtk_places_sidebar_get_show_enter_location(gtkPlacesSidebar) != 0;
281 	}
282 
283 	/**
284 	 * Returns the value previously set with gtk_places_sidebar_set_show_other_locations()
285 	 *
286 	 * Returns: %TRUE if the sidebar will display an “Other Locations” item.
287 	 *
288 	 * Since: 3.18
289 	 */
290 	public bool getShowOtherLocations()
291 	{
292 		return gtk_places_sidebar_get_show_other_locations(gtkPlacesSidebar) != 0;
293 	}
294 
295 	/**
296 	 * Returns the value previously set with gtk_places_sidebar_set_show_recent()
297 	 *
298 	 * Returns: %TRUE if the sidebar will display a builtin shortcut for recent files
299 	 *
300 	 * Since: 3.18
301 	 */
302 	public bool getShowRecent()
303 	{
304 		return gtk_places_sidebar_get_show_recent(gtkPlacesSidebar) != 0;
305 	}
306 
307 	/**
308 	 * Returns the value previously set with gtk_places_sidebar_set_show_trash()
309 	 *
310 	 * Returns: %TRUE if the sidebar will display a “Trash” item.
311 	 *
312 	 * Since: 3.18
313 	 */
314 	public bool getShowTrash()
315 	{
316 		return gtk_places_sidebar_get_show_trash(gtkPlacesSidebar) != 0;
317 	}
318 
319 	/**
320 	 * Gets the list of shortcuts.
321 	 *
322 	 * Returns: A #GSList of #GFile of the locations that have been added as
323 	 *     application-specific shortcuts with gtk_places_sidebar_add_shortcut().
324 	 *     To free this list, you can use
325 	 *     |[<!-- language="C" -->
326 	 *     g_slist_free_full (list, (GDestroyNotify) g_object_unref);
327 	 *     ]|
328 	 *
329 	 * Since: 3.10
330 	 */
331 	public ListSG listShortcuts()
332 	{
333 		auto p = gtk_places_sidebar_list_shortcuts(gtkPlacesSidebar);
334 
335 		if(p is null)
336 		{
337 			return null;
338 		}
339 
340 		return new ListSG(cast(GSList*) p, true);
341 	}
342 
343 	/**
344 	 * Removes an application-specific shortcut that has been previously been
345 	 * inserted with gtk_places_sidebar_add_shortcut().  If the @location is not a
346 	 * shortcut in the sidebar, then nothing is done.
347 	 *
348 	 * Params:
349 	 *     location = location to remove
350 	 *
351 	 * Since: 3.10
352 	 */
353 	public void removeShortcut(FileIF location)
354 	{
355 		gtk_places_sidebar_remove_shortcut(gtkPlacesSidebar, (location is null) ? null : location.getFileStruct());
356 	}
357 
358 	/**
359 	 * Make the GtkPlacesSidebar show drop targets, so it can show the available
360 	 * drop targets and a "new bookmark" row. This improves the Drag-and-Drop
361 	 * experience of the user and allows applications to show all available
362 	 * drop targets at once.
363 	 *
364 	 * This needs to be called when the application is aware of an ongoing drag
365 	 * that might target the sidebar. The drop-targets-visible state will be unset
366 	 * automatically if the drag finishes in the GtkPlacesSidebar. You only need
367 	 * to unset the state when the drag ends on some other widget on your application.
368 	 *
369 	 * Params:
370 	 *     visible = whether to show the valid targets or not.
371 	 *     context = drag context used to ask the source about the action that wants to
372 	 *         perform, so hints are more accurate.
373 	 *
374 	 * Since: 3.18
375 	 */
376 	public void setDropTargetsVisible(bool visible, DragContext context)
377 	{
378 		gtk_places_sidebar_set_drop_targets_visible(gtkPlacesSidebar, visible, (context is null) ? null : context.getDragContextStruct());
379 	}
380 
381 	/**
382 	 * Sets whether the @sidebar should only show local files.
383 	 *
384 	 * Params:
385 	 *     localOnly = whether to show only local files
386 	 *
387 	 * Since: 3.12
388 	 */
389 	public void setLocalOnly(bool localOnly)
390 	{
391 		gtk_places_sidebar_set_local_only(gtkPlacesSidebar, localOnly);
392 	}
393 
394 	/**
395 	 * Sets the location that is being shown in the widgets surrounding the
396 	 * @sidebar, for example, in a folder view in a file manager.  In turn, the
397 	 * @sidebar will highlight that location if it is being shown in the list of
398 	 * places, or it will unhighlight everything if the @location is not among the
399 	 * places in the list.
400 	 *
401 	 * Params:
402 	 *     location = location to select, or #NULL for no current path
403 	 *
404 	 * Since: 3.10
405 	 */
406 	public void setLocation(FileIF location)
407 	{
408 		gtk_places_sidebar_set_location(gtkPlacesSidebar, (location is null) ? null : location.getFileStruct());
409 	}
410 
411 	/**
412 	 * Sets the way in which the calling application can open new locations from
413 	 * the places sidebar.  For example, some applications only open locations
414 	 * “directly” into their main view, while others may support opening locations
415 	 * in a new notebook tab or a new window.
416 	 *
417 	 * This function is used to tell the places @sidebar about the ways in which the
418 	 * application can open new locations, so that the sidebar can display (or not)
419 	 * the “Open in new tab” and “Open in new window” menu items as appropriate.
420 	 *
421 	 * When the #GtkPlacesSidebar::open-location signal is emitted, its flags
422 	 * argument will be set to one of the @flags that was passed in
423 	 * gtk_places_sidebar_set_open_flags().
424 	 *
425 	 * Passing 0 for @flags will cause #GTK_PLACES_OPEN_NORMAL to always be sent
426 	 * to callbacks for the “open-location” signal.
427 	 *
428 	 * Params:
429 	 *     flags = Bitmask of modes in which the calling application can open locations
430 	 *
431 	 * Since: 3.10
432 	 */
433 	public void setOpenFlags(GtkPlacesOpenFlags flags)
434 	{
435 		gtk_places_sidebar_set_open_flags(gtkPlacesSidebar, flags);
436 	}
437 
438 	/**
439 	 * Sets whether the @sidebar should show an item for connecting to a network server;
440 	 * this is off by default. An application may want to turn this on if it implements
441 	 * a way for the user to connect to network servers directly.
442 	 *
443 	 * If you enable this, you should connect to the
444 	 * #GtkPlacesSidebar::show-connect-to-server signal.
445 	 *
446 	 * Deprecated: It is recommended to group this functionality with the drives
447 	 * and network location under the new 'Other Location' item
448 	 *
449 	 * Params:
450 	 *     showConnectToServer = whether to show an item for the Connect to Server command
451 	 *
452 	 * Since: 3.10
453 	 */
454 	public void setShowConnectToServer(bool showConnectToServer)
455 	{
456 		gtk_places_sidebar_set_show_connect_to_server(gtkPlacesSidebar, showConnectToServer);
457 	}
458 
459 	/**
460 	 * Sets whether the @sidebar should show an item for the Desktop folder.
461 	 * The default value for this option is determined by the desktop
462 	 * environment and the user’s configuration, but this function can be
463 	 * used to override it on a per-application basis.
464 	 *
465 	 * Params:
466 	 *     showDesktop = whether to show an item for the Desktop folder
467 	 *
468 	 * Since: 3.10
469 	 */
470 	public void setShowDesktop(bool showDesktop)
471 	{
472 		gtk_places_sidebar_set_show_desktop(gtkPlacesSidebar, showDesktop);
473 	}
474 
475 	/**
476 	 * Sets whether the @sidebar should show an item for entering a location;
477 	 * this is off by default. An application may want to turn this on if manually
478 	 * entering URLs is an expected user action.
479 	 *
480 	 * If you enable this, you should connect to the
481 	 * #GtkPlacesSidebar::show-enter-location signal.
482 	 *
483 	 * Params:
484 	 *     showEnterLocation = whether to show an item to enter a location
485 	 *
486 	 * Since: 3.14
487 	 */
488 	public void setShowEnterLocation(bool showEnterLocation)
489 	{
490 		gtk_places_sidebar_set_show_enter_location(gtkPlacesSidebar, showEnterLocation);
491 	}
492 
493 	/**
494 	 * Sets whether the @sidebar should show an item for the application to show
495 	 * an Other Locations view; this is off by default. When set to %TRUE, persistent
496 	 * devices such as hard drives are hidden, otherwise they are shown in the sidebar.
497 	 * An application may want to turn this on if it implements a way for the user to
498 	 * see and interact with drives and network servers directly.
499 	 *
500 	 * If you enable this, you should connect to the
501 	 * #GtkPlacesSidebar::show-other-locations signal.
502 	 *
503 	 * Params:
504 	 *     showOtherLocations = whether to show an item for the Other Locations view
505 	 *
506 	 * Since: 3.18
507 	 */
508 	public void setShowOtherLocations(bool showOtherLocations)
509 	{
510 		gtk_places_sidebar_set_show_other_locations(gtkPlacesSidebar, showOtherLocations);
511 	}
512 
513 	/**
514 	 * Sets whether the @sidebar should show an item for recent files.
515 	 * The default value for this option is determined by the desktop
516 	 * environment, but this function can be used to override it on a
517 	 * per-application basis.
518 	 *
519 	 * Params:
520 	 *     showRecent = whether to show an item for recent files
521 	 *
522 	 * Since: 3.18
523 	 */
524 	public void setShowRecent(bool showRecent)
525 	{
526 		gtk_places_sidebar_set_show_recent(gtkPlacesSidebar, showRecent);
527 	}
528 
529 	/**
530 	 * Sets whether the @sidebar should show an item for the Trash location.
531 	 *
532 	 * Params:
533 	 *     showTrash = whether to show an item for the Trash location
534 	 *
535 	 * Since: 3.18
536 	 */
537 	public void setShowTrash(bool showTrash)
538 	{
539 		gtk_places_sidebar_set_show_trash(gtkPlacesSidebar, showTrash);
540 	}
541 
542 	protected class OnDragActionAskDelegateWrapper
543 	{
544 		int delegate(int, PlacesSidebar) dlg;
545 		gulong handlerId;
546 
547 		this(int delegate(int, PlacesSidebar) dlg)
548 		{
549 			this.dlg = dlg;
550 			onDragActionAskListeners ~= this;
551 		}
552 
553 		void remove(OnDragActionAskDelegateWrapper source)
554 		{
555 			foreach(index, wrapper; onDragActionAskListeners)
556 			{
557 				if (wrapper.handlerId == source.handlerId)
558 				{
559 					onDragActionAskListeners[index] = null;
560 					onDragActionAskListeners = std.algorithm.remove(onDragActionAskListeners, index);
561 					break;
562 				}
563 			}
564 		}
565 	}
566 	OnDragActionAskDelegateWrapper[] onDragActionAskListeners;
567 
568 	/**
569 	 * The places sidebar emits this signal when it needs to ask the application
570 	 * to pop up a menu to ask the user for which drag action to perform.
571 	 *
572 	 * Params:
573 	 *     actions = Possible drag actions that need to be asked for.
574 	 *
575 	 * Returns: the final drag action that the sidebar should pass to the drag side
576 	 *     of the drag-and-drop operation.
577 	 *
578 	 * Since: 3.10
579 	 */
580 	gulong addOnDragActionAsk(int delegate(int, PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
581 	{
582 		auto wrapper = new OnDragActionAskDelegateWrapper(dlg);
583 		wrapper.handlerId = Signals.connectData(
584 			this,
585 			"drag-action-ask",
586 			cast(GCallback)&callBackDragActionAsk,
587 			cast(void*)wrapper,
588 			cast(GClosureNotify)&callBackDragActionAskDestroy,
589 			connectFlags);
590 		return wrapper.handlerId;
591 	}
592 
593 	extern(C) static int callBackDragActionAsk(GtkPlacesSidebar* placessidebarStruct, int actions, OnDragActionAskDelegateWrapper wrapper)
594 	{
595 		return wrapper.dlg(actions, wrapper.outer);
596 	}
597 
598 	extern(C) static void callBackDragActionAskDestroy(OnDragActionAskDelegateWrapper wrapper, GClosure* closure)
599 	{
600 		wrapper.remove(wrapper);
601 	}
602 
603 	protected class OnDragActionRequestedDelegateWrapper
604 	{
605 		int delegate(DragContext, FileIF, ListG, PlacesSidebar) dlg;
606 		gulong handlerId;
607 
608 		this(int delegate(DragContext, FileIF, ListG, PlacesSidebar) dlg)
609 		{
610 			this.dlg = dlg;
611 			onDragActionRequestedListeners ~= this;
612 		}
613 
614 		void remove(OnDragActionRequestedDelegateWrapper source)
615 		{
616 			foreach(index, wrapper; onDragActionRequestedListeners)
617 			{
618 				if (wrapper.handlerId == source.handlerId)
619 				{
620 					onDragActionRequestedListeners[index] = null;
621 					onDragActionRequestedListeners = std.algorithm.remove(onDragActionRequestedListeners, index);
622 					break;
623 				}
624 			}
625 		}
626 	}
627 	OnDragActionRequestedDelegateWrapper[] onDragActionRequestedListeners;
628 
629 	/**
630 	 * When the user starts a drag-and-drop operation and the sidebar needs
631 	 * to ask the application for which drag action to perform, then the
632 	 * sidebar will emit this signal.
633 	 *
634 	 * The application can evaluate the @context for customary actions, or
635 	 * it can check the type of the files indicated by @source_file_list against the
636 	 * possible actions for the destination @dest_file.
637 	 *
638 	 * The drag action to use must be the return value of the signal handler.
639 	 *
640 	 * Params:
641 	 *     context = #GdkDragContext with information about the drag operation
642 	 *     destFile = #GFile with the tentative location that is being hovered for a drop
643 	 *     sourceFileList = List of #GFile that are being dragged
644 	 *
645 	 * Returns: The drag action to use, for example, #GDK_ACTION_COPY
646 	 *     or #GDK_ACTION_MOVE, or 0 if no action is allowed here (i.e. drops
647 	 *     are not allowed in the specified @dest_file).
648 	 *
649 	 * Since: 3.10
650 	 */
651 	gulong addOnDragActionRequested(int delegate(DragContext, FileIF, ListG, PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
652 	{
653 		auto wrapper = new OnDragActionRequestedDelegateWrapper(dlg);
654 		wrapper.handlerId = Signals.connectData(
655 			this,
656 			"drag-action-requested",
657 			cast(GCallback)&callBackDragActionRequested,
658 			cast(void*)wrapper,
659 			cast(GClosureNotify)&callBackDragActionRequestedDestroy,
660 			connectFlags);
661 		return wrapper.handlerId;
662 	}
663 
664 	extern(C) static int callBackDragActionRequested(GtkPlacesSidebar* placessidebarStruct, GdkDragContext* context, GFile* destFile, GList* sourceFileList, OnDragActionRequestedDelegateWrapper wrapper)
665 	{
666 		return wrapper.dlg(ObjectG.getDObject!(DragContext)(context), ObjectG.getDObject!(FileIF)(destFile), new ListG(sourceFileList), wrapper.outer);
667 	}
668 
669 	extern(C) static void callBackDragActionRequestedDestroy(OnDragActionRequestedDelegateWrapper wrapper, GClosure* closure)
670 	{
671 		wrapper.remove(wrapper);
672 	}
673 
674 	protected class OnDragPerformDropDelegateWrapper
675 	{
676 		void delegate(FileIF, ListG, int, PlacesSidebar) dlg;
677 		gulong handlerId;
678 
679 		this(void delegate(FileIF, ListG, int, PlacesSidebar) dlg)
680 		{
681 			this.dlg = dlg;
682 			onDragPerformDropListeners ~= this;
683 		}
684 
685 		void remove(OnDragPerformDropDelegateWrapper source)
686 		{
687 			foreach(index, wrapper; onDragPerformDropListeners)
688 			{
689 				if (wrapper.handlerId == source.handlerId)
690 				{
691 					onDragPerformDropListeners[index] = null;
692 					onDragPerformDropListeners = std.algorithm.remove(onDragPerformDropListeners, index);
693 					break;
694 				}
695 			}
696 		}
697 	}
698 	OnDragPerformDropDelegateWrapper[] onDragPerformDropListeners;
699 
700 	/**
701 	 * The places sidebar emits this signal when the user completes a
702 	 * drag-and-drop operation and one of the sidebar's items is the
703 	 * destination.  This item is in the @dest_file, and the
704 	 * @source_file_list has the list of files that are dropped into it and
705 	 * which should be copied/moved/etc. based on the specified @action.
706 	 *
707 	 * Params:
708 	 *     destFile = Destination #GFile.
709 	 *     sourceFileList = #GList of #GFile that got dropped.
710 	 *     action = Drop action to perform.
711 	 *
712 	 * Since: 3.10
713 	 */
714 	gulong addOnDragPerformDrop(void delegate(FileIF, ListG, int, PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
715 	{
716 		auto wrapper = new OnDragPerformDropDelegateWrapper(dlg);
717 		wrapper.handlerId = Signals.connectData(
718 			this,
719 			"drag-perform-drop",
720 			cast(GCallback)&callBackDragPerformDrop,
721 			cast(void*)wrapper,
722 			cast(GClosureNotify)&callBackDragPerformDropDestroy,
723 			connectFlags);
724 		return wrapper.handlerId;
725 	}
726 
727 	extern(C) static void callBackDragPerformDrop(GtkPlacesSidebar* placessidebarStruct, GFile* destFile, GList* sourceFileList, int action, OnDragPerformDropDelegateWrapper wrapper)
728 	{
729 		wrapper.dlg(ObjectG.getDObject!(FileIF)(destFile), new ListG(sourceFileList), action, wrapper.outer);
730 	}
731 
732 	extern(C) static void callBackDragPerformDropDestroy(OnDragPerformDropDelegateWrapper wrapper, GClosure* closure)
733 	{
734 		wrapper.remove(wrapper);
735 	}
736 
737 	protected class OnMountDelegateWrapper
738 	{
739 		void delegate(MountOperation, PlacesSidebar) dlg;
740 		gulong handlerId;
741 
742 		this(void delegate(MountOperation, PlacesSidebar) dlg)
743 		{
744 			this.dlg = dlg;
745 			onMountListeners ~= this;
746 		}
747 
748 		void remove(OnMountDelegateWrapper source)
749 		{
750 			foreach(index, wrapper; onMountListeners)
751 			{
752 				if (wrapper.handlerId == source.handlerId)
753 				{
754 					onMountListeners[index] = null;
755 					onMountListeners = std.algorithm.remove(onMountListeners, index);
756 					break;
757 				}
758 			}
759 		}
760 	}
761 	OnMountDelegateWrapper[] onMountListeners;
762 
763 	/**
764 	 * The places sidebar emits this signal when it starts a new operation
765 	 * because the user clicked on some location that needs mounting.
766 	 * In this way the application using the #GtkPlacesSidebar can track the
767 	 * progress of the operation and, for example, show a notification.
768 	 *
769 	 * Params:
770 	 *     mountOperation = the #GMountOperation that is going to start.
771 	 *
772 	 * Since: 3.20
773 	 */
774 	gulong addOnMount(void delegate(MountOperation, PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
775 	{
776 		auto wrapper = new OnMountDelegateWrapper(dlg);
777 		wrapper.handlerId = Signals.connectData(
778 			this,
779 			"mount",
780 			cast(GCallback)&callBackMount,
781 			cast(void*)wrapper,
782 			cast(GClosureNotify)&callBackMountDestroy,
783 			connectFlags);
784 		return wrapper.handlerId;
785 	}
786 
787 	extern(C) static void callBackMount(GtkPlacesSidebar* placessidebarStruct, GMountOperation* mountOperation, OnMountDelegateWrapper wrapper)
788 	{
789 		wrapper.dlg(ObjectG.getDObject!(MountOperation)(mountOperation), wrapper.outer);
790 	}
791 
792 	extern(C) static void callBackMountDestroy(OnMountDelegateWrapper wrapper, GClosure* closure)
793 	{
794 		wrapper.remove(wrapper);
795 	}
796 
797 	protected class OnOpenLocationDelegateWrapper
798 	{
799 		void delegate(FileIF, GtkPlacesOpenFlags, PlacesSidebar) dlg;
800 		gulong handlerId;
801 
802 		this(void delegate(FileIF, GtkPlacesOpenFlags, PlacesSidebar) dlg)
803 		{
804 			this.dlg = dlg;
805 			onOpenLocationListeners ~= this;
806 		}
807 
808 		void remove(OnOpenLocationDelegateWrapper source)
809 		{
810 			foreach(index, wrapper; onOpenLocationListeners)
811 			{
812 				if (wrapper.handlerId == source.handlerId)
813 				{
814 					onOpenLocationListeners[index] = null;
815 					onOpenLocationListeners = std.algorithm.remove(onOpenLocationListeners, index);
816 					break;
817 				}
818 			}
819 		}
820 	}
821 	OnOpenLocationDelegateWrapper[] onOpenLocationListeners;
822 
823 	/**
824 	 * The places sidebar emits this signal when the user selects a location
825 	 * in it.  The calling application should display the contents of that
826 	 * location; for example, a file manager should show a list of files in
827 	 * the specified location.
828 	 *
829 	 * Params:
830 	 *     location = #GFile to which the caller should switch.
831 	 *     openFlags = a single value from #GtkPlacesOpenFlags specifying how the @location should be opened.
832 	 *
833 	 * Since: 3.10
834 	 */
835 	gulong addOnOpenLocation(void delegate(FileIF, GtkPlacesOpenFlags, PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
836 	{
837 		auto wrapper = new OnOpenLocationDelegateWrapper(dlg);
838 		wrapper.handlerId = Signals.connectData(
839 			this,
840 			"open-location",
841 			cast(GCallback)&callBackOpenLocation,
842 			cast(void*)wrapper,
843 			cast(GClosureNotify)&callBackOpenLocationDestroy,
844 			connectFlags);
845 		return wrapper.handlerId;
846 	}
847 
848 	extern(C) static void callBackOpenLocation(GtkPlacesSidebar* placessidebarStruct, GFile* location, GtkPlacesOpenFlags openFlags, OnOpenLocationDelegateWrapper wrapper)
849 	{
850 		wrapper.dlg(ObjectG.getDObject!(FileIF)(location), openFlags, wrapper.outer);
851 	}
852 
853 	extern(C) static void callBackOpenLocationDestroy(OnOpenLocationDelegateWrapper wrapper, GClosure* closure)
854 	{
855 		wrapper.remove(wrapper);
856 	}
857 
858 	protected class OnPopulatePopupDelegateWrapper
859 	{
860 		void delegate(Widget, FileIF, VolumeIF, PlacesSidebar) dlg;
861 		gulong handlerId;
862 
863 		this(void delegate(Widget, FileIF, VolumeIF, PlacesSidebar) dlg)
864 		{
865 			this.dlg = dlg;
866 			onPopulatePopupListeners ~= this;
867 		}
868 
869 		void remove(OnPopulatePopupDelegateWrapper source)
870 		{
871 			foreach(index, wrapper; onPopulatePopupListeners)
872 			{
873 				if (wrapper.handlerId == source.handlerId)
874 				{
875 					onPopulatePopupListeners[index] = null;
876 					onPopulatePopupListeners = std.algorithm.remove(onPopulatePopupListeners, index);
877 					break;
878 				}
879 			}
880 		}
881 	}
882 	OnPopulatePopupDelegateWrapper[] onPopulatePopupListeners;
883 
884 	/**
885 	 * The places sidebar emits this signal when the user invokes a contextual
886 	 * popup on one of its items. In the signal handler, the application may
887 	 * add extra items to the menu as appropriate. For example, a file manager
888 	 * may want to add a "Properties" command to the menu.
889 	 *
890 	 * It is not necessary to store the @selected_item for each menu item;
891 	 * during their callbacks, the application can use gtk_places_sidebar_get_location()
892 	 * to get the file to which the item refers.
893 	 *
894 	 * The @selected_item argument may be %NULL in case the selection refers to
895 	 * a volume. In this case, @selected_volume will be non-%NULL. In this case,
896 	 * the calling application will have to g_object_ref() the @selected_volume and
897 	 * keep it around to use it in the callback.
898 	 *
899 	 * The @container and all its contents are destroyed after the user
900 	 * dismisses the popup. The popup is re-created (and thus, this signal is
901 	 * emitted) every time the user activates the contextual menu.
902 	 *
903 	 * Before 3.18, the @container always was a #GtkMenu, and you were expected
904 	 * to add your items as #GtkMenuItems. Since 3.18, the popup may be implemented
905 	 * as a #GtkPopover, in which case @container will be something else, e.g. a
906 	 * #GtkBox, to which you may add #GtkModelButtons or other widgets, such as
907 	 * #GtkEntries, #GtkSpinButtons, etc. If your application can deal with this
908 	 * situation, you can set #GtkPlacesSidebar::populate-all to %TRUE to request
909 	 * that this signal is emitted for populating popovers as well.
910 	 *
911 	 * Params:
912 	 *     container = a #GtkMenu or another #GtkContainer
913 	 *     selectedItem = #GFile with the item to which the popup should refer, or #NULL in the case of a @selected_volume.
914 	 *     selectedVolume = #GVolume if the selected item is a volume, or #NULL if it is a file.
915 	 *
916 	 * Since: 3.10
917 	 */
918 	gulong addOnPopulatePopup(void delegate(Widget, FileIF, VolumeIF, PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
919 	{
920 		auto wrapper = new OnPopulatePopupDelegateWrapper(dlg);
921 		wrapper.handlerId = Signals.connectData(
922 			this,
923 			"populate-popup",
924 			cast(GCallback)&callBackPopulatePopup,
925 			cast(void*)wrapper,
926 			cast(GClosureNotify)&callBackPopulatePopupDestroy,
927 			connectFlags);
928 		return wrapper.handlerId;
929 	}
930 
931 	extern(C) static void callBackPopulatePopup(GtkPlacesSidebar* placessidebarStruct, GtkWidget* container, GFile* selectedItem, GVolume* selectedVolume, OnPopulatePopupDelegateWrapper wrapper)
932 	{
933 		wrapper.dlg(ObjectG.getDObject!(Widget)(container), ObjectG.getDObject!(FileIF)(selectedItem), ObjectG.getDObject!(VolumeIF)(selectedVolume), wrapper.outer);
934 	}
935 
936 	extern(C) static void callBackPopulatePopupDestroy(OnPopulatePopupDelegateWrapper wrapper, GClosure* closure)
937 	{
938 		wrapper.remove(wrapper);
939 	}
940 
941 	protected class OnShowConnectToServerDelegateWrapper
942 	{
943 		void delegate(PlacesSidebar) dlg;
944 		gulong handlerId;
945 
946 		this(void delegate(PlacesSidebar) dlg)
947 		{
948 			this.dlg = dlg;
949 			onShowConnectToServerListeners ~= this;
950 		}
951 
952 		void remove(OnShowConnectToServerDelegateWrapper source)
953 		{
954 			foreach(index, wrapper; onShowConnectToServerListeners)
955 			{
956 				if (wrapper.handlerId == source.handlerId)
957 				{
958 					onShowConnectToServerListeners[index] = null;
959 					onShowConnectToServerListeners = std.algorithm.remove(onShowConnectToServerListeners, index);
960 					break;
961 				}
962 			}
963 		}
964 	}
965 	OnShowConnectToServerDelegateWrapper[] onShowConnectToServerListeners;
966 
967 	/**
968 	 * The places sidebar emits this signal when it needs the calling
969 	 * application to present an way to connect directly to a network server.
970 	 * For example, the application may bring up a dialog box asking for
971 	 * a URL like "sftp://ftp.example.com".  It is up to the application to create
972 	 * the corresponding mount by using, for example, g_file_mount_enclosing_volume().
973 	 *
974 	 * Deprecated: use the #GtkPlacesSidebar::show-other-locations signal
975 	 * to connect to network servers.
976 	 */
977 	gulong addOnShowConnectToServer(void delegate(PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
978 	{
979 		auto wrapper = new OnShowConnectToServerDelegateWrapper(dlg);
980 		wrapper.handlerId = Signals.connectData(
981 			this,
982 			"show-connect-to-server",
983 			cast(GCallback)&callBackShowConnectToServer,
984 			cast(void*)wrapper,
985 			cast(GClosureNotify)&callBackShowConnectToServerDestroy,
986 			connectFlags);
987 		return wrapper.handlerId;
988 	}
989 
990 	extern(C) static void callBackShowConnectToServer(GtkPlacesSidebar* placessidebarStruct, OnShowConnectToServerDelegateWrapper wrapper)
991 	{
992 		wrapper.dlg(wrapper.outer);
993 	}
994 
995 	extern(C) static void callBackShowConnectToServerDestroy(OnShowConnectToServerDelegateWrapper wrapper, GClosure* closure)
996 	{
997 		wrapper.remove(wrapper);
998 	}
999 
1000 	protected class OnShowEnterLocationDelegateWrapper
1001 	{
1002 		void delegate(PlacesSidebar) dlg;
1003 		gulong handlerId;
1004 
1005 		this(void delegate(PlacesSidebar) dlg)
1006 		{
1007 			this.dlg = dlg;
1008 			onShowEnterLocationListeners ~= this;
1009 		}
1010 
1011 		void remove(OnShowEnterLocationDelegateWrapper source)
1012 		{
1013 			foreach(index, wrapper; onShowEnterLocationListeners)
1014 			{
1015 				if (wrapper.handlerId == source.handlerId)
1016 				{
1017 					onShowEnterLocationListeners[index] = null;
1018 					onShowEnterLocationListeners = std.algorithm.remove(onShowEnterLocationListeners, index);
1019 					break;
1020 				}
1021 			}
1022 		}
1023 	}
1024 	OnShowEnterLocationDelegateWrapper[] onShowEnterLocationListeners;
1025 
1026 	/**
1027 	 * The places sidebar emits this signal when it needs the calling
1028 	 * application to present an way to directly enter a location.
1029 	 * For example, the application may bring up a dialog box asking for
1030 	 * a URL like "http://http.example.com".
1031 	 *
1032 	 * Since: 3.14
1033 	 */
1034 	gulong addOnShowEnterLocation(void delegate(PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1035 	{
1036 		auto wrapper = new OnShowEnterLocationDelegateWrapper(dlg);
1037 		wrapper.handlerId = Signals.connectData(
1038 			this,
1039 			"show-enter-location",
1040 			cast(GCallback)&callBackShowEnterLocation,
1041 			cast(void*)wrapper,
1042 			cast(GClosureNotify)&callBackShowEnterLocationDestroy,
1043 			connectFlags);
1044 		return wrapper.handlerId;
1045 	}
1046 
1047 	extern(C) static void callBackShowEnterLocation(GtkPlacesSidebar* placessidebarStruct, OnShowEnterLocationDelegateWrapper wrapper)
1048 	{
1049 		wrapper.dlg(wrapper.outer);
1050 	}
1051 
1052 	extern(C) static void callBackShowEnterLocationDestroy(OnShowEnterLocationDelegateWrapper wrapper, GClosure* closure)
1053 	{
1054 		wrapper.remove(wrapper);
1055 	}
1056 
1057 	protected class OnShowErrorMessageDelegateWrapper
1058 	{
1059 		void delegate(string, string, PlacesSidebar) dlg;
1060 		gulong handlerId;
1061 
1062 		this(void delegate(string, string, PlacesSidebar) dlg)
1063 		{
1064 			this.dlg = dlg;
1065 			onShowErrorMessageListeners ~= this;
1066 		}
1067 
1068 		void remove(OnShowErrorMessageDelegateWrapper source)
1069 		{
1070 			foreach(index, wrapper; onShowErrorMessageListeners)
1071 			{
1072 				if (wrapper.handlerId == source.handlerId)
1073 				{
1074 					onShowErrorMessageListeners[index] = null;
1075 					onShowErrorMessageListeners = std.algorithm.remove(onShowErrorMessageListeners, index);
1076 					break;
1077 				}
1078 			}
1079 		}
1080 	}
1081 	OnShowErrorMessageDelegateWrapper[] onShowErrorMessageListeners;
1082 
1083 	/**
1084 	 * The places sidebar emits this signal when it needs the calling
1085 	 * application to present an error message.  Most of these messages
1086 	 * refer to mounting or unmounting media, for example, when a drive
1087 	 * cannot be started for some reason.
1088 	 *
1089 	 * Params:
1090 	 *     primary = primary message with a summary of the error to show.
1091 	 *     secondary = secondary message with details of the error to show.
1092 	 *
1093 	 * Since: 3.10
1094 	 */
1095 	gulong addOnShowErrorMessage(void delegate(string, string, PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1096 	{
1097 		auto wrapper = new OnShowErrorMessageDelegateWrapper(dlg);
1098 		wrapper.handlerId = Signals.connectData(
1099 			this,
1100 			"show-error-message",
1101 			cast(GCallback)&callBackShowErrorMessage,
1102 			cast(void*)wrapper,
1103 			cast(GClosureNotify)&callBackShowErrorMessageDestroy,
1104 			connectFlags);
1105 		return wrapper.handlerId;
1106 	}
1107 
1108 	extern(C) static void callBackShowErrorMessage(GtkPlacesSidebar* placessidebarStruct, char* primary, char* secondary, OnShowErrorMessageDelegateWrapper wrapper)
1109 	{
1110 		wrapper.dlg(Str.toString(primary), Str.toString(secondary), wrapper.outer);
1111 	}
1112 
1113 	extern(C) static void callBackShowErrorMessageDestroy(OnShowErrorMessageDelegateWrapper wrapper, GClosure* closure)
1114 	{
1115 		wrapper.remove(wrapper);
1116 	}
1117 
1118 	protected class OnShowOtherLocationsDelegateWrapper
1119 	{
1120 		void delegate(PlacesSidebar) dlg;
1121 		gulong handlerId;
1122 
1123 		this(void delegate(PlacesSidebar) dlg)
1124 		{
1125 			this.dlg = dlg;
1126 			onShowOtherLocationsListeners ~= this;
1127 		}
1128 
1129 		void remove(OnShowOtherLocationsDelegateWrapper source)
1130 		{
1131 			foreach(index, wrapper; onShowOtherLocationsListeners)
1132 			{
1133 				if (wrapper.handlerId == source.handlerId)
1134 				{
1135 					onShowOtherLocationsListeners[index] = null;
1136 					onShowOtherLocationsListeners = std.algorithm.remove(onShowOtherLocationsListeners, index);
1137 					break;
1138 				}
1139 			}
1140 		}
1141 	}
1142 	OnShowOtherLocationsDelegateWrapper[] onShowOtherLocationsListeners;
1143 
1144 	/**
1145 	 * The places sidebar emits this signal when it needs the calling
1146 	 * application to present a way to show other locations e.g. drives
1147 	 * and network access points.
1148 	 * For example, the application may bring up a page showing persistent
1149 	 * volumes and discovered network addresses.
1150 	 *
1151 	 * Deprecated: use the #GtkPlacesSidebar::show-other-locations-with-flags
1152 	 * which includes the open flags in order to allow the user to specify to open
1153 	 * in a new tab or window, in a similar way than #GtkPlacesSidebar::open-location
1154 	 *
1155 	 * Since: 3.18
1156 	 */
1157 	gulong addOnShowOtherLocations(void delegate(PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1158 	{
1159 		auto wrapper = new OnShowOtherLocationsDelegateWrapper(dlg);
1160 		wrapper.handlerId = Signals.connectData(
1161 			this,
1162 			"show-other-locations",
1163 			cast(GCallback)&callBackShowOtherLocations,
1164 			cast(void*)wrapper,
1165 			cast(GClosureNotify)&callBackShowOtherLocationsDestroy,
1166 			connectFlags);
1167 		return wrapper.handlerId;
1168 	}
1169 
1170 	extern(C) static void callBackShowOtherLocations(GtkPlacesSidebar* placessidebarStruct, OnShowOtherLocationsDelegateWrapper wrapper)
1171 	{
1172 		wrapper.dlg(wrapper.outer);
1173 	}
1174 
1175 	extern(C) static void callBackShowOtherLocationsDestroy(OnShowOtherLocationsDelegateWrapper wrapper, GClosure* closure)
1176 	{
1177 		wrapper.remove(wrapper);
1178 	}
1179 
1180 	protected class OnShowOtherLocationsWithFlagsDelegateWrapper
1181 	{
1182 		void delegate(GtkPlacesOpenFlags, PlacesSidebar) dlg;
1183 		gulong handlerId;
1184 
1185 		this(void delegate(GtkPlacesOpenFlags, PlacesSidebar) dlg)
1186 		{
1187 			this.dlg = dlg;
1188 			onShowOtherLocationsWithFlagsListeners ~= this;
1189 		}
1190 
1191 		void remove(OnShowOtherLocationsWithFlagsDelegateWrapper source)
1192 		{
1193 			foreach(index, wrapper; onShowOtherLocationsWithFlagsListeners)
1194 			{
1195 				if (wrapper.handlerId == source.handlerId)
1196 				{
1197 					onShowOtherLocationsWithFlagsListeners[index] = null;
1198 					onShowOtherLocationsWithFlagsListeners = std.algorithm.remove(onShowOtherLocationsWithFlagsListeners, index);
1199 					break;
1200 				}
1201 			}
1202 		}
1203 	}
1204 	OnShowOtherLocationsWithFlagsDelegateWrapper[] onShowOtherLocationsWithFlagsListeners;
1205 
1206 	/**
1207 	 * The places sidebar emits this signal when it needs the calling
1208 	 * application to present a way to show other locations e.g. drives
1209 	 * and network access points.
1210 	 * For example, the application may bring up a page showing persistent
1211 	 * volumes and discovered network addresses.
1212 	 *
1213 	 * Params:
1214 	 *     openFlags = a single value from #GtkPlacesOpenFlags specifying how it should be opened.
1215 	 *
1216 	 * Since: 3.20
1217 	 */
1218 	gulong addOnShowOtherLocationsWithFlags(void delegate(GtkPlacesOpenFlags, PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1219 	{
1220 		auto wrapper = new OnShowOtherLocationsWithFlagsDelegateWrapper(dlg);
1221 		wrapper.handlerId = Signals.connectData(
1222 			this,
1223 			"show-other-locations-with-flags",
1224 			cast(GCallback)&callBackShowOtherLocationsWithFlags,
1225 			cast(void*)wrapper,
1226 			cast(GClosureNotify)&callBackShowOtherLocationsWithFlagsDestroy,
1227 			connectFlags);
1228 		return wrapper.handlerId;
1229 	}
1230 
1231 	extern(C) static void callBackShowOtherLocationsWithFlags(GtkPlacesSidebar* placessidebarStruct, GtkPlacesOpenFlags openFlags, OnShowOtherLocationsWithFlagsDelegateWrapper wrapper)
1232 	{
1233 		wrapper.dlg(openFlags, wrapper.outer);
1234 	}
1235 
1236 	extern(C) static void callBackShowOtherLocationsWithFlagsDestroy(OnShowOtherLocationsWithFlagsDelegateWrapper wrapper, GClosure* closure)
1237 	{
1238 		wrapper.remove(wrapper);
1239 	}
1240 
1241 	protected class OnUnmountDelegateWrapper
1242 	{
1243 		void delegate(MountOperation, PlacesSidebar) dlg;
1244 		gulong handlerId;
1245 
1246 		this(void delegate(MountOperation, PlacesSidebar) dlg)
1247 		{
1248 			this.dlg = dlg;
1249 			onUnmountListeners ~= this;
1250 		}
1251 
1252 		void remove(OnUnmountDelegateWrapper source)
1253 		{
1254 			foreach(index, wrapper; onUnmountListeners)
1255 			{
1256 				if (wrapper.handlerId == source.handlerId)
1257 				{
1258 					onUnmountListeners[index] = null;
1259 					onUnmountListeners = std.algorithm.remove(onUnmountListeners, index);
1260 					break;
1261 				}
1262 			}
1263 		}
1264 	}
1265 	OnUnmountDelegateWrapper[] onUnmountListeners;
1266 
1267 	/**
1268 	 * The places sidebar emits this signal when it starts a new operation
1269 	 * because the user for example ejected some drive or unmounted a mount.
1270 	 * In this way the application using the #GtkPlacesSidebar can track the
1271 	 * progress of the operation and, for example, show a notification.
1272 	 *
1273 	 * Params:
1274 	 *     mountOperation = the #GMountOperation that is going to start.
1275 	 *
1276 	 * Since: 3.20
1277 	 */
1278 	gulong addOnUnmount(void delegate(MountOperation, PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1279 	{
1280 		auto wrapper = new OnUnmountDelegateWrapper(dlg);
1281 		wrapper.handlerId = Signals.connectData(
1282 			this,
1283 			"unmount",
1284 			cast(GCallback)&callBackUnmount,
1285 			cast(void*)wrapper,
1286 			cast(GClosureNotify)&callBackUnmountDestroy,
1287 			connectFlags);
1288 		return wrapper.handlerId;
1289 	}
1290 
1291 	extern(C) static void callBackUnmount(GtkPlacesSidebar* placessidebarStruct, GMountOperation* mountOperation, OnUnmountDelegateWrapper wrapper)
1292 	{
1293 		wrapper.dlg(ObjectG.getDObject!(MountOperation)(mountOperation), wrapper.outer);
1294 	}
1295 
1296 	extern(C) static void callBackUnmountDestroy(OnUnmountDelegateWrapper wrapper, GClosure* closure)
1297 	{
1298 		wrapper.remove(wrapper);
1299 	}
1300 }