The `GMount` interface represents user-visible mounts.
Note, when [porting from GnomeVFS](migrating-gnome-vfs.html), `GMount` is the moral equivalent of `GnomeVFSVolume`.
`GMount` is a ‘mounted’ filesystem that you can access. Mounted is in quotes because it’s not the same as a UNIX mount, it might be
a GVFS mount, but you can still access the files on it if you use GIO. Might or might not be related to a volume object.
Unmounting a `GMount` instance is an asynchronous operation. For more information about asynchronous operations, see [
iface@Gio.AsyncResult] and [class@Gio.Task]. To unmount a `GMount` instance, first call [method@Gio.Mount.unmount_with_operation] with (at
least) the `GMount` instance and a [type@Gio.AsyncReadyCallback]. The callback will be fired when the operation has resolved (either with
success or failure), and a [iface@Gio.AsyncResult] structure will be passed to the callback. That callback should then call [
method@Gio.Mount.unmount_with_operation_finish] with the `GMount` and the [iface@Gio.AsyncResult] data to see if the operation was
completed successfully. If an `error` is present when [method@Gio.Mount.unmount_with_operation_finish] is called, then it will be filled
with any error information.
publicstaticint main (string[] args) { MainLoop loop = new MainLoop ();
VolumeMonitor monitor = VolumeMonitor.get ();
// Print a list of the mounts on the system: List<Mount> mounts = monitor.get_mounts (); foreach (Mount mount in mounts) { print_mount (mount, "Available"); }
// Emitted when a mount is added: monitor.mount_added.connect ((mount) => { print_mount (mount, "Mount added"); });
// Emitted when a mount changes: monitor.mount_changed.connect ((mount) => { // See GLib.Mount.changed print_mount (mount, "Mount changed"); });
// Emitted when a mount is about to be removed: monitor.mount_pre_unmount.connect ((mount) => { // See GLib.Mount.pre_unmount print_mount (mount, "Mount pre-unmount"); });
// Emitted when a mount is removed: monitor.mount_removed.connect ((mount) => { // See GLib.Mount.unmounted print_mount (mount, "Mount removed"); });