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.VolumeMonitor;
26 
27 private import gio.Drive;
28 private import gio.DriveIF;
29 private import gio.Mount;
30 private import gio.MountIF;
31 private import gio.Volume;
32 private import gio.VolumeIF;
33 private import glib.ConstructionException;
34 private import glib.ListG;
35 private import glib.Str;
36 private import gobject.ObjectG;
37 private import gobject.Signals;
38 private import gtkc.gio;
39 public  import gtkc.giotypes;
40 private import std.algorithm;
41 
42 
43 /**
44  * #GVolumeMonitor is for listing the user interesting devices and volumes
45  * on the computer. In other words, what a file selector or file manager
46  * would show in a sidebar.
47  * 
48  * #GVolumeMonitor is not
49  * [thread-default-context aware][g-main-context-push-thread-default],
50  * and so should not be used other than from the main thread, with no
51  * thread-default-context active.
52  */
53 public class VolumeMonitor : ObjectG
54 {
55 	/** the main Gtk struct */
56 	protected GVolumeMonitor* gVolumeMonitor;
57 
58 	/** Get the main Gtk struct */
59 	public GVolumeMonitor* getVolumeMonitorStruct(bool transferOwnership = false)
60 	{
61 		if (transferOwnership)
62 			ownedRef = false;
63 		return gVolumeMonitor;
64 	}
65 
66 	/** the main Gtk struct as a void* */
67 	protected override void* getStruct()
68 	{
69 		return cast(void*)gVolumeMonitor;
70 	}
71 
72 	protected override void setStruct(GObject* obj)
73 	{
74 		gVolumeMonitor = cast(GVolumeMonitor*)obj;
75 		super.setStruct(obj);
76 	}
77 
78 	/**
79 	 * Sets our main struct and passes it to the parent class.
80 	 */
81 	public this (GVolumeMonitor* gVolumeMonitor, bool ownedRef = false)
82 	{
83 		this.gVolumeMonitor = gVolumeMonitor;
84 		super(cast(GObject*)gVolumeMonitor, ownedRef);
85 	}
86 
87 	/**
88 	 * Gets the volume monitor used by gio.
89 	 *
90 	 * Return: a reference to the #GVolumeMonitor used by gio. Call
91 	 *     g_object_unref() when done with it.
92 	 */
93 	public this()
94 	{
95 		auto p = g_volume_monitor_get();
96 		
97 		if(p is null)
98 		{
99 			throw new ConstructionException("g_volume_monitor_get()");
100 		}
101 		
102 		this(cast(GVolumeMonitor*) p, true);
103 	}
104 
105 	/**
106 	 */
107 
108 	/** */
109 	public static GType getType()
110 	{
111 		return g_volume_monitor_get_type();
112 	}
113 
114 	/**
115 	 * This function should be called by any #GVolumeMonitor
116 	 * implementation when a new #GMount object is created that is not
117 	 * associated with a #GVolume object. It must be called just before
118 	 * emitting the @mount_added signal.
119 	 *
120 	 * If the return value is not %NULL, the caller must associate the
121 	 * returned #GVolume object with the #GMount. This involves returning
122 	 * it in its g_mount_get_volume() implementation. The caller must
123 	 * also listen for the "removed" signal on the returned object
124 	 * and give up its reference when handling that signal
125 	 *
126 	 * Similary, if implementing g_volume_monitor_adopt_orphan_mount(),
127 	 * the implementor must take a reference to @mount and return it in
128 	 * its g_volume_get_mount() implemented. Also, the implementor must
129 	 * listen for the "unmounted" signal on @mount and give up its
130 	 * reference upon handling that signal.
131 	 *
132 	 * There are two main use cases for this function.
133 	 *
134 	 * One is when implementing a user space file system driver that reads
135 	 * blocks of a block device that is already represented by the native
136 	 * volume monitor (for example a CD Audio file system driver). Such
137 	 * a driver will generate its own #GMount object that needs to be
138 	 * associated with the #GVolume object that represents the volume.
139 	 *
140 	 * The other is for implementing a #GVolumeMonitor whose sole purpose
141 	 * is to return #GVolume objects representing entries in the users
142 	 * "favorite servers" list or similar.
143 	 *
144 	 * Deprecated: Instead of using this function, #GVolumeMonitor
145 	 * implementations should instead create shadow mounts with the URI of
146 	 * the mount they intend to adopt. See the proxy volume monitor in
147 	 * gvfs for an example of this. Also see g_mount_is_shadowed(),
148 	 * g_mount_shadow() and g_mount_unshadow() functions.
149 	 *
150 	 * Params:
151 	 *     mount = a #GMount object to find a parent for
152 	 *
153 	 * Returns: the #GVolume object that is the parent for @mount or %NULL
154 	 *     if no wants to adopt the #GMount.
155 	 */
156 	public static VolumeIF adoptOrphanMount(MountIF mount)
157 	{
158 		auto p = g_volume_monitor_adopt_orphan_mount((mount is null) ? null : mount.getMountStruct());
159 		
160 		if(p is null)
161 		{
162 			return null;
163 		}
164 		
165 		return ObjectG.getDObject!(Volume, VolumeIF)(cast(GVolume*) p, true);
166 	}
167 
168 	/**
169 	 * Gets a list of drives connected to the system.
170 	 *
171 	 * The returned list should be freed with g_list_free(), after
172 	 * its elements have been unreffed with g_object_unref().
173 	 *
174 	 * Returns: a #GList of connected #GDrive objects.
175 	 */
176 	public ListG getConnectedDrives()
177 	{
178 		auto p = g_volume_monitor_get_connected_drives(gVolumeMonitor);
179 		
180 		if(p is null)
181 		{
182 			return null;
183 		}
184 		
185 		return new ListG(cast(GList*) p, true);
186 	}
187 
188 	/**
189 	 * Finds a #GMount object by its UUID (see g_mount_get_uuid())
190 	 *
191 	 * Params:
192 	 *     uuid = the UUID to look for
193 	 *
194 	 * Returns: a #GMount or %NULL if no such mount is available.
195 	 *     Free the returned object with g_object_unref().
196 	 */
197 	public MountIF getMountForUuid(string uuid)
198 	{
199 		auto p = g_volume_monitor_get_mount_for_uuid(gVolumeMonitor, Str.toStringz(uuid));
200 		
201 		if(p is null)
202 		{
203 			return null;
204 		}
205 		
206 		return ObjectG.getDObject!(Mount, MountIF)(cast(GMount*) p, true);
207 	}
208 
209 	/**
210 	 * Gets a list of the mounts on the system.
211 	 *
212 	 * The returned list should be freed with g_list_free(), after
213 	 * its elements have been unreffed with g_object_unref().
214 	 *
215 	 * Returns: a #GList of #GMount objects.
216 	 */
217 	public ListG getMounts()
218 	{
219 		auto p = g_volume_monitor_get_mounts(gVolumeMonitor);
220 		
221 		if(p is null)
222 		{
223 			return null;
224 		}
225 		
226 		return new ListG(cast(GList*) p, true);
227 	}
228 
229 	/**
230 	 * Finds a #GVolume object by its UUID (see g_volume_get_uuid())
231 	 *
232 	 * Params:
233 	 *     uuid = the UUID to look for
234 	 *
235 	 * Returns: a #GVolume or %NULL if no such volume is available.
236 	 *     Free the returned object with g_object_unref().
237 	 */
238 	public VolumeIF getVolumeForUuid(string uuid)
239 	{
240 		auto p = g_volume_monitor_get_volume_for_uuid(gVolumeMonitor, Str.toStringz(uuid));
241 		
242 		if(p is null)
243 		{
244 			return null;
245 		}
246 		
247 		return ObjectG.getDObject!(Volume, VolumeIF)(cast(GVolume*) p, true);
248 	}
249 
250 	/**
251 	 * Gets a list of the volumes on the system.
252 	 *
253 	 * The returned list should be freed with g_list_free(), after
254 	 * its elements have been unreffed with g_object_unref().
255 	 *
256 	 * Returns: a #GList of #GVolume objects.
257 	 */
258 	public ListG getVolumes()
259 	{
260 		auto p = g_volume_monitor_get_volumes(gVolumeMonitor);
261 		
262 		if(p is null)
263 		{
264 			return null;
265 		}
266 		
267 		return new ListG(cast(GList*) p, true);
268 	}
269 
270 	protected class OnDriveChangedDelegateWrapper
271 	{
272 		static OnDriveChangedDelegateWrapper[] listeners;
273 		void delegate(DriveIF, VolumeMonitor) dlg;
274 		gulong handlerId;
275 		
276 		this(void delegate(DriveIF, VolumeMonitor) dlg)
277 		{
278 			this.dlg = dlg;
279 			this.listeners ~= this;
280 		}
281 		
282 		void remove(OnDriveChangedDelegateWrapper source)
283 		{
284 			foreach(index, wrapper; listeners)
285 			{
286 				if (wrapper.handlerId == source.handlerId)
287 				{
288 					listeners[index] = null;
289 					listeners = std.algorithm.remove(listeners, index);
290 					break;
291 				}
292 			}
293 		}
294 	}
295 
296 	/**
297 	 * Emitted when a drive changes.
298 	 *
299 	 * Params:
300 	 *     drive = the drive that changed
301 	 */
302 	gulong addOnDriveChanged(void delegate(DriveIF, VolumeMonitor) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
303 	{
304 		auto wrapper = new OnDriveChangedDelegateWrapper(dlg);
305 		wrapper.handlerId = Signals.connectData(
306 			this,
307 			"drive-changed",
308 			cast(GCallback)&callBackDriveChanged,
309 			cast(void*)wrapper,
310 			cast(GClosureNotify)&callBackDriveChangedDestroy,
311 			connectFlags);
312 		return wrapper.handlerId;
313 	}
314 	
315 	extern(C) static void callBackDriveChanged(GVolumeMonitor* volumemonitorStruct, GDrive* drive, OnDriveChangedDelegateWrapper wrapper)
316 	{
317 		wrapper.dlg(ObjectG.getDObject!(Drive, DriveIF)(drive), wrapper.outer);
318 	}
319 	
320 	extern(C) static void callBackDriveChangedDestroy(OnDriveChangedDelegateWrapper wrapper, GClosure* closure)
321 	{
322 		wrapper.remove(wrapper);
323 	}
324 
325 	protected class OnDriveConnectedDelegateWrapper
326 	{
327 		static OnDriveConnectedDelegateWrapper[] listeners;
328 		void delegate(DriveIF, VolumeMonitor) dlg;
329 		gulong handlerId;
330 		
331 		this(void delegate(DriveIF, VolumeMonitor) dlg)
332 		{
333 			this.dlg = dlg;
334 			this.listeners ~= this;
335 		}
336 		
337 		void remove(OnDriveConnectedDelegateWrapper source)
338 		{
339 			foreach(index, wrapper; listeners)
340 			{
341 				if (wrapper.handlerId == source.handlerId)
342 				{
343 					listeners[index] = null;
344 					listeners = std.algorithm.remove(listeners, index);
345 					break;
346 				}
347 			}
348 		}
349 	}
350 
351 	/**
352 	 * Emitted when a drive is connected to the system.
353 	 *
354 	 * Params:
355 	 *     drive = a #GDrive that was connected.
356 	 */
357 	gulong addOnDriveConnected(void delegate(DriveIF, VolumeMonitor) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
358 	{
359 		auto wrapper = new OnDriveConnectedDelegateWrapper(dlg);
360 		wrapper.handlerId = Signals.connectData(
361 			this,
362 			"drive-connected",
363 			cast(GCallback)&callBackDriveConnected,
364 			cast(void*)wrapper,
365 			cast(GClosureNotify)&callBackDriveConnectedDestroy,
366 			connectFlags);
367 		return wrapper.handlerId;
368 	}
369 	
370 	extern(C) static void callBackDriveConnected(GVolumeMonitor* volumemonitorStruct, GDrive* drive, OnDriveConnectedDelegateWrapper wrapper)
371 	{
372 		wrapper.dlg(ObjectG.getDObject!(Drive, DriveIF)(drive), wrapper.outer);
373 	}
374 	
375 	extern(C) static void callBackDriveConnectedDestroy(OnDriveConnectedDelegateWrapper wrapper, GClosure* closure)
376 	{
377 		wrapper.remove(wrapper);
378 	}
379 
380 	protected class OnDriveDisconnectedDelegateWrapper
381 	{
382 		static OnDriveDisconnectedDelegateWrapper[] listeners;
383 		void delegate(DriveIF, VolumeMonitor) dlg;
384 		gulong handlerId;
385 		
386 		this(void delegate(DriveIF, VolumeMonitor) dlg)
387 		{
388 			this.dlg = dlg;
389 			this.listeners ~= this;
390 		}
391 		
392 		void remove(OnDriveDisconnectedDelegateWrapper source)
393 		{
394 			foreach(index, wrapper; listeners)
395 			{
396 				if (wrapper.handlerId == source.handlerId)
397 				{
398 					listeners[index] = null;
399 					listeners = std.algorithm.remove(listeners, index);
400 					break;
401 				}
402 			}
403 		}
404 	}
405 
406 	/**
407 	 * Emitted when a drive is disconnected from the system.
408 	 *
409 	 * Params:
410 	 *     drive = a #GDrive that was disconnected.
411 	 */
412 	gulong addOnDriveDisconnected(void delegate(DriveIF, VolumeMonitor) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
413 	{
414 		auto wrapper = new OnDriveDisconnectedDelegateWrapper(dlg);
415 		wrapper.handlerId = Signals.connectData(
416 			this,
417 			"drive-disconnected",
418 			cast(GCallback)&callBackDriveDisconnected,
419 			cast(void*)wrapper,
420 			cast(GClosureNotify)&callBackDriveDisconnectedDestroy,
421 			connectFlags);
422 		return wrapper.handlerId;
423 	}
424 	
425 	extern(C) static void callBackDriveDisconnected(GVolumeMonitor* volumemonitorStruct, GDrive* drive, OnDriveDisconnectedDelegateWrapper wrapper)
426 	{
427 		wrapper.dlg(ObjectG.getDObject!(Drive, DriveIF)(drive), wrapper.outer);
428 	}
429 	
430 	extern(C) static void callBackDriveDisconnectedDestroy(OnDriveDisconnectedDelegateWrapper wrapper, GClosure* closure)
431 	{
432 		wrapper.remove(wrapper);
433 	}
434 
435 	protected class OnDriveEjectButtonDelegateWrapper
436 	{
437 		static OnDriveEjectButtonDelegateWrapper[] listeners;
438 		void delegate(DriveIF, VolumeMonitor) dlg;
439 		gulong handlerId;
440 		
441 		this(void delegate(DriveIF, VolumeMonitor) dlg)
442 		{
443 			this.dlg = dlg;
444 			this.listeners ~= this;
445 		}
446 		
447 		void remove(OnDriveEjectButtonDelegateWrapper source)
448 		{
449 			foreach(index, wrapper; listeners)
450 			{
451 				if (wrapper.handlerId == source.handlerId)
452 				{
453 					listeners[index] = null;
454 					listeners = std.algorithm.remove(listeners, index);
455 					break;
456 				}
457 			}
458 		}
459 	}
460 
461 	/**
462 	 * Emitted when the eject button is pressed on @drive.
463 	 *
464 	 * Params:
465 	 *     drive = the drive where the eject button was pressed
466 	 *
467 	 * Since: 2.18
468 	 */
469 	gulong addOnDriveEjectButton(void delegate(DriveIF, VolumeMonitor) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
470 	{
471 		auto wrapper = new OnDriveEjectButtonDelegateWrapper(dlg);
472 		wrapper.handlerId = Signals.connectData(
473 			this,
474 			"drive-eject-button",
475 			cast(GCallback)&callBackDriveEjectButton,
476 			cast(void*)wrapper,
477 			cast(GClosureNotify)&callBackDriveEjectButtonDestroy,
478 			connectFlags);
479 		return wrapper.handlerId;
480 	}
481 	
482 	extern(C) static void callBackDriveEjectButton(GVolumeMonitor* volumemonitorStruct, GDrive* drive, OnDriveEjectButtonDelegateWrapper wrapper)
483 	{
484 		wrapper.dlg(ObjectG.getDObject!(Drive, DriveIF)(drive), wrapper.outer);
485 	}
486 	
487 	extern(C) static void callBackDriveEjectButtonDestroy(OnDriveEjectButtonDelegateWrapper wrapper, GClosure* closure)
488 	{
489 		wrapper.remove(wrapper);
490 	}
491 
492 	protected class OnDriveStopButtonDelegateWrapper
493 	{
494 		static OnDriveStopButtonDelegateWrapper[] listeners;
495 		void delegate(DriveIF, VolumeMonitor) dlg;
496 		gulong handlerId;
497 		
498 		this(void delegate(DriveIF, VolumeMonitor) dlg)
499 		{
500 			this.dlg = dlg;
501 			this.listeners ~= this;
502 		}
503 		
504 		void remove(OnDriveStopButtonDelegateWrapper source)
505 		{
506 			foreach(index, wrapper; listeners)
507 			{
508 				if (wrapper.handlerId == source.handlerId)
509 				{
510 					listeners[index] = null;
511 					listeners = std.algorithm.remove(listeners, index);
512 					break;
513 				}
514 			}
515 		}
516 	}
517 
518 	/**
519 	 * Emitted when the stop button is pressed on @drive.
520 	 *
521 	 * Params:
522 	 *     drive = the drive where the stop button was pressed
523 	 *
524 	 * Since: 2.22
525 	 */
526 	gulong addOnDriveStopButton(void delegate(DriveIF, VolumeMonitor) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
527 	{
528 		auto wrapper = new OnDriveStopButtonDelegateWrapper(dlg);
529 		wrapper.handlerId = Signals.connectData(
530 			this,
531 			"drive-stop-button",
532 			cast(GCallback)&callBackDriveStopButton,
533 			cast(void*)wrapper,
534 			cast(GClosureNotify)&callBackDriveStopButtonDestroy,
535 			connectFlags);
536 		return wrapper.handlerId;
537 	}
538 	
539 	extern(C) static void callBackDriveStopButton(GVolumeMonitor* volumemonitorStruct, GDrive* drive, OnDriveStopButtonDelegateWrapper wrapper)
540 	{
541 		wrapper.dlg(ObjectG.getDObject!(Drive, DriveIF)(drive), wrapper.outer);
542 	}
543 	
544 	extern(C) static void callBackDriveStopButtonDestroy(OnDriveStopButtonDelegateWrapper wrapper, GClosure* closure)
545 	{
546 		wrapper.remove(wrapper);
547 	}
548 
549 	protected class OnMountAddedDelegateWrapper
550 	{
551 		static OnMountAddedDelegateWrapper[] listeners;
552 		void delegate(MountIF, VolumeMonitor) dlg;
553 		gulong handlerId;
554 		
555 		this(void delegate(MountIF, VolumeMonitor) dlg)
556 		{
557 			this.dlg = dlg;
558 			this.listeners ~= this;
559 		}
560 		
561 		void remove(OnMountAddedDelegateWrapper source)
562 		{
563 			foreach(index, wrapper; listeners)
564 			{
565 				if (wrapper.handlerId == source.handlerId)
566 				{
567 					listeners[index] = null;
568 					listeners = std.algorithm.remove(listeners, index);
569 					break;
570 				}
571 			}
572 		}
573 	}
574 
575 	/**
576 	 * Emitted when a mount is added.
577 	 *
578 	 * Params:
579 	 *     mount = a #GMount that was added.
580 	 */
581 	gulong addOnMountAdded(void delegate(MountIF, VolumeMonitor) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
582 	{
583 		auto wrapper = new OnMountAddedDelegateWrapper(dlg);
584 		wrapper.handlerId = Signals.connectData(
585 			this,
586 			"mount-added",
587 			cast(GCallback)&callBackMountAdded,
588 			cast(void*)wrapper,
589 			cast(GClosureNotify)&callBackMountAddedDestroy,
590 			connectFlags);
591 		return wrapper.handlerId;
592 	}
593 	
594 	extern(C) static void callBackMountAdded(GVolumeMonitor* volumemonitorStruct, GMount* mount, OnMountAddedDelegateWrapper wrapper)
595 	{
596 		wrapper.dlg(ObjectG.getDObject!(Mount, MountIF)(mount), wrapper.outer);
597 	}
598 	
599 	extern(C) static void callBackMountAddedDestroy(OnMountAddedDelegateWrapper wrapper, GClosure* closure)
600 	{
601 		wrapper.remove(wrapper);
602 	}
603 
604 	protected class OnMountChangedDelegateWrapper
605 	{
606 		static OnMountChangedDelegateWrapper[] listeners;
607 		void delegate(MountIF, VolumeMonitor) dlg;
608 		gulong handlerId;
609 		
610 		this(void delegate(MountIF, VolumeMonitor) dlg)
611 		{
612 			this.dlg = dlg;
613 			this.listeners ~= this;
614 		}
615 		
616 		void remove(OnMountChangedDelegateWrapper source)
617 		{
618 			foreach(index, wrapper; listeners)
619 			{
620 				if (wrapper.handlerId == source.handlerId)
621 				{
622 					listeners[index] = null;
623 					listeners = std.algorithm.remove(listeners, index);
624 					break;
625 				}
626 			}
627 		}
628 	}
629 
630 	/**
631 	 * Emitted when a mount changes.
632 	 *
633 	 * Params:
634 	 *     mount = a #GMount that changed.
635 	 */
636 	gulong addOnMountChanged(void delegate(MountIF, VolumeMonitor) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
637 	{
638 		auto wrapper = new OnMountChangedDelegateWrapper(dlg);
639 		wrapper.handlerId = Signals.connectData(
640 			this,
641 			"mount-changed",
642 			cast(GCallback)&callBackMountChanged,
643 			cast(void*)wrapper,
644 			cast(GClosureNotify)&callBackMountChangedDestroy,
645 			connectFlags);
646 		return wrapper.handlerId;
647 	}
648 	
649 	extern(C) static void callBackMountChanged(GVolumeMonitor* volumemonitorStruct, GMount* mount, OnMountChangedDelegateWrapper wrapper)
650 	{
651 		wrapper.dlg(ObjectG.getDObject!(Mount, MountIF)(mount), wrapper.outer);
652 	}
653 	
654 	extern(C) static void callBackMountChangedDestroy(OnMountChangedDelegateWrapper wrapper, GClosure* closure)
655 	{
656 		wrapper.remove(wrapper);
657 	}
658 
659 	protected class OnMountPreUnmountDelegateWrapper
660 	{
661 		static OnMountPreUnmountDelegateWrapper[] listeners;
662 		void delegate(MountIF, VolumeMonitor) dlg;
663 		gulong handlerId;
664 		
665 		this(void delegate(MountIF, VolumeMonitor) dlg)
666 		{
667 			this.dlg = dlg;
668 			this.listeners ~= this;
669 		}
670 		
671 		void remove(OnMountPreUnmountDelegateWrapper source)
672 		{
673 			foreach(index, wrapper; listeners)
674 			{
675 				if (wrapper.handlerId == source.handlerId)
676 				{
677 					listeners[index] = null;
678 					listeners = std.algorithm.remove(listeners, index);
679 					break;
680 				}
681 			}
682 		}
683 	}
684 
685 	/**
686 	 * Emitted when a mount is about to be removed.
687 	 *
688 	 * Params:
689 	 *     mount = a #GMount that is being unmounted.
690 	 */
691 	gulong addOnMountPreUnmount(void delegate(MountIF, VolumeMonitor) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
692 	{
693 		auto wrapper = new OnMountPreUnmountDelegateWrapper(dlg);
694 		wrapper.handlerId = Signals.connectData(
695 			this,
696 			"mount-pre-unmount",
697 			cast(GCallback)&callBackMountPreUnmount,
698 			cast(void*)wrapper,
699 			cast(GClosureNotify)&callBackMountPreUnmountDestroy,
700 			connectFlags);
701 		return wrapper.handlerId;
702 	}
703 	
704 	extern(C) static void callBackMountPreUnmount(GVolumeMonitor* volumemonitorStruct, GMount* mount, OnMountPreUnmountDelegateWrapper wrapper)
705 	{
706 		wrapper.dlg(ObjectG.getDObject!(Mount, MountIF)(mount), wrapper.outer);
707 	}
708 	
709 	extern(C) static void callBackMountPreUnmountDestroy(OnMountPreUnmountDelegateWrapper wrapper, GClosure* closure)
710 	{
711 		wrapper.remove(wrapper);
712 	}
713 
714 	protected class OnMountRemovedDelegateWrapper
715 	{
716 		static OnMountRemovedDelegateWrapper[] listeners;
717 		void delegate(MountIF, VolumeMonitor) dlg;
718 		gulong handlerId;
719 		
720 		this(void delegate(MountIF, VolumeMonitor) dlg)
721 		{
722 			this.dlg = dlg;
723 			this.listeners ~= this;
724 		}
725 		
726 		void remove(OnMountRemovedDelegateWrapper source)
727 		{
728 			foreach(index, wrapper; listeners)
729 			{
730 				if (wrapper.handlerId == source.handlerId)
731 				{
732 					listeners[index] = null;
733 					listeners = std.algorithm.remove(listeners, index);
734 					break;
735 				}
736 			}
737 		}
738 	}
739 
740 	/**
741 	 * Emitted when a mount is removed.
742 	 *
743 	 * Params:
744 	 *     mount = a #GMount that was removed.
745 	 */
746 	gulong addOnMountRemoved(void delegate(MountIF, VolumeMonitor) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
747 	{
748 		auto wrapper = new OnMountRemovedDelegateWrapper(dlg);
749 		wrapper.handlerId = Signals.connectData(
750 			this,
751 			"mount-removed",
752 			cast(GCallback)&callBackMountRemoved,
753 			cast(void*)wrapper,
754 			cast(GClosureNotify)&callBackMountRemovedDestroy,
755 			connectFlags);
756 		return wrapper.handlerId;
757 	}
758 	
759 	extern(C) static void callBackMountRemoved(GVolumeMonitor* volumemonitorStruct, GMount* mount, OnMountRemovedDelegateWrapper wrapper)
760 	{
761 		wrapper.dlg(ObjectG.getDObject!(Mount, MountIF)(mount), wrapper.outer);
762 	}
763 	
764 	extern(C) static void callBackMountRemovedDestroy(OnMountRemovedDelegateWrapper wrapper, GClosure* closure)
765 	{
766 		wrapper.remove(wrapper);
767 	}
768 
769 	protected class OnVolumeAddedDelegateWrapper
770 	{
771 		static OnVolumeAddedDelegateWrapper[] listeners;
772 		void delegate(VolumeIF, VolumeMonitor) dlg;
773 		gulong handlerId;
774 		
775 		this(void delegate(VolumeIF, VolumeMonitor) dlg)
776 		{
777 			this.dlg = dlg;
778 			this.listeners ~= this;
779 		}
780 		
781 		void remove(OnVolumeAddedDelegateWrapper source)
782 		{
783 			foreach(index, wrapper; listeners)
784 			{
785 				if (wrapper.handlerId == source.handlerId)
786 				{
787 					listeners[index] = null;
788 					listeners = std.algorithm.remove(listeners, index);
789 					break;
790 				}
791 			}
792 		}
793 	}
794 
795 	/**
796 	 * Emitted when a mountable volume is added to the system.
797 	 *
798 	 * Params:
799 	 *     volume = a #GVolume that was added.
800 	 */
801 	gulong addOnVolumeAdded(void delegate(VolumeIF, VolumeMonitor) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
802 	{
803 		auto wrapper = new OnVolumeAddedDelegateWrapper(dlg);
804 		wrapper.handlerId = Signals.connectData(
805 			this,
806 			"volume-added",
807 			cast(GCallback)&callBackVolumeAdded,
808 			cast(void*)wrapper,
809 			cast(GClosureNotify)&callBackVolumeAddedDestroy,
810 			connectFlags);
811 		return wrapper.handlerId;
812 	}
813 	
814 	extern(C) static void callBackVolumeAdded(GVolumeMonitor* volumemonitorStruct, GVolume* volume, OnVolumeAddedDelegateWrapper wrapper)
815 	{
816 		wrapper.dlg(ObjectG.getDObject!(Volume, VolumeIF)(volume), wrapper.outer);
817 	}
818 	
819 	extern(C) static void callBackVolumeAddedDestroy(OnVolumeAddedDelegateWrapper wrapper, GClosure* closure)
820 	{
821 		wrapper.remove(wrapper);
822 	}
823 
824 	protected class OnVolumeChangedDelegateWrapper
825 	{
826 		static OnVolumeChangedDelegateWrapper[] listeners;
827 		void delegate(VolumeIF, VolumeMonitor) dlg;
828 		gulong handlerId;
829 		
830 		this(void delegate(VolumeIF, VolumeMonitor) dlg)
831 		{
832 			this.dlg = dlg;
833 			this.listeners ~= this;
834 		}
835 		
836 		void remove(OnVolumeChangedDelegateWrapper source)
837 		{
838 			foreach(index, wrapper; listeners)
839 			{
840 				if (wrapper.handlerId == source.handlerId)
841 				{
842 					listeners[index] = null;
843 					listeners = std.algorithm.remove(listeners, index);
844 					break;
845 				}
846 			}
847 		}
848 	}
849 
850 	/**
851 	 * Emitted when mountable volume is changed.
852 	 *
853 	 * Params:
854 	 *     volume = a #GVolume that changed.
855 	 */
856 	gulong addOnVolumeChanged(void delegate(VolumeIF, VolumeMonitor) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
857 	{
858 		auto wrapper = new OnVolumeChangedDelegateWrapper(dlg);
859 		wrapper.handlerId = Signals.connectData(
860 			this,
861 			"volume-changed",
862 			cast(GCallback)&callBackVolumeChanged,
863 			cast(void*)wrapper,
864 			cast(GClosureNotify)&callBackVolumeChangedDestroy,
865 			connectFlags);
866 		return wrapper.handlerId;
867 	}
868 	
869 	extern(C) static void callBackVolumeChanged(GVolumeMonitor* volumemonitorStruct, GVolume* volume, OnVolumeChangedDelegateWrapper wrapper)
870 	{
871 		wrapper.dlg(ObjectG.getDObject!(Volume, VolumeIF)(volume), wrapper.outer);
872 	}
873 	
874 	extern(C) static void callBackVolumeChangedDestroy(OnVolumeChangedDelegateWrapper wrapper, GClosure* closure)
875 	{
876 		wrapper.remove(wrapper);
877 	}
878 
879 	protected class OnVolumeRemovedDelegateWrapper
880 	{
881 		static OnVolumeRemovedDelegateWrapper[] listeners;
882 		void delegate(VolumeIF, VolumeMonitor) dlg;
883 		gulong handlerId;
884 		
885 		this(void delegate(VolumeIF, VolumeMonitor) dlg)
886 		{
887 			this.dlg = dlg;
888 			this.listeners ~= this;
889 		}
890 		
891 		void remove(OnVolumeRemovedDelegateWrapper source)
892 		{
893 			foreach(index, wrapper; listeners)
894 			{
895 				if (wrapper.handlerId == source.handlerId)
896 				{
897 					listeners[index] = null;
898 					listeners = std.algorithm.remove(listeners, index);
899 					break;
900 				}
901 			}
902 		}
903 	}
904 
905 	/**
906 	 * Emitted when a mountable volume is removed from the system.
907 	 *
908 	 * Params:
909 	 *     volume = a #GVolume that was removed.
910 	 */
911 	gulong addOnVolumeRemoved(void delegate(VolumeIF, VolumeMonitor) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
912 	{
913 		auto wrapper = new OnVolumeRemovedDelegateWrapper(dlg);
914 		wrapper.handlerId = Signals.connectData(
915 			this,
916 			"volume-removed",
917 			cast(GCallback)&callBackVolumeRemoved,
918 			cast(void*)wrapper,
919 			cast(GClosureNotify)&callBackVolumeRemovedDestroy,
920 			connectFlags);
921 		return wrapper.handlerId;
922 	}
923 	
924 	extern(C) static void callBackVolumeRemoved(GVolumeMonitor* volumemonitorStruct, GVolume* volume, OnVolumeRemovedDelegateWrapper wrapper)
925 	{
926 		wrapper.dlg(ObjectG.getDObject!(Volume, VolumeIF)(volume), wrapper.outer);
927 	}
928 	
929 	extern(C) static void callBackVolumeRemovedDestroy(OnVolumeRemovedDelegateWrapper wrapper, GClosure* closure)
930 	{
931 		wrapper.remove(wrapper);
932 	}
933 }