gio-0.12.4: Binding to the GIO.

Portability | portable (depends on GHC)
Stability | alpha
Maintainer | gtk2hs-devel@lists.sourceforge.net
Safe Haskell | None

System.GIO.Volumes.Volume

Contents

- Details
- Types
- Methods
- Signals

Description

Synopsis

- newtype Volume = Volume (ForeignPtr Volume)
- class GObjectClass o => VolumeClass o
- volumeGetName :: VolumeClass volume => volume -> IO String
- volumeGetUUID :: VolumeClass volume => volume -> IO (Maybe String)
- volumeGetIcon :: VolumeClass volume => volume -> IO Icon
- volumeGetDrive :: VolumeClass volume => volume -> IO (Maybe Drive)
- volumeGetMount :: VolumeClass volume => volume -> IO (Maybe Mount)
- volumeCanMount :: VolumeClass volume => volume -> IO Bool
- volumeShouldAutomount :: VolumeClass volume => volume -> IO Bool
- volumeGetActivationRoot :: VolumeClass volume => volume -> IO (Maybe File)
- volumeMount :: VolumeClass volume => volume -> [MountMountFlags] -> Maybe MountOperation -> Maybe Cancellable -> AsyncReadyCallback -> IO ()
- volumeMountFinish :: VolumeClass volume => volume -> AsyncResult -> IO ()
- volumeCanEject :: VolumeClass volume => volume -> IO Bool
- volumeEjectWithOperation :: VolumeClass volume => volume -> [MountUnmountFlags] -> Maybe MountOperation -> Maybe Cancellable -> AsyncReadyCallback -> IO ()
- volumeEjectWithOperationFinish :: VolumeClass volume => volume -> AsyncResult -> IO ()
- volumeEnumerateIdentifiers :: VolumeClass volume => volume -> IO [String]
- volumeGetIdentifier :: VolumeClass volume => volume -> String -> IO String
- volumeChanged :: VolumeClass volume => Signal volume (IO ())
- volumeRemoved :: VolumeClass volume => Signal volume (IO ())

# Details

The `Volume` interface represents user-visible objects that can be mounted. Note, when porting from GnomeVFS, `Volume` is the moral equivalent of GnomeVFSDrive.

Mounting a `Volume` instance is an asynchronous operation. For more information about asynchronous operations, see `AsyncReady` and GSimpleAsyncReady. To mount a `Volume`, first call `volumeMount` with (at least) the `Volume` instance, optionally a `MountOperation` object and a `AsyncReadyCallback`.

Typically, one will only want to pass `Nothing` for the `MountOperation` if automounting all volumes when a desktop session starts since it's not desirable to put up a lot of dialogs asking for credentials.

The callback will be fired when the operation has resolved (either with success or failure), and a `AsyncReady` structure will be passed to the callback. That callback should then call `volumeMountFinish` with the `Volume` instance and the `AsyncReady` data to see if the operation was completed successfully. If an error is present when `volumeMountFinish` is called, then it will be filled with any error information.

It is sometimes necessary to directly access the underlying operating system object behind a volume (e.g. for passing a volume to an application via the commandline). For this purpose, GIO allows to obtain an `identifier` for the volume. There can be different kinds of identifiers, such as Hal UDIs, filesystem labels, traditional Unix devices (e.g. devsda2), uuids. GIO uses predefind strings as names for the different kinds of identifiers: `VolumeIdentifierKindHalUdi`, `VolumeIdentifierKindLabel`, etc. Use `volumeGetIdentifier` to obtain an identifier for a volume.

Note that `VolumeIdentifierKindHalUdi` will only be available when the gvfs hal volume monitor is in use. Other volume monitors will generally be able to provide the `VolumeIdentifierKindUnixDevice` identifier, which can be used to obtain a hal device by means of `mangerFindDeviceStringMatch`.

# Types

newtype Volume

Constructors

Volume (ForeignPtr Volume) |

Instances

Eq Volume |
Ord Volume |
GObjectClass Volume |
VolumeClass Volume |

class GObjectClass o => VolumeClass o

Instances

VolumeClass Volume |

# Methods

volumeGetName

Arguments

:: VolumeClass volume |
=> volume |
-> IO String | returns the name for the given volume.

Gets the name of volume.

volumeGetUUID

Arguments

:: VolumeClass volume |
=> volume |
-> IO (Maybe String) | returns the UUID for volume or `Nothing` if no UUID can be computed.

Gets the UUID for the volume. The reference is typically based on the file system UUID for the volume in question and should be considered an opaque string. Returns `Nothing` if there is no UUID available.

volumeGetIcon :: VolumeClass volume => volume -> IO Icon

Gets the icon for volume.

volumeGetDrive

Arguments

:: VolumeClass volume |
=> volume |
-> IO (Maybe Drive) | returns a `Drive` or `Nothing` if volume is not associated with a drive.

Gets the drive for the volume.

volumeGetMount

Arguments

:: VolumeClass volume |
=> volume |
-> IO (Maybe Mount) | returns a `Mount` or `Nothing` if volume is not associated with a mount.

Gets the mount for the volume.

volumeCanMount

Arguments

:: VolumeClass volume |
=> volume |
-> IO Bool | returns `True` if the volume can be mounted. `False` otherwise.

Checks if a volume can be mounted.

volumeShouldAutomount

Arguments

:: VolumeClass volume |
=> volume |
-> IO Bool | returns `True` if the volume should be automatically mounted.

Returns whether the volume should be automatically mounted.

volumeGetActivationRoot

Arguments

:: VolumeClass volume |
=> volume |
-> IO (Maybe File) | returns the activation root of volume or `Nothing`.

Gets the activation root for a `Volume` if it is known ahead of mount time. Returns `Nothing` otherwise. If not `Nothing` and if volume is mounted, then the result of `mountGetRoot` on the `Mount` object obtained from `volumeGetMount` will always either be equal or a prefix of what this function returns.

volumeMount

Arguments

:: VolumeClass volume |
=> volume |
-> [MountMountFlags] | `flags` flags affecting the operation
-> Maybe MountOperation | `mountOperation` a `MountOperation` or `Nothing` to avoid user interaction.
-> Maybe Cancellable | `cancellable` optional `Cancellable` object, `Nothing` to ignore.
-> AsyncReadyCallback | `callback` a `AsyncReadyCallback`
-> IO () |

Mounts a volume. This is an asynchronous operation, and is finished by calling `volumeMountFinish` with the volume and `AsyncResult` returned in the callback.

volumeMountFinish

Arguments

:: VolumeClass volume |
=> volume |
-> AsyncResult | `result` a `AsyncResult`
-> IO () |

Finishes mounting a volume. If any errors occured during the operation, error will be set to contain the errors and `False` will be returned.

If the mount operation succeeded, `volumeGetMount` on volume is guaranteed to return the mount right after calling this function; there's no need to listen for the 'mount-added' signal on `VolumeMonitor`.

Throws a `GError` if an error occurs.

volumeCanEject

Arguments

:: VolumeClass volume |
=> volume |
-> IO Bool | returns `True` if the volume can be ejected. `False` otherwise.

Checks if a volume can be ejected.

volumeEjectWithOperation

Arguments

:: VolumeClass volume |
=> volume |
-> [MountUnmountFlags] | `flags` flags affecting the unmount if required for eject
-> Maybe MountOperation | `mountOperation` a `MountOperation` or `Nothing` to avoid user interaction.
-> Maybe Cancellable | `cancellable` optional `Cancellable` object, `Nothing` to ignore.
-> AsyncReadyCallback | `callback` a `AsyncReadyCallback`
-> IO () |

Ejects a volume. This is an asynchronous operation, and is finished by calling `volumeEjectWithOperationFinish` with the volume and `AsyncResult` data returned in the callback.

volumeEjectWithOperationFinish

Arguments

:: VolumeClass volume |
=> volume |
-> AsyncResult | `result` a `AsyncResult`.
-> IO () |

Finishes ejecting a volume. If any errors occurred during the operation, error will be set to contain the errors and `False` will be returned.

Throws a `GError` if an error occurs.

volumeEnumerateIdentifiers :: VolumeClass volume => volume -> IO [String]

Gets the kinds of identifiers that volume has. Use `volumeGetIdentifer` to obtain the identifiers themselves.

volumeGetIdentifier

Arguments

:: VolumeClass volume |
=> volume |
-> String | `kind` the kind of identifier to return
-> IO String |

Gets the identifier of the given kind for volume. See the introduction for more information about volume identifiers.

# Signals

volumeChanged :: VolumeClass volume => Signal volume (IO ())

Emitted when the volume has been changed.

volumeRemoved :: VolumeClass volume => Signal volume (IO ())

This signal is emitted when the `Volume` have been removed. If the recipient is holding references to the object they should release them so the object can be finalized.