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