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.Volume;
31 private import gio.VolumeIF;
32 private import glib.ConstructionException;
33 private import glib.ListG;
34 private import glib.ListSG;
35 private import glib.Str;
36 private import gobject.ObjectG;
37 private import gobject.Signals;
38 private import gtk.ScrolledWindow;
39 private import gtk.Widget;
40 public  import gtkc.gdktypes;
41 private import gtkc.gtk;
42 public  import gtkc.gtktypes;
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 public class PlacesSidebar : ScrolledWindow
70 {
71 	/** the main Gtk struct */
72 	protected GtkPlacesSidebar* gtkPlacesSidebar;
73 
74 	/** Get the main Gtk struct */
75 	public GtkPlacesSidebar* getPlacesSidebarStruct()
76 	{
77 		return gtkPlacesSidebar;
78 	}
79 
80 	/** the main Gtk struct as a void* */
81 	protected override void* getStruct()
82 	{
83 		return cast(void*)gtkPlacesSidebar;
84 	}
85 
86 	protected override void setStruct(GObject* obj)
87 	{
88 		gtkPlacesSidebar = cast(GtkPlacesSidebar*)obj;
89 		super.setStruct(obj);
90 	}
91 
92 	/**
93 	 * Sets our main struct and passes it to the parent class.
94 	 */
95 	public this (GtkPlacesSidebar* gtkPlacesSidebar, bool ownedRef = false)
96 	{
97 		this.gtkPlacesSidebar = gtkPlacesSidebar;
98 		super(cast(GtkScrolledWindow*)gtkPlacesSidebar, ownedRef);
99 	}
100 
101 	/**
102 	 */
103 
104 	public static GType getType()
105 	{
106 		return gtk_places_sidebar_get_type();
107 	}
108 
109 	/**
110 	 * Creates a new #GtkPlacesSidebar widget.
111 	 *
112 	 * The application should connect to at least the
113 	 * #GtkPlacesSidebar::open-location signal to be notified
114 	 * when the user makes a selection in the sidebar.
115 	 *
116 	 * Return: a newly created #GtkPlacesSidebar
117 	 *
118 	 * Since: 3.10
119 	 *
120 	 * Throws: ConstructionException GTK+ fails to create the object.
121 	 */
122 	public this()
123 	{
124 		auto p = gtk_places_sidebar_new();
125 		
126 		if(p is null)
127 		{
128 			throw new ConstructionException("null returned by new");
129 		}
130 		
131 		this(cast(GtkPlacesSidebar*) p);
132 	}
133 
134 	/**
135 	 * Applications may want to present some folders in the places sidebar if
136 	 * they could be immediately useful to users.  For example, a drawing
137 	 * program could add a “/usr/share/clipart” location when the sidebar is
138 	 * being used in an “Insert Clipart” dialog box.
139 	 *
140 	 * This function adds the specified @location to a special place for immutable
141 	 * shortcuts.  The shortcuts are application-specific; they are not shared
142 	 * across applications, and they are not persistent.  If this function
143 	 * is called multiple times with different locations, then they are added
144 	 * to the sidebar’s list in the same order as the function is called.
145 	 *
146 	 * Params:
147 	 *     location = location to add as an application-specific shortcut
148 	 *
149 	 * Since: 3.10
150 	 */
151 	public void addShortcut(FileIF location)
152 	{
153 		gtk_places_sidebar_add_shortcut(gtkPlacesSidebar, (location is null) ? null : location.getFileStruct());
154 	}
155 
156 	/**
157 	 * Returns the value previously set with gtk_places_sidebar_set_local_only().
158 	 *
159 	 * Return: %TRUE if the sidebar will only show local files.
160 	 *
161 	 * Since: 3.12
162 	 */
163 	public bool getLocalOnly()
164 	{
165 		return gtk_places_sidebar_get_local_only(gtkPlacesSidebar) != 0;
166 	}
167 
168 	/**
169 	 * Gets the currently-selected location in the @sidebar.  This can be #NULL when
170 	 * nothing is selected, for example, when gtk_places_sidebar_set_location() has
171 	 * been called with a location that is not among the sidebar’s list of places to
172 	 * show.
173 	 *
174 	 * You can use this function to get the selection in the @sidebar.  Also, if you
175 	 * connect to the #GtkPlacesSidebar::populate-popup signal, you can use this
176 	 * function to get the location that is being referred to during the callbacks
177 	 * for your menu items.
178 	 *
179 	 * Return: a GFile with the selected location, or #NULL if nothing is visually
180 	 *     selected.
181 	 *
182 	 * Since: 3.10
183 	 */
184 	public FileIF getLocation()
185 	{
186 		auto p = gtk_places_sidebar_get_location(gtkPlacesSidebar);
187 		
188 		if(p is null)
189 		{
190 			return null;
191 		}
192 		
193 		return ObjectG.getDObject!(File, FileIF)(cast(GFile*) p);
194 	}
195 
196 	/**
197 	 * This function queries the bookmarks added by the user to the places sidebar,
198 	 * and returns one of them.  This function is used by #GtkFileChooser to implement
199 	 * the “Alt-1”, “Alt-2”, etc. shortcuts, which activate the cooresponding bookmark.
200 	 *
201 	 * Params:
202 	 *     n = index of the bookmark to query
203 	 *
204 	 * Return: The bookmark specified by the index @n, or
205 	 *     #NULL if no such index exist.  Note that the indices start at 0, even though
206 	 *     the file chooser starts them with the keyboard shortcut “Alt-1”.
207 	 *
208 	 * Since: 3.10
209 	 */
210 	public FileIF getNthBookmark(int n)
211 	{
212 		auto p = gtk_places_sidebar_get_nth_bookmark(gtkPlacesSidebar, n);
213 		
214 		if(p is null)
215 		{
216 			return null;
217 		}
218 		
219 		return ObjectG.getDObject!(File, FileIF)(cast(GFile*) p);
220 	}
221 
222 	/**
223 	 * Gets the open flags.
224 	 *
225 	 * Return: the #GtkPlacesOpenFlags of @sidebar
226 	 *
227 	 * Since: 3.10
228 	 */
229 	public GtkPlacesOpenFlags getOpenFlags()
230 	{
231 		return gtk_places_sidebar_get_open_flags(gtkPlacesSidebar);
232 	}
233 
234 	/**
235 	 * Returns the value previously set with gtk_places_sidebar_set_show_connect_to_server()
236 	 *
237 	 * Deprecated: It is recommended to group this functionality with the drives
238 	 * and network location under the new 'Other Location' item
239 	 *
240 	 * Return: %TRUE if the sidebar will display a “Connect to Server” item.
241 	 */
242 	public bool getShowConnectToServer()
243 	{
244 		return gtk_places_sidebar_get_show_connect_to_server(gtkPlacesSidebar) != 0;
245 	}
246 
247 	/**
248 	 * Returns the value previously set with gtk_places_sidebar_set_show_desktop()
249 	 *
250 	 * Return: %TRUE if the sidebar will display a builtin shortcut to the desktop folder.
251 	 *
252 	 * Since: 3.10
253 	 */
254 	public bool getShowDesktop()
255 	{
256 		return gtk_places_sidebar_get_show_desktop(gtkPlacesSidebar) != 0;
257 	}
258 
259 	/**
260 	 * Returns the value previously set with gtk_places_sidebar_set_show_enter_location()
261 	 *
262 	 * Return: %TRUE if the sidebar will display an “Enter Location” item.
263 	 *
264 	 * Since: 3.14
265 	 */
266 	public bool getShowEnterLocation()
267 	{
268 		return gtk_places_sidebar_get_show_enter_location(gtkPlacesSidebar) != 0;
269 	}
270 
271 	/**
272 	 * Returns the value previously set with gtk_places_sidebar_set_show_other_locations()
273 	 *
274 	 * Return: %TRUE if the sidebar will display an “Other Locations” item.
275 	 *
276 	 * Since: 3.18
277 	 */
278 	public bool getShowOtherLocations()
279 	{
280 		return gtk_places_sidebar_get_show_other_locations(gtkPlacesSidebar) != 0;
281 	}
282 
283 	/**
284 	 * Returns the value previously set with gtk_places_sidebar_set_show_recent()
285 	 *
286 	 * Return: %TRUE if the sidebar will display a builtin shortcut for recent files
287 	 *
288 	 * Since: 3.18
289 	 */
290 	public bool getShowRecent()
291 	{
292 		return gtk_places_sidebar_get_show_recent(gtkPlacesSidebar) != 0;
293 	}
294 
295 	/**
296 	 * Returns the value previously set with gtk_places_sidebar_set_show_trash()
297 	 *
298 	 * Return: %TRUE if the sidebar will display a “Trash” item.
299 	 *
300 	 * Since: 3.18
301 	 */
302 	public bool getShowTrash()
303 	{
304 		return gtk_places_sidebar_get_show_trash(gtkPlacesSidebar) != 0;
305 	}
306 
307 	/**
308 	 * Gets the list of shortcuts.
309 	 *
310 	 * Return: A #GSList of #GFile of the locations that have been added as
311 	 *     application-specific shortcuts with gtk_places_sidebar_add_shortcut().
312 	 *     To free this list, you can use
313 	 *     |[<!-- language="C" -->
314 	 *     g_slist_free_full (list, (GDestroyNotify) g_object_unref);
315 	 *     ]|
316 	 *
317 	 * Since: 3.10
318 	 */
319 	public ListSG listShortcuts()
320 	{
321 		auto p = gtk_places_sidebar_list_shortcuts(gtkPlacesSidebar);
322 		
323 		if(p is null)
324 		{
325 			return null;
326 		}
327 		
328 		return new ListSG(cast(GSList*) p);
329 	}
330 
331 	/**
332 	 * Removes an application-specific shortcut that has been previously been
333 	 * inserted with gtk_places_sidebar_add_shortcut().  If the @location is not a
334 	 * shortcut in the sidebar, then nothing is done.
335 	 *
336 	 * Params:
337 	 *     location = location to remove
338 	 *
339 	 * Since: 3.10
340 	 */
341 	public void removeShortcut(FileIF location)
342 	{
343 		gtk_places_sidebar_remove_shortcut(gtkPlacesSidebar, (location is null) ? null : location.getFileStruct());
344 	}
345 
346 	/**
347 	 * Make the GtkPlacesSidebar show drop targets, so it can show the available
348 	 * drop targets and a "new bookmark" row. This improves the Drag-and-Drop
349 	 * experience of the user and allows applications to show all available
350 	 * drop targets at once.
351 	 *
352 	 * This needs to be called when the application is aware of an ongoing drag
353 	 * that might target the sidebar. The drop-targets-visible state will be unset
354 	 * automatically if the drag finishes in the GtkPlacesSidebar. You only need
355 	 * to unset the state when the drag ends on some other widget on your application.
356 	 *
357 	 * Params:
358 	 *     visible = whether to show the valid targets or not.
359 	 *     context = drag context used to ask the source about the action that wants to
360 	 *         perform, so hints are more accurate.
361 	 *
362 	 * Since: 3.18
363 	 */
364 	public void setDropTargetsVisible(bool visible, DragContext context)
365 	{
366 		gtk_places_sidebar_set_drop_targets_visible(gtkPlacesSidebar, visible, (context is null) ? null : context.getDragContextStruct());
367 	}
368 
369 	/**
370 	 * Sets whether the @sidebar should only show local files.
371 	 *
372 	 * Params:
373 	 *     localOnly = whether to show only local files
374 	 *
375 	 * Since: 3.12
376 	 */
377 	public void setLocalOnly(bool localOnly)
378 	{
379 		gtk_places_sidebar_set_local_only(gtkPlacesSidebar, localOnly);
380 	}
381 
382 	/**
383 	 * Sets the location that is being shown in the widgets surrounding the
384 	 * @sidebar, for example, in a folder view in a file manager.  In turn, the
385 	 * @sidebar will highlight that location if it is being shown in the list of
386 	 * places, or it will unhighlight everything if the @location is not among the
387 	 * places in the list.
388 	 *
389 	 * Params:
390 	 *     location = location to select, or #NULL for no current path
391 	 *
392 	 * Since: 3.10
393 	 */
394 	public void setLocation(FileIF location)
395 	{
396 		gtk_places_sidebar_set_location(gtkPlacesSidebar, (location is null) ? null : location.getFileStruct());
397 	}
398 
399 	/**
400 	 * Sets the way in which the calling application can open new locations from
401 	 * the places sidebar.  For example, some applications only open locations
402 	 * “directly” into their main view, while others may support opening locations
403 	 * in a new notebook tab or a new window.
404 	 *
405 	 * This function is used to tell the places @sidebar about the ways in which the
406 	 * application can open new locations, so that the sidebar can display (or not)
407 	 * the “Open in new tab” and “Open in new window” menu items as appropriate.
408 	 *
409 	 * When the #GtkPlacesSidebar::open-location signal is emitted, its flags
410 	 * argument will be set to one of the @flags that was passed in
411 	 * gtk_places_sidebar_set_open_flags().
412 	 *
413 	 * Passing 0 for @flags will cause #GTK_PLACES_OPEN_NORMAL to always be sent
414 	 * to callbacks for the “open-location” signal.
415 	 *
416 	 * Params:
417 	 *     flags = Bitmask of modes in which the calling application can open locations
418 	 *
419 	 * Since: 3.10
420 	 */
421 	public void setOpenFlags(GtkPlacesOpenFlags flags)
422 	{
423 		gtk_places_sidebar_set_open_flags(gtkPlacesSidebar, flags);
424 	}
425 
426 	/**
427 	 * Sets whether the @sidebar should show an item for connecting to a network server;
428 	 * this is off by default. An application may want to turn this on if it implements
429 	 * a way for the user to connect to network servers directly.
430 	 *
431 	 * If you enable this, you should connect to the
432 	 * #GtkPlacesSidebar::show-connect-to-server signal.
433 	 *
434 	 * Deprecated: It is recommended to group this functionality with the drives
435 	 * and network location under the new 'Other Location' item
436 	 *
437 	 * Params:
438 	 *     showConnectToServer = whether to show an item for the Connect to Server command
439 	 *
440 	 * Since: 3.10
441 	 */
442 	public void setShowConnectToServer(bool showConnectToServer)
443 	{
444 		gtk_places_sidebar_set_show_connect_to_server(gtkPlacesSidebar, showConnectToServer);
445 	}
446 
447 	/**
448 	 * Sets whether the @sidebar should show an item for the Desktop folder.
449 	 * The default value for this option is determined by the desktop
450 	 * environment and the user’s configuration, but this function can be
451 	 * used to override it on a per-application basis.
452 	 *
453 	 * Params:
454 	 *     showDesktop = whether to show an item for the Desktop folder
455 	 *
456 	 * Since: 3.10
457 	 */
458 	public void setShowDesktop(bool showDesktop)
459 	{
460 		gtk_places_sidebar_set_show_desktop(gtkPlacesSidebar, showDesktop);
461 	}
462 
463 	/**
464 	 * Sets whether the @sidebar should show an item for entering a location;
465 	 * this is off by default. An application may want to turn this on if manually
466 	 * entering URLs is an expected user action.
467 	 *
468 	 * If you enable this, you should connect to the
469 	 * #GtkPlacesSidebar::show-enter-location signal.
470 	 *
471 	 * Params:
472 	 *     showEnterLocation = whether to show an item to enter a location
473 	 *
474 	 * Since: 3.14
475 	 */
476 	public void setShowEnterLocation(bool showEnterLocation)
477 	{
478 		gtk_places_sidebar_set_show_enter_location(gtkPlacesSidebar, showEnterLocation);
479 	}
480 
481 	/**
482 	 * Sets whether the @sidebar should show an item for the application to show
483 	 * an Other Locations view; this is off by default. When set to %TRUE, persistent
484 	 * devices such as hard drives are hidden, otherwise they are shown in the sidebar.
485 	 * An application may want to turn this on if it implements a way for the user to
486 	 * see and interact with drives and network servers directly.
487 	 *
488 	 * If you enable this, you should connect to the
489 	 * #GtkPlacesSidebar::show-other-locations signal.
490 	 *
491 	 * Params:
492 	 *     showOtherLocations = whether to show an item for the Other Locations view
493 	 *
494 	 * Since: 3.18
495 	 */
496 	public void setShowOtherLocations(bool showOtherLocations)
497 	{
498 		gtk_places_sidebar_set_show_other_locations(gtkPlacesSidebar, showOtherLocations);
499 	}
500 
501 	/**
502 	 * Sets whether the @sidebar should show an item for recent files.
503 	 * The default value for this option is determined by the desktop
504 	 * environment, but this function can be used to override it on a
505 	 * per-application basis.
506 	 *
507 	 * Params:
508 	 *     showRecent = whether to show an item for recent files
509 	 *
510 	 * Since: 3.18
511 	 */
512 	public void setShowRecent(bool showRecent)
513 	{
514 		gtk_places_sidebar_set_show_recent(gtkPlacesSidebar, showRecent);
515 	}
516 
517 	/**
518 	 * Sets whether the @sidebar should show an item for the Trash location.
519 	 *
520 	 * Params:
521 	 *     showTrash = whether to show an item for the Trash location
522 	 *
523 	 * Since: 3.18
524 	 */
525 	public void setShowTrash(bool showTrash)
526 	{
527 		gtk_places_sidebar_set_show_trash(gtkPlacesSidebar, showTrash);
528 	}
529 
530 	int[string] connectedSignals;
531 
532 	int delegate(int, PlacesSidebar)[] onDragActionAskListeners;
533 	/**
534 	 * The places sidebar emits this signal when it needs to ask the application
535 	 * to pop up a menu to ask the user for which drag action to perform.
536 	 *
537 	 * Params:
538 	 *     actions = Possible drag actions that need to be asked for.
539 	 *
540 	 * Return: the final drag action that the sidebar should pass to the drag side
541 	 *     of the drag-and-drop operation.
542 	 *
543 	 * Since: 3.10
544 	 */
545 	void addOnDragActionAsk(int delegate(int, PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
546 	{
547 		if ( "drag-action-ask" !in connectedSignals )
548 		{
549 			Signals.connectData(
550 				this,
551 				"drag-action-ask",
552 				cast(GCallback)&callBackDragActionAsk,
553 				cast(void*)this,
554 				null,
555 				connectFlags);
556 			connectedSignals["drag-action-ask"] = 1;
557 		}
558 		onDragActionAskListeners ~= dlg;
559 	}
560 	extern(C) static int callBackDragActionAsk(GtkPlacesSidebar* placessidebarStruct, int actions, PlacesSidebar _placessidebar)
561 	{
562 		return _placessidebar.onDragActionAskListeners[0](actions, _placessidebar);
563 	}
564 
565 	int delegate(DragContext, FileIF, ListG, PlacesSidebar)[] onDragActionRequestedListeners;
566 	/**
567 	 * When the user starts a drag-and-drop operation and the sidebar needs
568 	 * to ask the application for which drag action to perform, then the
569 	 * sidebar will emit this signal.
570 	 *
571 	 * The application can evaluate the @context for customary actions, or
572 	 * it can check the type of the files indicated by @source_file_list against the
573 	 * possible actions for the destination @dest_file.
574 	 *
575 	 * The drag action to use must be the return value of the signal handler.
576 	 *
577 	 * Params:
578 	 *     context = #GdkDragContext with information about the drag operation
579 	 *     destFile = #GFile with the tentative location that is being hovered for a drop
580 	 *     sourceFileList = List of #GFile that are being dragged
581 	 *
582 	 * Return: The drag action to use, for example, #GDK_ACTION_COPY
583 	 *     or #GDK_ACTION_MOVE, or 0 if no action is allowed here (i.e. drops
584 	 *     are not allowed in the specified @dest_file).
585 	 *
586 	 * Since: 3.10
587 	 */
588 	void addOnDragActionRequested(int delegate(DragContext, FileIF, ListG, PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
589 	{
590 		if ( "drag-action-requested" !in connectedSignals )
591 		{
592 			Signals.connectData(
593 				this,
594 				"drag-action-requested",
595 				cast(GCallback)&callBackDragActionRequested,
596 				cast(void*)this,
597 				null,
598 				connectFlags);
599 			connectedSignals["drag-action-requested"] = 1;
600 		}
601 		onDragActionRequestedListeners ~= dlg;
602 	}
603 	extern(C) static int callBackDragActionRequested(GtkPlacesSidebar* placessidebarStruct, GdkDragContext* context, GFile* destFile, GList* sourceFileList, PlacesSidebar _placessidebar)
604 	{
605 		return _placessidebar.onDragActionRequestedListeners[0](ObjectG.getDObject!(DragContext)(context), ObjectG.getDObject!(File, FileIF)(destFile), new ListG(sourceFileList), _placessidebar);
606 	}
607 
608 	void delegate(FileIF, ListG, int, PlacesSidebar)[] onDragPerformDropListeners;
609 	/**
610 	 * The places sidebar emits this signal when the user completes a
611 	 * drag-and-drop operation and one of the sidebar's items is the
612 	 * destination.  This item is in the @dest_file, and the
613 	 * @source_file_list has the list of files that are dropped into it and
614 	 * which should be copied/moved/etc. based on the specified @action.
615 	 *
616 	 * Params:
617 	 *     destFile = Destination #GFile.
618 	 *     sourceFileList = #GList of #GFile that got dropped.
619 	 *     action = Drop action to perform.
620 	 *
621 	 * Since: 3.10
622 	 */
623 	void addOnDragPerformDrop(void delegate(FileIF, ListG, int, PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
624 	{
625 		if ( "drag-perform-drop" !in connectedSignals )
626 		{
627 			Signals.connectData(
628 				this,
629 				"drag-perform-drop",
630 				cast(GCallback)&callBackDragPerformDrop,
631 				cast(void*)this,
632 				null,
633 				connectFlags);
634 			connectedSignals["drag-perform-drop"] = 1;
635 		}
636 		onDragPerformDropListeners ~= dlg;
637 	}
638 	extern(C) static void callBackDragPerformDrop(GtkPlacesSidebar* placessidebarStruct, GFile* destFile, GList* sourceFileList, int action, PlacesSidebar _placessidebar)
639 	{
640 		foreach ( void delegate(FileIF, ListG, int, PlacesSidebar) dlg; _placessidebar.onDragPerformDropListeners )
641 		{
642 			dlg(ObjectG.getDObject!(File, FileIF)(destFile), new ListG(sourceFileList), action, _placessidebar);
643 		}
644 	}
645 
646 	void delegate(FileIF, GtkPlacesOpenFlags, PlacesSidebar)[] onOpenLocationListeners;
647 	/**
648 	 * The places sidebar emits this signal when the user selects a location
649 	 * in it.  The calling application should display the contents of that
650 	 * location; for example, a file manager should show a list of files in
651 	 * the specified location.
652 	 *
653 	 * Params:
654 	 *     location = #GFile to which the caller should switch.
655 	 *     openFlags = a single value from #GtkPlacesOpenFlags specifying how the @location should be opened.
656 	 *
657 	 * Since: 3.10
658 	 */
659 	void addOnOpenLocation(void delegate(FileIF, GtkPlacesOpenFlags, PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
660 	{
661 		if ( "open-location" !in connectedSignals )
662 		{
663 			Signals.connectData(
664 				this,
665 				"open-location",
666 				cast(GCallback)&callBackOpenLocation,
667 				cast(void*)this,
668 				null,
669 				connectFlags);
670 			connectedSignals["open-location"] = 1;
671 		}
672 		onOpenLocationListeners ~= dlg;
673 	}
674 	extern(C) static void callBackOpenLocation(GtkPlacesSidebar* placessidebarStruct, GFile* location, GtkPlacesOpenFlags openFlags, PlacesSidebar _placessidebar)
675 	{
676 		foreach ( void delegate(FileIF, GtkPlacesOpenFlags, PlacesSidebar) dlg; _placessidebar.onOpenLocationListeners )
677 		{
678 			dlg(ObjectG.getDObject!(File, FileIF)(location), openFlags, _placessidebar);
679 		}
680 	}
681 
682 	void delegate(Widget, FileIF, VolumeIF, PlacesSidebar)[] onPopulatePopupListeners;
683 	/**
684 	 * The places sidebar emits this signal when the user invokes a contextual
685 	 * popup on one of its items. In the signal handler, the application may
686 	 * add extra items to the menu as appropriate. For example, a file manager
687 	 * may want to add a "Properties" command to the menu.
688 	 *
689 	 * It is not necessary to store the @selected_item for each menu item;
690 	 * during their callbacks, the application can use gtk_places_sidebar_get_location()
691 	 * to get the file to which the item refers.
692 	 *
693 	 * The @selected_item argument may be %NULL in case the selection refers to
694 	 * a volume. In this case, @selected_volume will be non-%NULL. In this case,
695 	 * the calling application will have to g_object_ref() the @selected_volume and
696 	 * keep it around to use it in the callback.
697 	 *
698 	 * The @container and all its contents are destroyed after the user
699 	 * dismisses the popup. The popup is re-created (and thus, this signal is
700 	 * emitted) every time the user activates the contextual menu.
701 	 *
702 	 * Before 3.18, the @container always was a #GtkMenu, and you were expected
703 	 * to add your items as #GtkMenuItems. Since 3.18, the popup may be implemented
704 	 * as a #GtkPopover, in which case @container will be something else, e.g. a
705 	 * #GtkBox, to which you may add #GtkModelButtons or other widgets, such as
706 	 * #GtkEntries, #GtkSpinButtons, etc. If your application can deal with this
707 	 * situation, you can set #GtkPlacesSidebar::populate-all to %TRUE to request
708 	 * that this signal is emitted for populating popovers as well.
709 	 *
710 	 * Params:
711 	 *     container = a #GtkMenu or another #GtkContainer
712 	 *     selectedItem = #GFile with the item to which the popup should refer, or #NULL in the case of a @selected_volume.
713 	 *     selectedVolume = #GVolume if the selected item is a volume, or #NULL if it is a file.
714 	 *
715 	 * Since: 3.10
716 	 */
717 	void addOnPopulatePopup(void delegate(Widget, FileIF, VolumeIF, PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
718 	{
719 		if ( "populate-popup" !in connectedSignals )
720 		{
721 			Signals.connectData(
722 				this,
723 				"populate-popup",
724 				cast(GCallback)&callBackPopulatePopup,
725 				cast(void*)this,
726 				null,
727 				connectFlags);
728 			connectedSignals["populate-popup"] = 1;
729 		}
730 		onPopulatePopupListeners ~= dlg;
731 	}
732 	extern(C) static void callBackPopulatePopup(GtkPlacesSidebar* placessidebarStruct, GtkWidget* container, GFile* selectedItem, GVolume* selectedVolume, PlacesSidebar _placessidebar)
733 	{
734 		foreach ( void delegate(Widget, FileIF, VolumeIF, PlacesSidebar) dlg; _placessidebar.onPopulatePopupListeners )
735 		{
736 			dlg(ObjectG.getDObject!(Widget)(container), ObjectG.getDObject!(File, FileIF)(selectedItem), ObjectG.getDObject!(Volume, VolumeIF)(selectedVolume), _placessidebar);
737 		}
738 	}
739 
740 	void delegate(PlacesSidebar)[] onShowConnectToServerListeners;
741 	/**
742 	 * The places sidebar emits this signal when it needs the calling
743 	 * application to present an way to connect directly to a network server.
744 	 * For example, the application may bring up a dialog box asking for
745 	 * a URL like "sftp://ftp.example.com".  It is up to the application to create
746 	 * the corresponding mount by using, for example, g_file_mount_enclosing_volume().
747 	 *
748 	 * Deprecated: use the #GtkPlacesSidebar::show-other-locations signal
749 	 * to connect to network servers.
750 	 */
751 	void addOnShowConnectToServer(void delegate(PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
752 	{
753 		if ( "show-connect-to-server" !in connectedSignals )
754 		{
755 			Signals.connectData(
756 				this,
757 				"show-connect-to-server",
758 				cast(GCallback)&callBackShowConnectToServer,
759 				cast(void*)this,
760 				null,
761 				connectFlags);
762 			connectedSignals["show-connect-to-server"] = 1;
763 		}
764 		onShowConnectToServerListeners ~= dlg;
765 	}
766 	extern(C) static void callBackShowConnectToServer(GtkPlacesSidebar* placessidebarStruct, PlacesSidebar _placessidebar)
767 	{
768 		foreach ( void delegate(PlacesSidebar) dlg; _placessidebar.onShowConnectToServerListeners )
769 		{
770 			dlg(_placessidebar);
771 		}
772 	}
773 
774 	void delegate(PlacesSidebar)[] onShowEnterLocationListeners;
775 	/**
776 	 * The places sidebar emits this signal when it needs the calling
777 	 * application to present an way to directly enter a location.
778 	 * For example, the application may bring up a dialog box asking for
779 	 * a URL like "http://http.example.com".
780 	 *
781 	 * Since: 3.14
782 	 */
783 	void addOnShowEnterLocation(void delegate(PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
784 	{
785 		if ( "show-enter-location" !in connectedSignals )
786 		{
787 			Signals.connectData(
788 				this,
789 				"show-enter-location",
790 				cast(GCallback)&callBackShowEnterLocation,
791 				cast(void*)this,
792 				null,
793 				connectFlags);
794 			connectedSignals["show-enter-location"] = 1;
795 		}
796 		onShowEnterLocationListeners ~= dlg;
797 	}
798 	extern(C) static void callBackShowEnterLocation(GtkPlacesSidebar* placessidebarStruct, PlacesSidebar _placessidebar)
799 	{
800 		foreach ( void delegate(PlacesSidebar) dlg; _placessidebar.onShowEnterLocationListeners )
801 		{
802 			dlg(_placessidebar);
803 		}
804 	}
805 
806 	void delegate(string, string, PlacesSidebar)[] onShowErrorMessageListeners;
807 	/**
808 	 * The places sidebar emits this signal when it needs the calling
809 	 * application to present an error message.  Most of these messages
810 	 * refer to mounting or unmounting media, for example, when a drive
811 	 * cannot be started for some reason.
812 	 *
813 	 * Params:
814 	 *     primary = primary message with a summary of the error to show.
815 	 *     secondary = secondary message with details of the error to show.
816 	 *
817 	 * Since: 3.10
818 	 */
819 	void addOnShowErrorMessage(void delegate(string, string, PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
820 	{
821 		if ( "show-error-message" !in connectedSignals )
822 		{
823 			Signals.connectData(
824 				this,
825 				"show-error-message",
826 				cast(GCallback)&callBackShowErrorMessage,
827 				cast(void*)this,
828 				null,
829 				connectFlags);
830 			connectedSignals["show-error-message"] = 1;
831 		}
832 		onShowErrorMessageListeners ~= dlg;
833 	}
834 	extern(C) static void callBackShowErrorMessage(GtkPlacesSidebar* placessidebarStruct, char* primary, char* secondary, PlacesSidebar _placessidebar)
835 	{
836 		foreach ( void delegate(string, string, PlacesSidebar) dlg; _placessidebar.onShowErrorMessageListeners )
837 		{
838 			dlg(Str.toString(primary), Str.toString(secondary), _placessidebar);
839 		}
840 	}
841 
842 	void delegate(PlacesSidebar)[] onShowOtherLocationsListeners;
843 	/**
844 	 * The places sidebar emits this signal when it needs the calling
845 	 * application to present a way to show other locations e.g. drives
846 	 * and network access points.
847 	 * For example, the application may bring up a page showing persistent
848 	 * volumes and discovered network addresses.
849 	 *
850 	 * Since: 3.18
851 	 */
852 	void addOnShowOtherLocations(void delegate(PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
853 	{
854 		if ( "show-other-locations" !in connectedSignals )
855 		{
856 			Signals.connectData(
857 				this,
858 				"show-other-locations",
859 				cast(GCallback)&callBackShowOtherLocations,
860 				cast(void*)this,
861 				null,
862 				connectFlags);
863 			connectedSignals["show-other-locations"] = 1;
864 		}
865 		onShowOtherLocationsListeners ~= dlg;
866 	}
867 	extern(C) static void callBackShowOtherLocations(GtkPlacesSidebar* placessidebarStruct, PlacesSidebar _placessidebar)
868 	{
869 		foreach ( void delegate(PlacesSidebar) dlg; _placessidebar.onShowOtherLocationsListeners )
870 		{
871 			dlg(_placessidebar);
872 		}
873 	}
874 }