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.Menu;
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 
45 
46 /**
47  * #GtkPlacesSidebar is a widget that displays a list of frequently-used places in the
48  * file system:  the user’s home directory, the user’s bookmarks, and volumes and drives.
49  * This widget is used as a sidebar in #GtkFileChooser and may be used by file managers
50  * and similar programs.
51  * 
52  * The places sidebar displays drives and volumes, and will automatically mount
53  * or unmount them when the user selects them.
54  * 
55  * Applications can hook to various signals in the places sidebar to customize
56  * its behavior.  For example, they can add extra commands to the context menu
57  * of the sidebar.
58  * 
59  * While bookmarks are completely in control of the user, the places sidebar also
60  * allows individual applications to provide extra shortcut folders that are unique
61  * to each application.  For example, a Paint program may want to add a shortcut
62  * for a Clipart folder.  You can do this with gtk_places_sidebar_add_shortcut().
63  * 
64  * To make use of the places sidebar, an application at least needs to connect
65  * to the #GtkPlacesSidebar::open-location signal.  This is emitted when the
66  * user selects in the sidebar a location to open.  The application should also
67  * call gtk_places_sidebar_set_location() when it changes the currently-viewed
68  * location.
69  */
70 public class PlacesSidebar : ScrolledWindow
71 {
72 	/** the main Gtk struct */
73 	protected GtkPlacesSidebar* gtkPlacesSidebar;
74 
75 	/** Get the main Gtk struct */
76 	public GtkPlacesSidebar* getPlacesSidebarStruct()
77 	{
78 		return gtkPlacesSidebar;
79 	}
80 
81 	/** the main Gtk struct as a void* */
82 	protected override void* getStruct()
83 	{
84 		return cast(void*)gtkPlacesSidebar;
85 	}
86 
87 	protected override void setStruct(GObject* obj)
88 	{
89 		gtkPlacesSidebar = cast(GtkPlacesSidebar*)obj;
90 		super.setStruct(obj);
91 	}
92 
93 	/**
94 	 * Sets our main struct and passes it to the parent class.
95 	 */
96 	public this (GtkPlacesSidebar* gtkPlacesSidebar, bool ownedRef = false)
97 	{
98 		this.gtkPlacesSidebar = gtkPlacesSidebar;
99 		super(cast(GtkScrolledWindow*)gtkPlacesSidebar, ownedRef);
100 	}
101 
102 	/**
103 	 */
104 
105 	public static GType getType()
106 	{
107 		return gtk_places_sidebar_get_type();
108 	}
109 
110 	/**
111 	 * Creates a new #GtkPlacesSidebar widget.
112 	 *
113 	 * The application should connect to at least the
114 	 * #GtkPlacesSidebar::open-location signal to be notified
115 	 * when the user makes a selection in the sidebar.
116 	 *
117 	 * Return: a newly created #GtkPlacesSidebar
118 	 *
119 	 * Since: 3.10
120 	 *
121 	 * Throws: ConstructionException GTK+ fails to create the object.
122 	 */
123 	public this()
124 	{
125 		auto p = gtk_places_sidebar_new();
126 		
127 		if(p is null)
128 		{
129 			throw new ConstructionException("null returned by new");
130 		}
131 		
132 		this(cast(GtkPlacesSidebar*) p);
133 	}
134 
135 	/**
136 	 * Applications may want to present some folders in the places sidebar if
137 	 * they could be immediately useful to users.  For example, a drawing
138 	 * program could add a “/usr/share/clipart” location when the sidebar is
139 	 * being used in an “Insert Clipart” dialog box.
140 	 *
141 	 * This function adds the specified @location to a special place for immutable
142 	 * shortcuts.  The shortcuts are application-specific; they are not shared
143 	 * across applications, and they are not persistent.  If this function
144 	 * is called multiple times with different locations, then they are added
145 	 * to the sidebar’s list in the same order as the function is called.
146 	 *
147 	 * Params:
148 	 *     location = location to add as an application-specific shortcut
149 	 *
150 	 * Since: 3.10
151 	 */
152 	public void addShortcut(FileIF location)
153 	{
154 		gtk_places_sidebar_add_shortcut(gtkPlacesSidebar, (location is null) ? null : location.getFileStruct());
155 	}
156 
157 	/**
158 	 * Returns the value previously set with gtk_places_sidebar_set_local_only().
159 	 *
160 	 * Return: %TRUE if the sidebar will only show local files.
161 	 *
162 	 * Since: 3.12
163 	 */
164 	public bool getLocalOnly()
165 	{
166 		return gtk_places_sidebar_get_local_only(gtkPlacesSidebar) != 0;
167 	}
168 
169 	/**
170 	 * Gets the currently-selected location in the @sidebar.  This can be #NULL when
171 	 * nothing is selected, for example, when gtk_places_sidebar_set_location() has
172 	 * been called with a location that is not among the sidebar’s list of places to
173 	 * show.
174 	 *
175 	 * You can use this function to get the selection in the @sidebar.  Also, if you
176 	 * connect to the #GtkPlacesSidebar::populate-popup signal, you can use this
177 	 * function to get the location that is being referred to during the callbacks
178 	 * for your menu items.
179 	 *
180 	 * Return: a GFile with the selected location, or #NULL if nothing is visually
181 	 *     selected.
182 	 *
183 	 * Since: 3.10
184 	 */
185 	public FileIF getLocation()
186 	{
187 		auto p = gtk_places_sidebar_get_location(gtkPlacesSidebar);
188 		
189 		if(p is null)
190 		{
191 			return null;
192 		}
193 		
194 		return ObjectG.getDObject!(File, FileIF)(cast(GFile*) p);
195 	}
196 
197 	/**
198 	 * This function queries the bookmarks added by the user to the places sidebar,
199 	 * and returns one of them.  This function is used by #GtkFileChooser to implement
200 	 * the “Alt-1”, “Alt-2”, etc. shortcuts, which activate the cooresponding bookmark.
201 	 *
202 	 * Params:
203 	 *     n = index of the bookmark to query
204 	 *
205 	 * Return: The bookmark specified by the index @n, or
206 	 *     #NULL if no such index exist.  Note that the indices start at 0, even though
207 	 *     the file chooser starts them with the keyboard shortcut “Alt-1”.
208 	 *
209 	 * Since: 3.10
210 	 */
211 	public FileIF getNthBookmark(int n)
212 	{
213 		auto p = gtk_places_sidebar_get_nth_bookmark(gtkPlacesSidebar, n);
214 		
215 		if(p is null)
216 		{
217 			return null;
218 		}
219 		
220 		return ObjectG.getDObject!(File, FileIF)(cast(GFile*) p);
221 	}
222 
223 	/**
224 	 * Gets the open flags.
225 	 *
226 	 * Return: the #GtkPlacesOpenFlags of @sidebar
227 	 *
228 	 * Since: 3.10
229 	 */
230 	public GtkPlacesOpenFlags getOpenFlags()
231 	{
232 		return gtk_places_sidebar_get_open_flags(gtkPlacesSidebar);
233 	}
234 
235 	/**
236 	 * Returns the value previously set with gtk_places_sidebar_set_show_connect_to_server()
237 	 *
238 	 * Return: %TRUE if the sidebar will display a “Connect to Server” item.
239 	 *
240 	 * Since: 3.10
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 	 * Gets the list of shortcuts.
273 	 *
274 	 * Return: A #GSList of #GFile of the locations that have been added as
275 	 *     application-specific shortcuts with gtk_places_sidebar_add_shortcut().
276 	 *     To free this list, you can use
277 	 *     |[<!-- language="C" -->
278 	 *     g_slist_free_full (list, (GDestroyNotify) g_object_unref);
279 	 *     ]|
280 	 *
281 	 * Since: 3.10
282 	 */
283 	public ListSG listShortcuts()
284 	{
285 		auto p = gtk_places_sidebar_list_shortcuts(gtkPlacesSidebar);
286 		
287 		if(p is null)
288 		{
289 			return null;
290 		}
291 		
292 		return new ListSG(cast(GSList*) p);
293 	}
294 
295 	/**
296 	 * Removes an application-specific shortcut that has been previously been
297 	 * inserted with gtk_places_sidebar_add_shortcut().  If the @location is not a
298 	 * shortcut in the sidebar, then nothing is done.
299 	 *
300 	 * Params:
301 	 *     location = location to remove
302 	 *
303 	 * Since: 3.10
304 	 */
305 	public void removeShortcut(FileIF location)
306 	{
307 		gtk_places_sidebar_remove_shortcut(gtkPlacesSidebar, (location is null) ? null : location.getFileStruct());
308 	}
309 
310 	/**
311 	 * Sets whether the @sidebar should only show local files.
312 	 *
313 	 * Params:
314 	 *     localOnly = whether to show only local files
315 	 *
316 	 * Since: 3.12
317 	 */
318 	public void setLocalOnly(bool localOnly)
319 	{
320 		gtk_places_sidebar_set_local_only(gtkPlacesSidebar, localOnly);
321 	}
322 
323 	/**
324 	 * Sets the location that is being shown in the widgets surrounding the
325 	 * @sidebar, for example, in a folder view in a file manager.  In turn, the
326 	 * @sidebar will highlight that location if it is being shown in the list of
327 	 * places, or it will unhighlight everything if the @location is not among the
328 	 * places in the list.
329 	 *
330 	 * Params:
331 	 *     location = location to select, or #NULL for no current path
332 	 *
333 	 * Since: 3.10
334 	 */
335 	public void setLocation(FileIF location)
336 	{
337 		gtk_places_sidebar_set_location(gtkPlacesSidebar, (location is null) ? null : location.getFileStruct());
338 	}
339 
340 	/**
341 	 * Sets the way in which the calling application can open new locations from
342 	 * the places sidebar.  For example, some applications only open locations
343 	 * “directly” into their main view, while others may support opening locations
344 	 * in a new notebook tab or a new window.
345 	 *
346 	 * This function is used to tell the places @sidebar about the ways in which the
347 	 * application can open new locations, so that the sidebar can display (or not)
348 	 * the “Open in new tab” and “Open in new window” menu items as appropriate.
349 	 *
350 	 * When the #GtkPlacesSidebar::open-location signal is emitted, its flags
351 	 * argument will be set to one of the @flags that was passed in
352 	 * gtk_places_sidebar_set_open_flags().
353 	 *
354 	 * Passing 0 for @flags will cause #GTK_PLACES_OPEN_NORMAL to always be sent
355 	 * to callbacks for the “open-location” signal.
356 	 *
357 	 * Params:
358 	 *     flags = Bitmask of modes in which the calling application can open locations
359 	 *
360 	 * Since: 3.10
361 	 */
362 	public void setOpenFlags(GtkPlacesOpenFlags flags)
363 	{
364 		gtk_places_sidebar_set_open_flags(gtkPlacesSidebar, flags);
365 	}
366 
367 	/**
368 	 * Sets whether the @sidebar should show an item for connecting to a network server; this is off by default.
369 	 * An application may want to turn this on if it implements a way for the user to connect
370 	 * to network servers directly.
371 	 *
372 	 * Params:
373 	 *     showConnectToServer = whether to show an item for the Connect to Server command
374 	 *
375 	 * Since: 3.10
376 	 */
377 	public void setShowConnectToServer(bool showConnectToServer)
378 	{
379 		gtk_places_sidebar_set_show_connect_to_server(gtkPlacesSidebar, showConnectToServer);
380 	}
381 
382 	/**
383 	 * Sets whether the @sidebar should show an item for the Desktop folder.
384 	 * The default value for this option is determined by the desktop
385 	 * environment and the user’s configuration, but this function can be
386 	 * used to override it on a per-application basis.
387 	 *
388 	 * Params:
389 	 *     showDesktop = whether to show an item for the Desktop folder
390 	 *
391 	 * Since: 3.10
392 	 */
393 	public void setShowDesktop(bool showDesktop)
394 	{
395 		gtk_places_sidebar_set_show_desktop(gtkPlacesSidebar, showDesktop);
396 	}
397 
398 	/**
399 	 * Sets whether the @sidebar should show an item for connecting to a network server; this is off by default.
400 	 * An application may want to turn this on if it implements a way for the user to connect
401 	 * to network servers directly.
402 	 *
403 	 * Params:
404 	 *     showEnterLocation = whether to show an item for the Connect to Server command
405 	 *
406 	 * Since: 3.14
407 	 */
408 	public void setShowEnterLocation(bool showEnterLocation)
409 	{
410 		gtk_places_sidebar_set_show_enter_location(gtkPlacesSidebar, showEnterLocation);
411 	}
412 
413 	int[string] connectedSignals;
414 
415 	int delegate(int, PlacesSidebar)[] onDragActionAskListeners;
416 	/**
417 	 * The places sidebar emits this signal when it needs to ask the application
418 	 * to pop up a menu to ask the user for which drag action to perform.
419 	 *
420 	 * Params:
421 	 *     actions = Possible drag actions that need to be asked for.
422 	 *
423 	 * Return: the final drag action that the sidebar should pass to the drag side
424 	 *     of the drag-and-drop operation.
425 	 *
426 	 * Since: 3.10
427 	 */
428 	void addOnDragActionAsk(int delegate(int, PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
429 	{
430 		if ( "drag-action-ask" !in connectedSignals )
431 		{
432 			Signals.connectData(
433 				this,
434 				"drag-action-ask",
435 				cast(GCallback)&callBackDragActionAsk,
436 				cast(void*)this,
437 				null,
438 				connectFlags);
439 			connectedSignals["drag-action-ask"] = 1;
440 		}
441 		onDragActionAskListeners ~= dlg;
442 	}
443 	extern(C) static int callBackDragActionAsk(GtkPlacesSidebar* placessidebarStruct, int actions, PlacesSidebar _placessidebar)
444 	{
445 		return _placessidebar.onDragActionAskListeners[0](actions, _placessidebar);
446 	}
447 
448 	int delegate(DragContext, FileIF, ListG, PlacesSidebar)[] onDragActionRequestedListeners;
449 	/**
450 	 * When the user starts a drag-and-drop operation and the sidebar needs
451 	 * to ask the application for which drag action to perform, then the
452 	 * sidebar will emit this signal.
453 	 *
454 	 * The application can evaluate the @context for customary actions, or
455 	 * it can check the type of the files indicated by @source_file_list against the
456 	 * possible actions for the destination @dest_file.
457 	 *
458 	 * The drag action to use must be the return value of the signal handler.
459 	 *
460 	 * Params:
461 	 *     context = #GdkDragContext with information about the drag operation
462 	 *     destFile = #GFile with the tentative location that is being hovered for a drop
463 	 *     sourceFileList = List of #GFile that are being dragged
464 	 *
465 	 * Return: The drag action to use, for example, #GDK_ACTION_COPY
466 	 *     or #GDK_ACTION_MOVE, or 0 if no action is allowed here (i.e. drops
467 	 *     are not allowed in the specified @dest_file).
468 	 *
469 	 * Since: 3.10
470 	 */
471 	void addOnDragActionRequested(int delegate(DragContext, FileIF, ListG, PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
472 	{
473 		if ( "drag-action-requested" !in connectedSignals )
474 		{
475 			Signals.connectData(
476 				this,
477 				"drag-action-requested",
478 				cast(GCallback)&callBackDragActionRequested,
479 				cast(void*)this,
480 				null,
481 				connectFlags);
482 			connectedSignals["drag-action-requested"] = 1;
483 		}
484 		onDragActionRequestedListeners ~= dlg;
485 	}
486 	extern(C) static int callBackDragActionRequested(GtkPlacesSidebar* placessidebarStruct, GdkDragContext* context, GFile* destFile, GList* sourceFileList, PlacesSidebar _placessidebar)
487 	{
488 		return _placessidebar.onDragActionRequestedListeners[0](ObjectG.getDObject!(DragContext)(context), ObjectG.getDObject!(File, FileIF)(destFile), new ListG(sourceFileList), _placessidebar);
489 	}
490 
491 	void delegate(FileIF, ListG, int, PlacesSidebar)[] onDragPerformDropListeners;
492 	/**
493 	 * The places sidebar emits this signal when the user completes a
494 	 * drag-and-drop operation and one of the sidebar's items is the
495 	 * destination.  This item is in the @dest_file, and the
496 	 * @source_file_list has the list of files that are dropped into it and
497 	 * which should be copied/moved/etc. based on the specified @action.
498 	 *
499 	 * Params:
500 	 *     destFile = Destination #GFile.
501 	 *     sourceFileList = #GList of #GFile that got dropped.
502 	 *     action = Drop action to perform.
503 	 *
504 	 * Since: 3.10
505 	 */
506 	void addOnDragPerformDrop(void delegate(FileIF, ListG, int, PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
507 	{
508 		if ( "drag-perform-drop" !in connectedSignals )
509 		{
510 			Signals.connectData(
511 				this,
512 				"drag-perform-drop",
513 				cast(GCallback)&callBackDragPerformDrop,
514 				cast(void*)this,
515 				null,
516 				connectFlags);
517 			connectedSignals["drag-perform-drop"] = 1;
518 		}
519 		onDragPerformDropListeners ~= dlg;
520 	}
521 	extern(C) static void callBackDragPerformDrop(GtkPlacesSidebar* placessidebarStruct, GFile* destFile, GList* sourceFileList, int action, PlacesSidebar _placessidebar)
522 	{
523 		foreach ( void delegate(FileIF, ListG, int, PlacesSidebar) dlg; _placessidebar.onDragPerformDropListeners )
524 		{
525 			dlg(ObjectG.getDObject!(File, FileIF)(destFile), new ListG(sourceFileList), action, _placessidebar);
526 		}
527 	}
528 
529 	void delegate(FileIF, GtkPlacesOpenFlags, PlacesSidebar)[] onOpenLocationListeners;
530 	/**
531 	 * The places sidebar emits this signal when the user selects a location
532 	 * in it.  The calling application should display the contents of that
533 	 * location; for example, a file manager should show a list of files in
534 	 * the specified location.
535 	 *
536 	 * Params:
537 	 *     location = #GFile to which the caller should switch.
538 	 *     openFlags = a single value from #GtkPlacesOpenFlags specifying how the @location should be opened.
539 	 *
540 	 * Since: 3.10
541 	 */
542 	void addOnOpenLocation(void delegate(FileIF, GtkPlacesOpenFlags, PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
543 	{
544 		if ( "open-location" !in connectedSignals )
545 		{
546 			Signals.connectData(
547 				this,
548 				"open-location",
549 				cast(GCallback)&callBackOpenLocation,
550 				cast(void*)this,
551 				null,
552 				connectFlags);
553 			connectedSignals["open-location"] = 1;
554 		}
555 		onOpenLocationListeners ~= dlg;
556 	}
557 	extern(C) static void callBackOpenLocation(GtkPlacesSidebar* placessidebarStruct, GFile* location, GtkPlacesOpenFlags openFlags, PlacesSidebar _placessidebar)
558 	{
559 		foreach ( void delegate(FileIF, GtkPlacesOpenFlags, PlacesSidebar) dlg; _placessidebar.onOpenLocationListeners )
560 		{
561 			dlg(ObjectG.getDObject!(File, FileIF)(location), openFlags, _placessidebar);
562 		}
563 	}
564 
565 	void delegate(Menu, FileIF, VolumeIF, PlacesSidebar)[] onPopulatePopupListeners;
566 	/**
567 	 * The places sidebar emits this signal when the user invokes a contextual
568 	 * menu on one of its items.  In the signal handler, the application may
569 	 * add extra items to the menu as appropriate.  For example, a file manager
570 	 * may want to add a "Properties" command to the menu.
571 	 *
572 	 * It is not necessary to store the @selected_item for each menu item;
573 	 * during their GtkMenuItem::activate callbacks, the application can use
574 	 * gtk_places_sidebar_get_location() to get the file to which the item
575 	 * refers.
576 	 *
577 	 * The @selected_item argument may be #NULL in case the selection refers to
578 	 * a volume.  In this case, @selected_volume will be non-NULL.  In this case,
579 	 * the calling application will have to g_object_ref() the @selected_volume and
580 	 * keep it around for the purposes of its menu item's "activate" callback.
581 	 *
582 	 * The @menu and all its menu items are destroyed after the user
583 	 * dismisses the menu.  The menu is re-created (and thus, this signal is
584 	 * emitted) every time the user activates the contextual menu.
585 	 *
586 	 * Params:
587 	 *     menu = a #GtkMenu.
588 	 *     selectedItem = #GFile with the item to which the menu should refer, or #NULL in the case of a @selected_volume.
589 	 *     selectedVolume = #GVolume if the selected item is a volume, or #NULL if it is a file.
590 	 *
591 	 * Since: 3.10
592 	 */
593 	void addOnPopulatePopup(void delegate(Menu, FileIF, VolumeIF, PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
594 	{
595 		if ( "populate-popup" !in connectedSignals )
596 		{
597 			Signals.connectData(
598 				this,
599 				"populate-popup",
600 				cast(GCallback)&callBackPopulatePopup,
601 				cast(void*)this,
602 				null,
603 				connectFlags);
604 			connectedSignals["populate-popup"] = 1;
605 		}
606 		onPopulatePopupListeners ~= dlg;
607 	}
608 	extern(C) static void callBackPopulatePopup(GtkPlacesSidebar* placessidebarStruct, GtkMenu* menu, GFile* selectedItem, GVolume* selectedVolume, PlacesSidebar _placessidebar)
609 	{
610 		foreach ( void delegate(Menu, FileIF, VolumeIF, PlacesSidebar) dlg; _placessidebar.onPopulatePopupListeners )
611 		{
612 			dlg(ObjectG.getDObject!(Menu)(menu), ObjectG.getDObject!(File, FileIF)(selectedItem), ObjectG.getDObject!(Volume, VolumeIF)(selectedVolume), _placessidebar);
613 		}
614 	}
615 
616 	void delegate(PlacesSidebar)[] onShowConnectToServerListeners;
617 	/**
618 	 * The places sidebar emits this signal when it needs the calling
619 	 * application to present an way to connect directly to a network server.
620 	 * For example, the application may bring up a dialog box asking for
621 	 * a URL like "sftp://ftp.example.com".  It is up to the application to create
622 	 * the corresponding mount by using, for example, g_file_mount_enclosing_volume().
623 	 *
624 	 * Since: 3.10
625 	 */
626 	void addOnShowConnectToServer(void delegate(PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
627 	{
628 		if ( "show-connect-to-server" !in connectedSignals )
629 		{
630 			Signals.connectData(
631 				this,
632 				"show-connect-to-server",
633 				cast(GCallback)&callBackShowConnectToServer,
634 				cast(void*)this,
635 				null,
636 				connectFlags);
637 			connectedSignals["show-connect-to-server"] = 1;
638 		}
639 		onShowConnectToServerListeners ~= dlg;
640 	}
641 	extern(C) static void callBackShowConnectToServer(GtkPlacesSidebar* placessidebarStruct, PlacesSidebar _placessidebar)
642 	{
643 		foreach ( void delegate(PlacesSidebar) dlg; _placessidebar.onShowConnectToServerListeners )
644 		{
645 			dlg(_placessidebar);
646 		}
647 	}
648 
649 	void delegate(PlacesSidebar)[] onShowEnterLocationListeners;
650 	/**
651 	 * The places sidebar emits this signal when it needs the calling
652 	 * application to present an way to directly enter a location.
653 	 * For example, the application may bring up a dialog box asking for
654 	 * a URL like "http://http.example.com".
655 	 *
656 	 * Since: 3.14
657 	 */
658 	void addOnShowEnterLocation(void delegate(PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
659 	{
660 		if ( "show-enter-location" !in connectedSignals )
661 		{
662 			Signals.connectData(
663 				this,
664 				"show-enter-location",
665 				cast(GCallback)&callBackShowEnterLocation,
666 				cast(void*)this,
667 				null,
668 				connectFlags);
669 			connectedSignals["show-enter-location"] = 1;
670 		}
671 		onShowEnterLocationListeners ~= dlg;
672 	}
673 	extern(C) static void callBackShowEnterLocation(GtkPlacesSidebar* placessidebarStruct, PlacesSidebar _placessidebar)
674 	{
675 		foreach ( void delegate(PlacesSidebar) dlg; _placessidebar.onShowEnterLocationListeners )
676 		{
677 			dlg(_placessidebar);
678 		}
679 	}
680 
681 	void delegate(string, string, PlacesSidebar)[] onShowErrorMessageListeners;
682 	/**
683 	 * The places sidebar emits this signal when it needs the calling
684 	 * application to present an error message.  Most of these messages
685 	 * refer to mounting or unmounting media, for example, when a drive
686 	 * cannot be started for some reason.
687 	 *
688 	 * Params:
689 	 *     primary = primary message with a summary of the error to show.
690 	 *     secondary = secondary message with details of the error to show.
691 	 *
692 	 * Since: 3.10
693 	 */
694 	void addOnShowErrorMessage(void delegate(string, string, PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
695 	{
696 		if ( "show-error-message" !in connectedSignals )
697 		{
698 			Signals.connectData(
699 				this,
700 				"show-error-message",
701 				cast(GCallback)&callBackShowErrorMessage,
702 				cast(void*)this,
703 				null,
704 				connectFlags);
705 			connectedSignals["show-error-message"] = 1;
706 		}
707 		onShowErrorMessageListeners ~= dlg;
708 	}
709 	extern(C) static void callBackShowErrorMessage(GtkPlacesSidebar* placessidebarStruct, char* primary, char* secondary, PlacesSidebar _placessidebar)
710 	{
711 		foreach ( void delegate(string, string, PlacesSidebar) dlg; _placessidebar.onShowErrorMessageListeners )
712 		{
713 			dlg(Str.toString(primary), Str.toString(secondary), _placessidebar);
714 		}
715 	}
716 }