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 gio.MountT;
26 
27 public  import gio.AsyncResultIF;
28 public  import gio.Cancellable;
29 public  import gio.Drive;
30 public  import gio.DriveIF;
31 public  import gio.File;
32 public  import gio.FileIF;
33 public  import gio.Icon;
34 public  import gio.IconIF;
35 public  import gio.MountOperation;
36 public  import gio.Volume;
37 public  import gio.VolumeIF;
38 public  import glib.ErrorG;
39 public  import glib.GException;
40 public  import glib.Str;
41 public  import gobject.ObjectG;
42 public  import gobject.Signals;
43 public  import gtkc.gdktypes;
44 public  import gtkc.gio;
45 public  import gtkc.giotypes;
46 public  import std.algorithm;
47 
48 
49 /**
50  * The #GMount interface represents user-visible mounts. Note, when
51  * porting from GnomeVFS, #GMount is the moral equivalent of #GnomeVFSVolume.
52  * 
53  * #GMount is a "mounted" filesystem that you can access. Mounted is in
54  * quotes because it's not the same as a unix mount, it might be a gvfs
55  * mount, but you can still access the files on it if you use GIO. Might or
56  * might not be related to a volume object.
57  * 
58  * Unmounting a #GMount instance is an asynchronous operation. For
59  * more information about asynchronous operations, see #GAsyncResult
60  * and #GTask. To unmount a #GMount instance, first call
61  * g_mount_unmount_with_operation() with (at least) the #GMount instance and a
62  * #GAsyncReadyCallback.  The callback will be fired when the
63  * operation has resolved (either with success or failure), and a
64  * #GAsyncReady structure will be passed to the callback.  That
65  * callback should then call g_mount_unmount_with_operation_finish() with the #GMount
66  * and the #GAsyncReady data to see if the operation was completed
67  * successfully.  If an @error is present when g_mount_unmount_with_operation_finish()
68  * is called, then it will be filled with any error information.
69  */
70 public template MountT(TStruct)
71 {
72 	/** Get the main Gtk struct */
73 	public GMount* getMountStruct()
74 	{
75 		return cast(GMount*)getStruct();
76 	}
77 
78 
79 	/**
80 	 * Checks if @mount can be eject.
81 	 *
82 	 * Return: %TRUE if the @mount can be ejected.
83 	 */
84 	public bool canEject()
85 	{
86 		return g_mount_can_eject(getMountStruct()) != 0;
87 	}
88 
89 	/**
90 	 * Checks if @mount can be mounted.
91 	 *
92 	 * Return: %TRUE if the @mount can be unmounted.
93 	 */
94 	public bool canUnmount()
95 	{
96 		return g_mount_can_unmount(getMountStruct()) != 0;
97 	}
98 
99 	/**
100 	 * Ejects a mount. This is an asynchronous operation, and is
101 	 * finished by calling g_mount_eject_finish() with the @mount
102 	 * and #GAsyncResult data returned in the @callback.
103 	 *
104 	 * Deprecated: Use g_mount_eject_with_operation() instead.
105 	 *
106 	 * Params:
107 	 *     flags = flags affecting the unmount if required for eject
108 	 *     cancellable = optional #GCancellable object, %NULL to ignore.
109 	 *     callback = a #GAsyncReadyCallback, or %NULL.
110 	 *     userData = user data passed to @callback.
111 	 */
112 	public void eject(GMountUnmountFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
113 	{
114 		g_mount_eject(getMountStruct(), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
115 	}
116 
117 	/**
118 	 * Finishes ejecting a mount. If any errors occurred during the operation,
119 	 * @error will be set to contain the errors and %FALSE will be returned.
120 	 *
121 	 * Deprecated: Use g_mount_eject_with_operation_finish() instead.
122 	 *
123 	 * Params:
124 	 *     result = a #GAsyncResult.
125 	 *
126 	 * Return: %TRUE if the mount was successfully ejected. %FALSE otherwise.
127 	 *
128 	 * Throws: GException on failure.
129 	 */
130 	public bool ejectFinish(AsyncResultIF result)
131 	{
132 		GError* err = null;
133 		
134 		auto p = g_mount_eject_finish(getMountStruct(), (result is null) ? null : result.getAsyncResultStruct(), &err) != 0;
135 		
136 		if (err !is null)
137 		{
138 			throw new GException( new ErrorG(err) );
139 		}
140 		
141 		return p;
142 	}
143 
144 	/**
145 	 * Ejects a mount. This is an asynchronous operation, and is
146 	 * finished by calling g_mount_eject_with_operation_finish() with the @mount
147 	 * and #GAsyncResult data returned in the @callback.
148 	 *
149 	 * Params:
150 	 *     flags = flags affecting the unmount if required for eject
151 	 *     mountOperation = a #GMountOperation or %NULL to avoid
152 	 *         user interaction.
153 	 *     cancellable = optional #GCancellable object, %NULL to ignore.
154 	 *     callback = a #GAsyncReadyCallback, or %NULL.
155 	 *     userData = user data passed to @callback.
156 	 *
157 	 * Since: 2.22
158 	 */
159 	public void ejectWithOperation(GMountUnmountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
160 	{
161 		g_mount_eject_with_operation(getMountStruct(), flags, (mountOperation is null) ? null : mountOperation.getMountOperationStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
162 	}
163 
164 	/**
165 	 * Finishes ejecting a mount. If any errors occurred during the operation,
166 	 * @error will be set to contain the errors and %FALSE will be returned.
167 	 *
168 	 * Params:
169 	 *     result = a #GAsyncResult.
170 	 *
171 	 * Return: %TRUE if the mount was successfully ejected. %FALSE otherwise.
172 	 *
173 	 * Since: 2.22
174 	 *
175 	 * Throws: GException on failure.
176 	 */
177 	public bool ejectWithOperationFinish(AsyncResultIF result)
178 	{
179 		GError* err = null;
180 		
181 		auto p = g_mount_eject_with_operation_finish(getMountStruct(), (result is null) ? null : result.getAsyncResultStruct(), &err) != 0;
182 		
183 		if (err !is null)
184 		{
185 			throw new GException( new ErrorG(err) );
186 		}
187 		
188 		return p;
189 	}
190 
191 	/**
192 	 * Gets the default location of @mount. The default location of the given
193 	 * @mount is a path that reflects the main entry point for the user (e.g.
194 	 * the home directory, or the root of the volume).
195 	 *
196 	 * Return: a #GFile.
197 	 *     The returned object should be unreffed with
198 	 *     g_object_unref() when no longer needed.
199 	 */
200 	public FileIF getDefaultLocation()
201 	{
202 		auto p = g_mount_get_default_location(getMountStruct());
203 		
204 		if(p is null)
205 		{
206 			return null;
207 		}
208 		
209 		return ObjectG.getDObject!(File, FileIF)(cast(GFile*) p, true);
210 	}
211 
212 	/**
213 	 * Gets the drive for the @mount.
214 	 *
215 	 * This is a convenience method for getting the #GVolume and then
216 	 * using that object to get the #GDrive.
217 	 *
218 	 * Return: a #GDrive or %NULL if @mount is not associated with a volume or a drive.
219 	 *     The returned object should be unreffed with
220 	 *     g_object_unref() when no longer needed.
221 	 */
222 	public DriveIF getDrive()
223 	{
224 		auto p = g_mount_get_drive(getMountStruct());
225 		
226 		if(p is null)
227 		{
228 			return null;
229 		}
230 		
231 		return ObjectG.getDObject!(Drive, DriveIF)(cast(GDrive*) p, true);
232 	}
233 
234 	/**
235 	 * Gets the icon for @mount.
236 	 *
237 	 * Return: a #GIcon.
238 	 *     The returned object should be unreffed with
239 	 *     g_object_unref() when no longer needed.
240 	 */
241 	public IconIF getIcon()
242 	{
243 		auto p = g_mount_get_icon(getMountStruct());
244 		
245 		if(p is null)
246 		{
247 			return null;
248 		}
249 		
250 		return ObjectG.getDObject!(Icon, IconIF)(cast(GIcon*) p, true);
251 	}
252 
253 	/**
254 	 * Gets the name of @mount.
255 	 *
256 	 * Return: the name for the given @mount.
257 	 *     The returned string should be freed with g_free()
258 	 *     when no longer needed.
259 	 */
260 	public string getName()
261 	{
262 		auto retStr = g_mount_get_name(getMountStruct());
263 		
264 		scope(exit) Str.freeString(retStr);
265 		return Str.toString(retStr);
266 	}
267 
268 	/**
269 	 * Gets the root directory on @mount.
270 	 *
271 	 * Return: a #GFile.
272 	 *     The returned object should be unreffed with
273 	 *     g_object_unref() when no longer needed.
274 	 */
275 	public FileIF getRoot()
276 	{
277 		auto p = g_mount_get_root(getMountStruct());
278 		
279 		if(p is null)
280 		{
281 			return null;
282 		}
283 		
284 		return ObjectG.getDObject!(File, FileIF)(cast(GFile*) p, true);
285 	}
286 
287 	/**
288 	 * Gets the sort key for @mount, if any.
289 	 *
290 	 * Return: Sorting key for @mount or %NULL if no such key is available.
291 	 *
292 	 * Since: 2.32
293 	 */
294 	public string getSortKey()
295 	{
296 		return Str.toString(g_mount_get_sort_key(getMountStruct()));
297 	}
298 
299 	/**
300 	 * Gets the symbolic icon for @mount.
301 	 *
302 	 * Return: a #GIcon.
303 	 *     The returned object should be unreffed with
304 	 *     g_object_unref() when no longer needed.
305 	 *
306 	 * Since: 2.34
307 	 */
308 	public IconIF getSymbolicIcon()
309 	{
310 		auto p = g_mount_get_symbolic_icon(getMountStruct());
311 		
312 		if(p is null)
313 		{
314 			return null;
315 		}
316 		
317 		return ObjectG.getDObject!(Icon, IconIF)(cast(GIcon*) p, true);
318 	}
319 
320 	/**
321 	 * Gets the UUID for the @mount. The reference is typically based on
322 	 * the file system UUID for the mount in question and should be
323 	 * considered an opaque string. Returns %NULL if there is no UUID
324 	 * available.
325 	 *
326 	 * Return: the UUID for @mount or %NULL if no UUID can be computed.
327 	 *     The returned string should be freed with g_free()
328 	 *     when no longer needed.
329 	 */
330 	public string getUuid()
331 	{
332 		auto retStr = g_mount_get_uuid(getMountStruct());
333 		
334 		scope(exit) Str.freeString(retStr);
335 		return Str.toString(retStr);
336 	}
337 
338 	/**
339 	 * Gets the volume for the @mount.
340 	 *
341 	 * Return: a #GVolume or %NULL if @mount is not associated with a volume.
342 	 *     The returned object should be unreffed with
343 	 *     g_object_unref() when no longer needed.
344 	 */
345 	public VolumeIF getVolume()
346 	{
347 		auto p = g_mount_get_volume(getMountStruct());
348 		
349 		if(p is null)
350 		{
351 			return null;
352 		}
353 		
354 		return ObjectG.getDObject!(Volume, VolumeIF)(cast(GVolume*) p, true);
355 	}
356 
357 	/**
358 	 * Tries to guess the type of content stored on @mount. Returns one or
359 	 * more textual identifiers of well-known content types (typically
360 	 * prefixed with "x-content/"), e.g. x-content/image-dcf for camera
361 	 * memory cards. See the
362 	 * [shared-mime-info](http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec)
363 	 * specification for more on x-content types.
364 	 *
365 	 * This is an asynchronous operation (see
366 	 * g_mount_guess_content_type_sync() for the synchronous version), and
367 	 * is finished by calling g_mount_guess_content_type_finish() with the
368 	 * @mount and #GAsyncResult data returned in the @callback.
369 	 *
370 	 * Params:
371 	 *     forceRescan = Whether to force a rescan of the content.
372 	 *         Otherwise a cached result will be used if available
373 	 *     cancellable = optional #GCancellable object, %NULL to ignore
374 	 *     callback = a #GAsyncReadyCallback
375 	 *     userData = user data passed to @callback
376 	 *
377 	 * Since: 2.18
378 	 */
379 	public void guessContentType(bool forceRescan, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
380 	{
381 		g_mount_guess_content_type(getMountStruct(), forceRescan, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
382 	}
383 
384 	/**
385 	 * Finishes guessing content types of @mount. If any errors occurred
386 	 * during the operation, @error will be set to contain the errors and
387 	 * %FALSE will be returned. In particular, you may get an
388 	 * %G_IO_ERROR_NOT_SUPPORTED if the mount does not support content
389 	 * guessing.
390 	 *
391 	 * Params:
392 	 *     result = a #GAsyncResult
393 	 *
394 	 * Return: a %NULL-terminated array of content types or %NULL on error.
395 	 *     Caller should free this array with g_strfreev() when done with it.
396 	 *
397 	 * Since: 2.18
398 	 *
399 	 * Throws: GException on failure.
400 	 */
401 	public string[] guessContentTypeFinish(AsyncResultIF result)
402 	{
403 		GError* err = null;
404 		
405 		auto retStr = g_mount_guess_content_type_finish(getMountStruct(), (result is null) ? null : result.getAsyncResultStruct(), &err);
406 		
407 		if (err !is null)
408 		{
409 			throw new GException( new ErrorG(err) );
410 		}
411 		
412 		scope(exit) Str.freeStringArray(retStr);
413 		return Str.toStringArray(retStr);
414 	}
415 
416 	/**
417 	 * Tries to guess the type of content stored on @mount. Returns one or
418 	 * more textual identifiers of well-known content types (typically
419 	 * prefixed with "x-content/"), e.g. x-content/image-dcf for camera
420 	 * memory cards. See the
421 	 * [shared-mime-info](http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec)
422 	 * specification for more on x-content types.
423 	 *
424 	 * This is an synchronous operation and as such may block doing IO;
425 	 * see g_mount_guess_content_type() for the asynchronous version.
426 	 *
427 	 * Params:
428 	 *     forceRescan = Whether to force a rescan of the content.
429 	 *         Otherwise a cached result will be used if available
430 	 *     cancellable = optional #GCancellable object, %NULL to ignore
431 	 *
432 	 * Return: a %NULL-terminated array of content types or %NULL on error.
433 	 *     Caller should free this array with g_strfreev() when done with it.
434 	 *
435 	 * Since: 2.18
436 	 *
437 	 * Throws: GException on failure.
438 	 */
439 	public string[] guessContentTypeSync(bool forceRescan, Cancellable cancellable)
440 	{
441 		GError* err = null;
442 		
443 		auto retStr = g_mount_guess_content_type_sync(getMountStruct(), forceRescan, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
444 		
445 		if (err !is null)
446 		{
447 			throw new GException( new ErrorG(err) );
448 		}
449 		
450 		scope(exit) Str.freeStringArray(retStr);
451 		return Str.toStringArray(retStr);
452 	}
453 
454 	/**
455 	 * Determines if @mount is shadowed. Applications or libraries should
456 	 * avoid displaying @mount in the user interface if it is shadowed.
457 	 *
458 	 * A mount is said to be shadowed if there exists one or more user
459 	 * visible objects (currently #GMount objects) with a root that is
460 	 * inside the root of @mount.
461 	 *
462 	 * One application of shadow mounts is when exposing a single file
463 	 * system that is used to address several logical volumes. In this
464 	 * situation, a #GVolumeMonitor implementation would create two
465 	 * #GVolume objects (for example, one for the camera functionality of
466 	 * the device and one for a SD card reader on the device) with
467 	 * activation URIs `gphoto2://[usb:001,002]/store1/`
468 	 * and `gphoto2://[usb:001,002]/store2/`. When the
469 	 * underlying mount (with root
470 	 * `gphoto2://[usb:001,002]/`) is mounted, said
471 	 * #GVolumeMonitor implementation would create two #GMount objects
472 	 * (each with their root matching the corresponding volume activation
473 	 * root) that would shadow the original mount.
474 	 *
475 	 * The proxy monitor in GVfs 2.26 and later, automatically creates and
476 	 * manage shadow mounts (and shadows the underlying mount) if the
477 	 * activation root on a #GVolume is set.
478 	 *
479 	 * Return: %TRUE if @mount is shadowed.
480 	 *
481 	 * Since: 2.20
482 	 */
483 	public bool isShadowed()
484 	{
485 		return g_mount_is_shadowed(getMountStruct()) != 0;
486 	}
487 
488 	/**
489 	 * Remounts a mount. This is an asynchronous operation, and is
490 	 * finished by calling g_mount_remount_finish() with the @mount
491 	 * and #GAsyncResults data returned in the @callback.
492 	 *
493 	 * Remounting is useful when some setting affecting the operation
494 	 * of the volume has been changed, as these may need a remount to
495 	 * take affect. While this is semantically equivalent with unmounting
496 	 * and then remounting not all backends might need to actually be
497 	 * unmounted.
498 	 *
499 	 * Params:
500 	 *     flags = flags affecting the operation
501 	 *     mountOperation = a #GMountOperation or %NULL to avoid
502 	 *         user interaction.
503 	 *     cancellable = optional #GCancellable object, %NULL to ignore.
504 	 *     callback = a #GAsyncReadyCallback, or %NULL.
505 	 *     userData = user data passed to @callback.
506 	 */
507 	public void remount(GMountMountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
508 	{
509 		g_mount_remount(getMountStruct(), flags, (mountOperation is null) ? null : mountOperation.getMountOperationStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
510 	}
511 
512 	/**
513 	 * Finishes remounting a mount. If any errors occurred during the operation,
514 	 * @error will be set to contain the errors and %FALSE will be returned.
515 	 *
516 	 * Params:
517 	 *     result = a #GAsyncResult.
518 	 *
519 	 * Return: %TRUE if the mount was successfully remounted. %FALSE otherwise.
520 	 *
521 	 * Throws: GException on failure.
522 	 */
523 	public bool remountFinish(AsyncResultIF result)
524 	{
525 		GError* err = null;
526 		
527 		auto p = g_mount_remount_finish(getMountStruct(), (result is null) ? null : result.getAsyncResultStruct(), &err) != 0;
528 		
529 		if (err !is null)
530 		{
531 			throw new GException( new ErrorG(err) );
532 		}
533 		
534 		return p;
535 	}
536 
537 	/**
538 	 * Increments the shadow count on @mount. Usually used by
539 	 * #GVolumeMonitor implementations when creating a shadow mount for
540 	 * @mount, see g_mount_is_shadowed() for more information. The caller
541 	 * will need to emit the #GMount::changed signal on @mount manually.
542 	 *
543 	 * Since: 2.20
544 	 */
545 	public void shadow()
546 	{
547 		g_mount_shadow(getMountStruct());
548 	}
549 
550 	/**
551 	 * Unmounts a mount. This is an asynchronous operation, and is
552 	 * finished by calling g_mount_unmount_finish() with the @mount
553 	 * and #GAsyncResult data returned in the @callback.
554 	 *
555 	 * Deprecated: Use g_mount_unmount_with_operation() instead.
556 	 *
557 	 * Params:
558 	 *     flags = flags affecting the operation
559 	 *     cancellable = optional #GCancellable object, %NULL to ignore.
560 	 *     callback = a #GAsyncReadyCallback, or %NULL.
561 	 *     userData = user data passed to @callback.
562 	 */
563 	public void unmount(GMountUnmountFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
564 	{
565 		g_mount_unmount(getMountStruct(), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
566 	}
567 
568 	/**
569 	 * Finishes unmounting a mount. If any errors occurred during the operation,
570 	 * @error will be set to contain the errors and %FALSE will be returned.
571 	 *
572 	 * Deprecated: Use g_mount_unmount_with_operation_finish() instead.
573 	 *
574 	 * Params:
575 	 *     result = a #GAsyncResult.
576 	 *
577 	 * Return: %TRUE if the mount was successfully unmounted. %FALSE otherwise.
578 	 *
579 	 * Throws: GException on failure.
580 	 */
581 	public bool unmountFinish(AsyncResultIF result)
582 	{
583 		GError* err = null;
584 		
585 		auto p = g_mount_unmount_finish(getMountStruct(), (result is null) ? null : result.getAsyncResultStruct(), &err) != 0;
586 		
587 		if (err !is null)
588 		{
589 			throw new GException( new ErrorG(err) );
590 		}
591 		
592 		return p;
593 	}
594 
595 	/**
596 	 * Unmounts a mount. This is an asynchronous operation, and is
597 	 * finished by calling g_mount_unmount_with_operation_finish() with the @mount
598 	 * and #GAsyncResult data returned in the @callback.
599 	 *
600 	 * Params:
601 	 *     flags = flags affecting the operation
602 	 *     mountOperation = a #GMountOperation or %NULL to avoid
603 	 *         user interaction.
604 	 *     cancellable = optional #GCancellable object, %NULL to ignore.
605 	 *     callback = a #GAsyncReadyCallback, or %NULL.
606 	 *     userData = user data passed to @callback.
607 	 *
608 	 * Since: 2.22
609 	 */
610 	public void unmountWithOperation(GMountUnmountFlags flags, MountOperation mountOperation, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
611 	{
612 		g_mount_unmount_with_operation(getMountStruct(), flags, (mountOperation is null) ? null : mountOperation.getMountOperationStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
613 	}
614 
615 	/**
616 	 * Finishes unmounting a mount. If any errors occurred during the operation,
617 	 * @error will be set to contain the errors and %FALSE will be returned.
618 	 *
619 	 * Params:
620 	 *     result = a #GAsyncResult.
621 	 *
622 	 * Return: %TRUE if the mount was successfully unmounted. %FALSE otherwise.
623 	 *
624 	 * Since: 2.22
625 	 *
626 	 * Throws: GException on failure.
627 	 */
628 	public bool unmountWithOperationFinish(AsyncResultIF result)
629 	{
630 		GError* err = null;
631 		
632 		auto p = g_mount_unmount_with_operation_finish(getMountStruct(), (result is null) ? null : result.getAsyncResultStruct(), &err) != 0;
633 		
634 		if (err !is null)
635 		{
636 			throw new GException( new ErrorG(err) );
637 		}
638 		
639 		return p;
640 	}
641 
642 	/**
643 	 * Decrements the shadow count on @mount. Usually used by
644 	 * #GVolumeMonitor implementations when destroying a shadow mount for
645 	 * @mount, see g_mount_is_shadowed() for more information. The caller
646 	 * will need to emit the #GMount::changed signal on @mount manually.
647 	 *
648 	 * Since: 2.20
649 	 */
650 	public void unshadow()
651 	{
652 		g_mount_unshadow(getMountStruct());
653 	}
654 
655 	protected class OnChangedDelegateWrapper
656 	{
657 		void delegate(MountIF) dlg;
658 		gulong handlerId;
659 		ConnectFlags flags;
660 		this(void delegate(MountIF) dlg, gulong handlerId, ConnectFlags flags)
661 		{
662 			this.dlg = dlg;
663 			this.handlerId = handlerId;
664 			this.flags = flags;
665 		}
666 	}
667 	protected OnChangedDelegateWrapper[] onChangedListeners;
668 
669 	/**
670 	 * Emitted when the mount has been changed.
671 	 */
672 	gulong addOnChanged(void delegate(MountIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
673 	{
674 		onChangedListeners ~= new OnChangedDelegateWrapper(dlg, 0, connectFlags);
675 		onChangedListeners[onChangedListeners.length - 1].handlerId = Signals.connectData(
676 			this,
677 			"changed",
678 			cast(GCallback)&callBackChanged,
679 			cast(void*)onChangedListeners[onChangedListeners.length - 1],
680 			cast(GClosureNotify)&callBackChangedDestroy,
681 			connectFlags);
682 		return onChangedListeners[onChangedListeners.length - 1].handlerId;
683 	}
684 	
685 	extern(C) static void callBackChanged(GMount* mountStruct,OnChangedDelegateWrapper wrapper)
686 	{
687 		wrapper.dlg(wrapper.outer);
688 	}
689 	
690 	extern(C) static void callBackChangedDestroy(OnChangedDelegateWrapper wrapper, GClosure* closure)
691 	{
692 		wrapper.outer.internalRemoveOnChanged(wrapper);
693 	}
694 
695 	protected void internalRemoveOnChanged(OnChangedDelegateWrapper source)
696 	{
697 		foreach(index, wrapper; onChangedListeners)
698 		{
699 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
700 			{
701 				onChangedListeners[index] = null;
702 				onChangedListeners = std.algorithm.remove(onChangedListeners, index);
703 				break;
704 			}
705 		}
706 	}
707 	
708 
709 	protected class OnPreUnmountDelegateWrapper
710 	{
711 		void delegate(MountIF) dlg;
712 		gulong handlerId;
713 		ConnectFlags flags;
714 		this(void delegate(MountIF) dlg, gulong handlerId, ConnectFlags flags)
715 		{
716 			this.dlg = dlg;
717 			this.handlerId = handlerId;
718 			this.flags = flags;
719 		}
720 	}
721 	protected OnPreUnmountDelegateWrapper[] onPreUnmountListeners;
722 
723 	/**
724 	 * This signal is emitted when the #GMount is about to be
725 	 * unmounted.
726 	 *
727 	 * Since: 2.22
728 	 */
729 	gulong addOnPreUnmount(void delegate(MountIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
730 	{
731 		onPreUnmountListeners ~= new OnPreUnmountDelegateWrapper(dlg, 0, connectFlags);
732 		onPreUnmountListeners[onPreUnmountListeners.length - 1].handlerId = Signals.connectData(
733 			this,
734 			"pre-unmount",
735 			cast(GCallback)&callBackPreUnmount,
736 			cast(void*)onPreUnmountListeners[onPreUnmountListeners.length - 1],
737 			cast(GClosureNotify)&callBackPreUnmountDestroy,
738 			connectFlags);
739 		return onPreUnmountListeners[onPreUnmountListeners.length - 1].handlerId;
740 	}
741 	
742 	extern(C) static void callBackPreUnmount(GMount* mountStruct,OnPreUnmountDelegateWrapper wrapper)
743 	{
744 		wrapper.dlg(wrapper.outer);
745 	}
746 	
747 	extern(C) static void callBackPreUnmountDestroy(OnPreUnmountDelegateWrapper wrapper, GClosure* closure)
748 	{
749 		wrapper.outer.internalRemoveOnPreUnmount(wrapper);
750 	}
751 
752 	protected void internalRemoveOnPreUnmount(OnPreUnmountDelegateWrapper source)
753 	{
754 		foreach(index, wrapper; onPreUnmountListeners)
755 		{
756 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
757 			{
758 				onPreUnmountListeners[index] = null;
759 				onPreUnmountListeners = std.algorithm.remove(onPreUnmountListeners, index);
760 				break;
761 			}
762 		}
763 	}
764 	
765 
766 	protected class OnUnmountedDelegateWrapper
767 	{
768 		void delegate(MountIF) dlg;
769 		gulong handlerId;
770 		ConnectFlags flags;
771 		this(void delegate(MountIF) dlg, gulong handlerId, ConnectFlags flags)
772 		{
773 			this.dlg = dlg;
774 			this.handlerId = handlerId;
775 			this.flags = flags;
776 		}
777 	}
778 	protected OnUnmountedDelegateWrapper[] onUnmountedListeners;
779 
780 	/**
781 	 * This signal is emitted when the #GMount have been
782 	 * unmounted. If the recipient is holding references to the
783 	 * object they should release them so the object can be
784 	 * finalized.
785 	 */
786 	gulong addOnUnmounted(void delegate(MountIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
787 	{
788 		onUnmountedListeners ~= new OnUnmountedDelegateWrapper(dlg, 0, connectFlags);
789 		onUnmountedListeners[onUnmountedListeners.length - 1].handlerId = Signals.connectData(
790 			this,
791 			"unmounted",
792 			cast(GCallback)&callBackUnmounted,
793 			cast(void*)onUnmountedListeners[onUnmountedListeners.length - 1],
794 			cast(GClosureNotify)&callBackUnmountedDestroy,
795 			connectFlags);
796 		return onUnmountedListeners[onUnmountedListeners.length - 1].handlerId;
797 	}
798 	
799 	extern(C) static void callBackUnmounted(GMount* mountStruct,OnUnmountedDelegateWrapper wrapper)
800 	{
801 		wrapper.dlg(wrapper.outer);
802 	}
803 	
804 	extern(C) static void callBackUnmountedDestroy(OnUnmountedDelegateWrapper wrapper, GClosure* closure)
805 	{
806 		wrapper.outer.internalRemoveOnUnmounted(wrapper);
807 	}
808 
809 	protected void internalRemoveOnUnmounted(OnUnmountedDelegateWrapper source)
810 	{
811 		foreach(index, wrapper; onUnmountedListeners)
812 		{
813 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
814 			{
815 				onUnmountedListeners[index] = null;
816 				onUnmountedListeners = std.algorithm.remove(onUnmountedListeners, index);
817 				break;
818 			}
819 		}
820 	}
821 	
822 }