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.File;
29 private import gio.FileIF;
30 private import gio.MountOperation;
31 private import gio.Volume;
32 private import gio.VolumeIF;
33 private import glib.ConstructionException;
34 private import glib.ListG;
35 private import glib.ListSG;
36 private import glib.Str;
37 private import gobject.ObjectG;
38 private import gobject.Signals;
39 private import gtk.ScrolledWindow;
40 private import gtk.Widget;
41 public  import gtkc.gdktypes;
42 private import gtkc.gtk;
43 public  import gtkc.gtktypes;
44 private import std.algorithm;
45 
46 
47 /**
48  * #GtkPlacesSidebar is a widget that displays a list of frequently-used places in the
49  * file system:  the user’s home directory, the user’s bookmarks, and volumes and drives.
50  * This widget is used as a sidebar in #GtkFileChooser and may be used by file managers
51  * and similar programs.
52  * 
53  * The places sidebar displays drives and volumes, and will automatically mount
54  * or unmount them when the user selects them.
55  * 
56  * Applications can hook to various signals in the places sidebar to customize
57  * its behavior.  For example, they can add extra commands to the context menu
58  * of the sidebar.
59  * 
60  * While bookmarks are completely in control of the user, the places sidebar also
61  * allows individual applications to provide extra shortcut folders that are unique
62  * to each application.  For example, a Paint program may want to add a shortcut
63  * for a Clipart folder.  You can do this with gtk_places_sidebar_add_shortcut().
64  * 
65  * To make use of the places sidebar, an application at least needs to connect
66  * to the #GtkPlacesSidebar::open-location signal.  This is emitted when the
67  * user selects in the sidebar a location to open.  The application should also
68  * call gtk_places_sidebar_set_location() when it changes the currently-viewed
69  * location.
70  * 
71  * # CSS nodes
72  * 
73  * GtkPlacesSidebar uses a single CSS node with name placesidebar and style
74  * class .sidebar.
75  * 
76  * Among the children of the places sidebar, the following style classes can
77  * be used:
78  * - .sidebar-new-bookmark-row for the 'Add new bookmark' row
79  * - .sidebar-placeholder-row for a row that is a placeholder
80  * - .has-open-popup when a popup is open for a row
81  */
82 public class PlacesSidebar : ScrolledWindow
83 {
84 	/** the main Gtk struct */
85 	protected GtkPlacesSidebar* gtkPlacesSidebar;
86 
87 	/** Get the main Gtk struct */
88 	public GtkPlacesSidebar* getPlacesSidebarStruct()
89 	{
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 	 * Return: 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 	 * Return: %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 	 * Return: 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!(File, 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 	 * Return: 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!(File, FileIF)(cast(GFile*) p, true);
232 	}
233 
234 	/**
235 	 * Gets the open flags.
236 	 *
237 	 * Return: 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 	 * Return: %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 	 * Return: %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 	 * Return: %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 	 * Return: %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 	 * Return: %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 	 * Return: %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 	 * Return: 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 		ConnectFlags flags;
547 		this(int delegate(int, PlacesSidebar) dlg, gulong handlerId, ConnectFlags flags)
548 		{
549 			this.dlg = dlg;
550 			this.handlerId = handlerId;
551 			this.flags = flags;
552 		}
553 	}
554 	protected OnDragActionAskDelegateWrapper[] onDragActionAskListeners;
555 
556 	/**
557 	 * The places sidebar emits this signal when it needs to ask the application
558 	 * to pop up a menu to ask the user for which drag action to perform.
559 	 *
560 	 * Params:
561 	 *     actions = Possible drag actions that need to be asked for.
562 	 *
563 	 * Return: the final drag action that the sidebar should pass to the drag side
564 	 *     of the drag-and-drop operation.
565 	 *
566 	 * Since: 3.10
567 	 */
568 	gulong addOnDragActionAsk(int delegate(int, PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
569 	{
570 		onDragActionAskListeners ~= new OnDragActionAskDelegateWrapper(dlg, 0, connectFlags);
571 		onDragActionAskListeners[onDragActionAskListeners.length - 1].handlerId = Signals.connectData(
572 			this,
573 			"drag-action-ask",
574 			cast(GCallback)&callBackDragActionAsk,
575 			cast(void*)onDragActionAskListeners[onDragActionAskListeners.length - 1],
576 			cast(GClosureNotify)&callBackDragActionAskDestroy,
577 			connectFlags);
578 		return onDragActionAskListeners[onDragActionAskListeners.length - 1].handlerId;
579 	}
580 	
581 	extern(C) static int callBackDragActionAsk(GtkPlacesSidebar* placessidebarStruct, int actions,OnDragActionAskDelegateWrapper wrapper)
582 	{
583 		return wrapper.dlg(actions, wrapper.outer);
584 	}
585 	
586 	extern(C) static void callBackDragActionAskDestroy(OnDragActionAskDelegateWrapper wrapper, GClosure* closure)
587 	{
588 		wrapper.outer.internalRemoveOnDragActionAsk(wrapper);
589 	}
590 
591 	protected void internalRemoveOnDragActionAsk(OnDragActionAskDelegateWrapper source)
592 	{
593 		foreach(index, wrapper; onDragActionAskListeners)
594 		{
595 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
596 			{
597 				onDragActionAskListeners[index] = null;
598 				onDragActionAskListeners = std.algorithm.remove(onDragActionAskListeners, index);
599 				break;
600 			}
601 		}
602 	}
603 	
604 
605 	protected class OnDragActionRequestedDelegateWrapper
606 	{
607 		int delegate(DragContext, FileIF, ListG, PlacesSidebar) dlg;
608 		gulong handlerId;
609 		ConnectFlags flags;
610 		this(int delegate(DragContext, FileIF, ListG, PlacesSidebar) dlg, gulong handlerId, ConnectFlags flags)
611 		{
612 			this.dlg = dlg;
613 			this.handlerId = handlerId;
614 			this.flags = flags;
615 		}
616 	}
617 	protected OnDragActionRequestedDelegateWrapper[] onDragActionRequestedListeners;
618 
619 	/**
620 	 * When the user starts a drag-and-drop operation and the sidebar needs
621 	 * to ask the application for which drag action to perform, then the
622 	 * sidebar will emit this signal.
623 	 *
624 	 * The application can evaluate the @context for customary actions, or
625 	 * it can check the type of the files indicated by @source_file_list against the
626 	 * possible actions for the destination @dest_file.
627 	 *
628 	 * The drag action to use must be the return value of the signal handler.
629 	 *
630 	 * Params:
631 	 *     context = #GdkDragContext with information about the drag operation
632 	 *     destFile = #GFile with the tentative location that is being hovered for a drop
633 	 *     sourceFileList = List of #GFile that are being dragged
634 	 *
635 	 * Return: The drag action to use, for example, #GDK_ACTION_COPY
636 	 *     or #GDK_ACTION_MOVE, or 0 if no action is allowed here (i.e. drops
637 	 *     are not allowed in the specified @dest_file).
638 	 *
639 	 * Since: 3.10
640 	 */
641 	gulong addOnDragActionRequested(int delegate(DragContext, FileIF, ListG, PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
642 	{
643 		onDragActionRequestedListeners ~= new OnDragActionRequestedDelegateWrapper(dlg, 0, connectFlags);
644 		onDragActionRequestedListeners[onDragActionRequestedListeners.length - 1].handlerId = Signals.connectData(
645 			this,
646 			"drag-action-requested",
647 			cast(GCallback)&callBackDragActionRequested,
648 			cast(void*)onDragActionRequestedListeners[onDragActionRequestedListeners.length - 1],
649 			cast(GClosureNotify)&callBackDragActionRequestedDestroy,
650 			connectFlags);
651 		return onDragActionRequestedListeners[onDragActionRequestedListeners.length - 1].handlerId;
652 	}
653 	
654 	extern(C) static int callBackDragActionRequested(GtkPlacesSidebar* placessidebarStruct, GdkDragContext* context, GFile* destFile, GList* sourceFileList,OnDragActionRequestedDelegateWrapper wrapper)
655 	{
656 		return wrapper.dlg(ObjectG.getDObject!(DragContext)(context), ObjectG.getDObject!(File, FileIF)(destFile), new ListG(sourceFileList), wrapper.outer);
657 	}
658 	
659 	extern(C) static void callBackDragActionRequestedDestroy(OnDragActionRequestedDelegateWrapper wrapper, GClosure* closure)
660 	{
661 		wrapper.outer.internalRemoveOnDragActionRequested(wrapper);
662 	}
663 
664 	protected void internalRemoveOnDragActionRequested(OnDragActionRequestedDelegateWrapper source)
665 	{
666 		foreach(index, wrapper; onDragActionRequestedListeners)
667 		{
668 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
669 			{
670 				onDragActionRequestedListeners[index] = null;
671 				onDragActionRequestedListeners = std.algorithm.remove(onDragActionRequestedListeners, index);
672 				break;
673 			}
674 		}
675 	}
676 	
677 
678 	protected class OnDragPerformDropDelegateWrapper
679 	{
680 		void delegate(FileIF, ListG, int, PlacesSidebar) dlg;
681 		gulong handlerId;
682 		ConnectFlags flags;
683 		this(void delegate(FileIF, ListG, int, PlacesSidebar) dlg, gulong handlerId, ConnectFlags flags)
684 		{
685 			this.dlg = dlg;
686 			this.handlerId = handlerId;
687 			this.flags = flags;
688 		}
689 	}
690 	protected OnDragPerformDropDelegateWrapper[] onDragPerformDropListeners;
691 
692 	/**
693 	 * The places sidebar emits this signal when the user completes a
694 	 * drag-and-drop operation and one of the sidebar's items is the
695 	 * destination.  This item is in the @dest_file, and the
696 	 * @source_file_list has the list of files that are dropped into it and
697 	 * which should be copied/moved/etc. based on the specified @action.
698 	 *
699 	 * Params:
700 	 *     destFile = Destination #GFile.
701 	 *     sourceFileList = #GList of #GFile that got dropped.
702 	 *     action = Drop action to perform.
703 	 *
704 	 * Since: 3.10
705 	 */
706 	gulong addOnDragPerformDrop(void delegate(FileIF, ListG, int, PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
707 	{
708 		onDragPerformDropListeners ~= new OnDragPerformDropDelegateWrapper(dlg, 0, connectFlags);
709 		onDragPerformDropListeners[onDragPerformDropListeners.length - 1].handlerId = Signals.connectData(
710 			this,
711 			"drag-perform-drop",
712 			cast(GCallback)&callBackDragPerformDrop,
713 			cast(void*)onDragPerformDropListeners[onDragPerformDropListeners.length - 1],
714 			cast(GClosureNotify)&callBackDragPerformDropDestroy,
715 			connectFlags);
716 		return onDragPerformDropListeners[onDragPerformDropListeners.length - 1].handlerId;
717 	}
718 	
719 	extern(C) static void callBackDragPerformDrop(GtkPlacesSidebar* placessidebarStruct, GFile* destFile, GList* sourceFileList, int action,OnDragPerformDropDelegateWrapper wrapper)
720 	{
721 		wrapper.dlg(ObjectG.getDObject!(File, FileIF)(destFile), new ListG(sourceFileList), action, wrapper.outer);
722 	}
723 	
724 	extern(C) static void callBackDragPerformDropDestroy(OnDragPerformDropDelegateWrapper wrapper, GClosure* closure)
725 	{
726 		wrapper.outer.internalRemoveOnDragPerformDrop(wrapper);
727 	}
728 
729 	protected void internalRemoveOnDragPerformDrop(OnDragPerformDropDelegateWrapper source)
730 	{
731 		foreach(index, wrapper; onDragPerformDropListeners)
732 		{
733 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
734 			{
735 				onDragPerformDropListeners[index] = null;
736 				onDragPerformDropListeners = std.algorithm.remove(onDragPerformDropListeners, index);
737 				break;
738 			}
739 		}
740 	}
741 	
742 
743 	protected class OnMountDelegateWrapper
744 	{
745 		void delegate(MountOperation, PlacesSidebar) dlg;
746 		gulong handlerId;
747 		ConnectFlags flags;
748 		this(void delegate(MountOperation, PlacesSidebar) dlg, gulong handlerId, ConnectFlags flags)
749 		{
750 			this.dlg = dlg;
751 			this.handlerId = handlerId;
752 			this.flags = flags;
753 		}
754 	}
755 	protected OnMountDelegateWrapper[] onMountListeners;
756 
757 	/**
758 	 * The places sidebar emits this signal when it starts a new operation
759 	 * because the user clicked on some location that needs mounting.
760 	 * In this way the application using the #GtkPlacesSidebar can track the
761 	 * progress of the operation and, for example, show a notification.
762 	 *
763 	 * Params:
764 	 *     mountOperation = the #GMountOperation that is going to start.
765 	 *
766 	 * Since: 3.20
767 	 */
768 	gulong addOnMount(void delegate(MountOperation, PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
769 	{
770 		onMountListeners ~= new OnMountDelegateWrapper(dlg, 0, connectFlags);
771 		onMountListeners[onMountListeners.length - 1].handlerId = Signals.connectData(
772 			this,
773 			"mount",
774 			cast(GCallback)&callBackMount,
775 			cast(void*)onMountListeners[onMountListeners.length - 1],
776 			cast(GClosureNotify)&callBackMountDestroy,
777 			connectFlags);
778 		return onMountListeners[onMountListeners.length - 1].handlerId;
779 	}
780 	
781 	extern(C) static void callBackMount(GtkPlacesSidebar* placessidebarStruct, GMountOperation* mountOperation,OnMountDelegateWrapper wrapper)
782 	{
783 		wrapper.dlg(ObjectG.getDObject!(MountOperation)(mountOperation), wrapper.outer);
784 	}
785 	
786 	extern(C) static void callBackMountDestroy(OnMountDelegateWrapper wrapper, GClosure* closure)
787 	{
788 		wrapper.outer.internalRemoveOnMount(wrapper);
789 	}
790 
791 	protected void internalRemoveOnMount(OnMountDelegateWrapper source)
792 	{
793 		foreach(index, wrapper; onMountListeners)
794 		{
795 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
796 			{
797 				onMountListeners[index] = null;
798 				onMountListeners = std.algorithm.remove(onMountListeners, index);
799 				break;
800 			}
801 		}
802 	}
803 	
804 
805 	protected class OnOpenLocationDelegateWrapper
806 	{
807 		void delegate(FileIF, GtkPlacesOpenFlags, PlacesSidebar) dlg;
808 		gulong handlerId;
809 		ConnectFlags flags;
810 		this(void delegate(FileIF, GtkPlacesOpenFlags, PlacesSidebar) dlg, gulong handlerId, ConnectFlags flags)
811 		{
812 			this.dlg = dlg;
813 			this.handlerId = handlerId;
814 			this.flags = flags;
815 		}
816 	}
817 	protected OnOpenLocationDelegateWrapper[] onOpenLocationListeners;
818 
819 	/**
820 	 * The places sidebar emits this signal when the user selects a location
821 	 * in it.  The calling application should display the contents of that
822 	 * location; for example, a file manager should show a list of files in
823 	 * the specified location.
824 	 *
825 	 * Params:
826 	 *     location = #GFile to which the caller should switch.
827 	 *     openFlags = a single value from #GtkPlacesOpenFlags specifying how the @location should be opened.
828 	 *
829 	 * Since: 3.10
830 	 */
831 	gulong addOnOpenLocation(void delegate(FileIF, GtkPlacesOpenFlags, PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
832 	{
833 		onOpenLocationListeners ~= new OnOpenLocationDelegateWrapper(dlg, 0, connectFlags);
834 		onOpenLocationListeners[onOpenLocationListeners.length - 1].handlerId = Signals.connectData(
835 			this,
836 			"open-location",
837 			cast(GCallback)&callBackOpenLocation,
838 			cast(void*)onOpenLocationListeners[onOpenLocationListeners.length - 1],
839 			cast(GClosureNotify)&callBackOpenLocationDestroy,
840 			connectFlags);
841 		return onOpenLocationListeners[onOpenLocationListeners.length - 1].handlerId;
842 	}
843 	
844 	extern(C) static void callBackOpenLocation(GtkPlacesSidebar* placessidebarStruct, GFile* location, GtkPlacesOpenFlags openFlags,OnOpenLocationDelegateWrapper wrapper)
845 	{
846 		wrapper.dlg(ObjectG.getDObject!(File, FileIF)(location), openFlags, wrapper.outer);
847 	}
848 	
849 	extern(C) static void callBackOpenLocationDestroy(OnOpenLocationDelegateWrapper wrapper, GClosure* closure)
850 	{
851 		wrapper.outer.internalRemoveOnOpenLocation(wrapper);
852 	}
853 
854 	protected void internalRemoveOnOpenLocation(OnOpenLocationDelegateWrapper source)
855 	{
856 		foreach(index, wrapper; onOpenLocationListeners)
857 		{
858 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
859 			{
860 				onOpenLocationListeners[index] = null;
861 				onOpenLocationListeners = std.algorithm.remove(onOpenLocationListeners, index);
862 				break;
863 			}
864 		}
865 	}
866 	
867 
868 	protected class OnPopulatePopupDelegateWrapper
869 	{
870 		void delegate(Widget, FileIF, VolumeIF, PlacesSidebar) dlg;
871 		gulong handlerId;
872 		ConnectFlags flags;
873 		this(void delegate(Widget, FileIF, VolumeIF, PlacesSidebar) dlg, gulong handlerId, ConnectFlags flags)
874 		{
875 			this.dlg = dlg;
876 			this.handlerId = handlerId;
877 			this.flags = flags;
878 		}
879 	}
880 	protected OnPopulatePopupDelegateWrapper[] onPopulatePopupListeners;
881 
882 	/**
883 	 * The places sidebar emits this signal when the user invokes a contextual
884 	 * popup on one of its items. In the signal handler, the application may
885 	 * add extra items to the menu as appropriate. For example, a file manager
886 	 * may want to add a "Properties" command to the menu.
887 	 *
888 	 * It is not necessary to store the @selected_item for each menu item;
889 	 * during their callbacks, the application can use gtk_places_sidebar_get_location()
890 	 * to get the file to which the item refers.
891 	 *
892 	 * The @selected_item argument may be %NULL in case the selection refers to
893 	 * a volume. In this case, @selected_volume will be non-%NULL. In this case,
894 	 * the calling application will have to g_object_ref() the @selected_volume and
895 	 * keep it around to use it in the callback.
896 	 *
897 	 * The @container and all its contents are destroyed after the user
898 	 * dismisses the popup. The popup is re-created (and thus, this signal is
899 	 * emitted) every time the user activates the contextual menu.
900 	 *
901 	 * Before 3.18, the @container always was a #GtkMenu, and you were expected
902 	 * to add your items as #GtkMenuItems. Since 3.18, the popup may be implemented
903 	 * as a #GtkPopover, in which case @container will be something else, e.g. a
904 	 * #GtkBox, to which you may add #GtkModelButtons or other widgets, such as
905 	 * #GtkEntries, #GtkSpinButtons, etc. If your application can deal with this
906 	 * situation, you can set #GtkPlacesSidebar::populate-all to %TRUE to request
907 	 * that this signal is emitted for populating popovers as well.
908 	 *
909 	 * Params:
910 	 *     container = a #GtkMenu or another #GtkContainer
911 	 *     selectedItem = #GFile with the item to which the popup should refer, or #NULL in the case of a @selected_volume.
912 	 *     selectedVolume = #GVolume if the selected item is a volume, or #NULL if it is a file.
913 	 *
914 	 * Since: 3.10
915 	 */
916 	gulong addOnPopulatePopup(void delegate(Widget, FileIF, VolumeIF, PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
917 	{
918 		onPopulatePopupListeners ~= new OnPopulatePopupDelegateWrapper(dlg, 0, connectFlags);
919 		onPopulatePopupListeners[onPopulatePopupListeners.length - 1].handlerId = Signals.connectData(
920 			this,
921 			"populate-popup",
922 			cast(GCallback)&callBackPopulatePopup,
923 			cast(void*)onPopulatePopupListeners[onPopulatePopupListeners.length - 1],
924 			cast(GClosureNotify)&callBackPopulatePopupDestroy,
925 			connectFlags);
926 		return onPopulatePopupListeners[onPopulatePopupListeners.length - 1].handlerId;
927 	}
928 	
929 	extern(C) static void callBackPopulatePopup(GtkPlacesSidebar* placessidebarStruct, GtkWidget* container, GFile* selectedItem, GVolume* selectedVolume,OnPopulatePopupDelegateWrapper wrapper)
930 	{
931 		wrapper.dlg(ObjectG.getDObject!(Widget)(container), ObjectG.getDObject!(File, FileIF)(selectedItem), ObjectG.getDObject!(Volume, VolumeIF)(selectedVolume), wrapper.outer);
932 	}
933 	
934 	extern(C) static void callBackPopulatePopupDestroy(OnPopulatePopupDelegateWrapper wrapper, GClosure* closure)
935 	{
936 		wrapper.outer.internalRemoveOnPopulatePopup(wrapper);
937 	}
938 
939 	protected void internalRemoveOnPopulatePopup(OnPopulatePopupDelegateWrapper source)
940 	{
941 		foreach(index, wrapper; onPopulatePopupListeners)
942 		{
943 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
944 			{
945 				onPopulatePopupListeners[index] = null;
946 				onPopulatePopupListeners = std.algorithm.remove(onPopulatePopupListeners, index);
947 				break;
948 			}
949 		}
950 	}
951 	
952 
953 	protected class OnShowConnectToServerDelegateWrapper
954 	{
955 		void delegate(PlacesSidebar) dlg;
956 		gulong handlerId;
957 		ConnectFlags flags;
958 		this(void delegate(PlacesSidebar) dlg, gulong handlerId, ConnectFlags flags)
959 		{
960 			this.dlg = dlg;
961 			this.handlerId = handlerId;
962 			this.flags = flags;
963 		}
964 	}
965 	protected 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 		onShowConnectToServerListeners ~= new OnShowConnectToServerDelegateWrapper(dlg, 0, connectFlags);
980 		onShowConnectToServerListeners[onShowConnectToServerListeners.length - 1].handlerId = Signals.connectData(
981 			this,
982 			"show-connect-to-server",
983 			cast(GCallback)&callBackShowConnectToServer,
984 			cast(void*)onShowConnectToServerListeners[onShowConnectToServerListeners.length - 1],
985 			cast(GClosureNotify)&callBackShowConnectToServerDestroy,
986 			connectFlags);
987 		return onShowConnectToServerListeners[onShowConnectToServerListeners.length - 1].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.outer.internalRemoveOnShowConnectToServer(wrapper);
998 	}
999 
1000 	protected void internalRemoveOnShowConnectToServer(OnShowConnectToServerDelegateWrapper source)
1001 	{
1002 		foreach(index, wrapper; onShowConnectToServerListeners)
1003 		{
1004 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
1005 			{
1006 				onShowConnectToServerListeners[index] = null;
1007 				onShowConnectToServerListeners = std.algorithm.remove(onShowConnectToServerListeners, index);
1008 				break;
1009 			}
1010 		}
1011 	}
1012 	
1013 
1014 	protected class OnShowEnterLocationDelegateWrapper
1015 	{
1016 		void delegate(PlacesSidebar) dlg;
1017 		gulong handlerId;
1018 		ConnectFlags flags;
1019 		this(void delegate(PlacesSidebar) dlg, gulong handlerId, ConnectFlags flags)
1020 		{
1021 			this.dlg = dlg;
1022 			this.handlerId = handlerId;
1023 			this.flags = flags;
1024 		}
1025 	}
1026 	protected OnShowEnterLocationDelegateWrapper[] onShowEnterLocationListeners;
1027 
1028 	/**
1029 	 * The places sidebar emits this signal when it needs the calling
1030 	 * application to present an way to directly enter a location.
1031 	 * For example, the application may bring up a dialog box asking for
1032 	 * a URL like "http://http.example.com".
1033 	 *
1034 	 * Since: 3.14
1035 	 */
1036 	gulong addOnShowEnterLocation(void delegate(PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1037 	{
1038 		onShowEnterLocationListeners ~= new OnShowEnterLocationDelegateWrapper(dlg, 0, connectFlags);
1039 		onShowEnterLocationListeners[onShowEnterLocationListeners.length - 1].handlerId = Signals.connectData(
1040 			this,
1041 			"show-enter-location",
1042 			cast(GCallback)&callBackShowEnterLocation,
1043 			cast(void*)onShowEnterLocationListeners[onShowEnterLocationListeners.length - 1],
1044 			cast(GClosureNotify)&callBackShowEnterLocationDestroy,
1045 			connectFlags);
1046 		return onShowEnterLocationListeners[onShowEnterLocationListeners.length - 1].handlerId;
1047 	}
1048 	
1049 	extern(C) static void callBackShowEnterLocation(GtkPlacesSidebar* placessidebarStruct,OnShowEnterLocationDelegateWrapper wrapper)
1050 	{
1051 		wrapper.dlg(wrapper.outer);
1052 	}
1053 	
1054 	extern(C) static void callBackShowEnterLocationDestroy(OnShowEnterLocationDelegateWrapper wrapper, GClosure* closure)
1055 	{
1056 		wrapper.outer.internalRemoveOnShowEnterLocation(wrapper);
1057 	}
1058 
1059 	protected void internalRemoveOnShowEnterLocation(OnShowEnterLocationDelegateWrapper source)
1060 	{
1061 		foreach(index, wrapper; onShowEnterLocationListeners)
1062 		{
1063 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
1064 			{
1065 				onShowEnterLocationListeners[index] = null;
1066 				onShowEnterLocationListeners = std.algorithm.remove(onShowEnterLocationListeners, index);
1067 				break;
1068 			}
1069 		}
1070 	}
1071 	
1072 
1073 	protected class OnShowErrorMessageDelegateWrapper
1074 	{
1075 		void delegate(string, string, PlacesSidebar) dlg;
1076 		gulong handlerId;
1077 		ConnectFlags flags;
1078 		this(void delegate(string, string, PlacesSidebar) dlg, gulong handlerId, ConnectFlags flags)
1079 		{
1080 			this.dlg = dlg;
1081 			this.handlerId = handlerId;
1082 			this.flags = flags;
1083 		}
1084 	}
1085 	protected OnShowErrorMessageDelegateWrapper[] onShowErrorMessageListeners;
1086 
1087 	/**
1088 	 * The places sidebar emits this signal when it needs the calling
1089 	 * application to present an error message.  Most of these messages
1090 	 * refer to mounting or unmounting media, for example, when a drive
1091 	 * cannot be started for some reason.
1092 	 *
1093 	 * Params:
1094 	 *     primary = primary message with a summary of the error to show.
1095 	 *     secondary = secondary message with details of the error to show.
1096 	 *
1097 	 * Since: 3.10
1098 	 */
1099 	gulong addOnShowErrorMessage(void delegate(string, string, PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1100 	{
1101 		onShowErrorMessageListeners ~= new OnShowErrorMessageDelegateWrapper(dlg, 0, connectFlags);
1102 		onShowErrorMessageListeners[onShowErrorMessageListeners.length - 1].handlerId = Signals.connectData(
1103 			this,
1104 			"show-error-message",
1105 			cast(GCallback)&callBackShowErrorMessage,
1106 			cast(void*)onShowErrorMessageListeners[onShowErrorMessageListeners.length - 1],
1107 			cast(GClosureNotify)&callBackShowErrorMessageDestroy,
1108 			connectFlags);
1109 		return onShowErrorMessageListeners[onShowErrorMessageListeners.length - 1].handlerId;
1110 	}
1111 	
1112 	extern(C) static void callBackShowErrorMessage(GtkPlacesSidebar* placessidebarStruct, char* primary, char* secondary,OnShowErrorMessageDelegateWrapper wrapper)
1113 	{
1114 		wrapper.dlg(Str.toString(primary), Str.toString(secondary), wrapper.outer);
1115 	}
1116 	
1117 	extern(C) static void callBackShowErrorMessageDestroy(OnShowErrorMessageDelegateWrapper wrapper, GClosure* closure)
1118 	{
1119 		wrapper.outer.internalRemoveOnShowErrorMessage(wrapper);
1120 	}
1121 
1122 	protected void internalRemoveOnShowErrorMessage(OnShowErrorMessageDelegateWrapper source)
1123 	{
1124 		foreach(index, wrapper; onShowErrorMessageListeners)
1125 		{
1126 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
1127 			{
1128 				onShowErrorMessageListeners[index] = null;
1129 				onShowErrorMessageListeners = std.algorithm.remove(onShowErrorMessageListeners, index);
1130 				break;
1131 			}
1132 		}
1133 	}
1134 	
1135 
1136 	protected class OnShowOtherLocationsDelegateWrapper
1137 	{
1138 		void delegate(PlacesSidebar) dlg;
1139 		gulong handlerId;
1140 		ConnectFlags flags;
1141 		this(void delegate(PlacesSidebar) dlg, gulong handlerId, ConnectFlags flags)
1142 		{
1143 			this.dlg = dlg;
1144 			this.handlerId = handlerId;
1145 			this.flags = flags;
1146 		}
1147 	}
1148 	protected OnShowOtherLocationsDelegateWrapper[] onShowOtherLocationsListeners;
1149 
1150 	/**
1151 	 * The places sidebar emits this signal when it needs the calling
1152 	 * application to present a way to show other locations e.g. drives
1153 	 * and network access points.
1154 	 * For example, the application may bring up a page showing persistent
1155 	 * volumes and discovered network addresses.
1156 	 *
1157 	 * Deprecated: use the #GtkPlacesSidebar::show-other-locations-with-flags
1158 	 * which includes the open flags in order to allow the user to specify to open
1159 	 * in a new tab or window, in a similar way than #GtkPlacesSidebar::open-location
1160 	 *
1161 	 * Since: 3.18
1162 	 */
1163 	gulong addOnShowOtherLocations(void delegate(PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1164 	{
1165 		onShowOtherLocationsListeners ~= new OnShowOtherLocationsDelegateWrapper(dlg, 0, connectFlags);
1166 		onShowOtherLocationsListeners[onShowOtherLocationsListeners.length - 1].handlerId = Signals.connectData(
1167 			this,
1168 			"show-other-locations",
1169 			cast(GCallback)&callBackShowOtherLocations,
1170 			cast(void*)onShowOtherLocationsListeners[onShowOtherLocationsListeners.length - 1],
1171 			cast(GClosureNotify)&callBackShowOtherLocationsDestroy,
1172 			connectFlags);
1173 		return onShowOtherLocationsListeners[onShowOtherLocationsListeners.length - 1].handlerId;
1174 	}
1175 	
1176 	extern(C) static void callBackShowOtherLocations(GtkPlacesSidebar* placessidebarStruct,OnShowOtherLocationsDelegateWrapper wrapper)
1177 	{
1178 		wrapper.dlg(wrapper.outer);
1179 	}
1180 	
1181 	extern(C) static void callBackShowOtherLocationsDestroy(OnShowOtherLocationsDelegateWrapper wrapper, GClosure* closure)
1182 	{
1183 		wrapper.outer.internalRemoveOnShowOtherLocations(wrapper);
1184 	}
1185 
1186 	protected void internalRemoveOnShowOtherLocations(OnShowOtherLocationsDelegateWrapper source)
1187 	{
1188 		foreach(index, wrapper; onShowOtherLocationsListeners)
1189 		{
1190 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
1191 			{
1192 				onShowOtherLocationsListeners[index] = null;
1193 				onShowOtherLocationsListeners = std.algorithm.remove(onShowOtherLocationsListeners, index);
1194 				break;
1195 			}
1196 		}
1197 	}
1198 	
1199 
1200 	protected class OnShowOtherLocationsWithFlagsDelegateWrapper
1201 	{
1202 		void delegate(GtkPlacesOpenFlags, PlacesSidebar) dlg;
1203 		gulong handlerId;
1204 		ConnectFlags flags;
1205 		this(void delegate(GtkPlacesOpenFlags, PlacesSidebar) dlg, gulong handlerId, ConnectFlags flags)
1206 		{
1207 			this.dlg = dlg;
1208 			this.handlerId = handlerId;
1209 			this.flags = flags;
1210 		}
1211 	}
1212 	protected OnShowOtherLocationsWithFlagsDelegateWrapper[] onShowOtherLocationsWithFlagsListeners;
1213 
1214 	/**
1215 	 * The places sidebar emits this signal when it needs the calling
1216 	 * application to present a way to show other locations e.g. drives
1217 	 * and network access points.
1218 	 * For example, the application may bring up a page showing persistent
1219 	 * volumes and discovered network addresses.
1220 	 *
1221 	 * Params:
1222 	 *     openFlags = a single value from #GtkPlacesOpenFlags specifying how it should be opened.
1223 	 *
1224 	 * Since: 3.20
1225 	 */
1226 	gulong addOnShowOtherLocationsWithFlags(void delegate(GtkPlacesOpenFlags, PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1227 	{
1228 		onShowOtherLocationsWithFlagsListeners ~= new OnShowOtherLocationsWithFlagsDelegateWrapper(dlg, 0, connectFlags);
1229 		onShowOtherLocationsWithFlagsListeners[onShowOtherLocationsWithFlagsListeners.length - 1].handlerId = Signals.connectData(
1230 			this,
1231 			"show-other-locations-with-flags",
1232 			cast(GCallback)&callBackShowOtherLocationsWithFlags,
1233 			cast(void*)onShowOtherLocationsWithFlagsListeners[onShowOtherLocationsWithFlagsListeners.length - 1],
1234 			cast(GClosureNotify)&callBackShowOtherLocationsWithFlagsDestroy,
1235 			connectFlags);
1236 		return onShowOtherLocationsWithFlagsListeners[onShowOtherLocationsWithFlagsListeners.length - 1].handlerId;
1237 	}
1238 	
1239 	extern(C) static void callBackShowOtherLocationsWithFlags(GtkPlacesSidebar* placessidebarStruct, GtkPlacesOpenFlags openFlags,OnShowOtherLocationsWithFlagsDelegateWrapper wrapper)
1240 	{
1241 		wrapper.dlg(openFlags, wrapper.outer);
1242 	}
1243 	
1244 	extern(C) static void callBackShowOtherLocationsWithFlagsDestroy(OnShowOtherLocationsWithFlagsDelegateWrapper wrapper, GClosure* closure)
1245 	{
1246 		wrapper.outer.internalRemoveOnShowOtherLocationsWithFlags(wrapper);
1247 	}
1248 
1249 	protected void internalRemoveOnShowOtherLocationsWithFlags(OnShowOtherLocationsWithFlagsDelegateWrapper source)
1250 	{
1251 		foreach(index, wrapper; onShowOtherLocationsWithFlagsListeners)
1252 		{
1253 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
1254 			{
1255 				onShowOtherLocationsWithFlagsListeners[index] = null;
1256 				onShowOtherLocationsWithFlagsListeners = std.algorithm.remove(onShowOtherLocationsWithFlagsListeners, index);
1257 				break;
1258 			}
1259 		}
1260 	}
1261 	
1262 
1263 	protected class OnUnmountDelegateWrapper
1264 	{
1265 		void delegate(MountOperation, PlacesSidebar) dlg;
1266 		gulong handlerId;
1267 		ConnectFlags flags;
1268 		this(void delegate(MountOperation, PlacesSidebar) dlg, gulong handlerId, ConnectFlags flags)
1269 		{
1270 			this.dlg = dlg;
1271 			this.handlerId = handlerId;
1272 			this.flags = flags;
1273 		}
1274 	}
1275 	protected OnUnmountDelegateWrapper[] onUnmountListeners;
1276 
1277 	/**
1278 	 * The places sidebar emits this signal when it starts a new operation
1279 	 * because the user for example ejected some drive or unmounted a mount.
1280 	 * In this way the application using the #GtkPlacesSidebar can track the
1281 	 * progress of the operation and, for example, show a notification.
1282 	 *
1283 	 * Params:
1284 	 *     mountOperation = the #GMountOperation that is going to start.
1285 	 *
1286 	 * Since: 3.20
1287 	 */
1288 	gulong addOnUnmount(void delegate(MountOperation, PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1289 	{
1290 		onUnmountListeners ~= new OnUnmountDelegateWrapper(dlg, 0, connectFlags);
1291 		onUnmountListeners[onUnmountListeners.length - 1].handlerId = Signals.connectData(
1292 			this,
1293 			"unmount",
1294 			cast(GCallback)&callBackUnmount,
1295 			cast(void*)onUnmountListeners[onUnmountListeners.length - 1],
1296 			cast(GClosureNotify)&callBackUnmountDestroy,
1297 			connectFlags);
1298 		return onUnmountListeners[onUnmountListeners.length - 1].handlerId;
1299 	}
1300 	
1301 	extern(C) static void callBackUnmount(GtkPlacesSidebar* placessidebarStruct, GMountOperation* mountOperation,OnUnmountDelegateWrapper wrapper)
1302 	{
1303 		wrapper.dlg(ObjectG.getDObject!(MountOperation)(mountOperation), wrapper.outer);
1304 	}
1305 	
1306 	extern(C) static void callBackUnmountDestroy(OnUnmountDelegateWrapper wrapper, GClosure* closure)
1307 	{
1308 		wrapper.outer.internalRemoveOnUnmount(wrapper);
1309 	}
1310 
1311 	protected void internalRemoveOnUnmount(OnUnmountDelegateWrapper source)
1312 	{
1313 		foreach(index, wrapper; onUnmountListeners)
1314 		{
1315 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
1316 			{
1317 				onUnmountListeners[index] = null;
1318 				onUnmountListeners = std.algorithm.remove(onUnmountListeners, index);
1319 				break;
1320 			}
1321 		}
1322 	}
1323 	
1324 }