gio-0.13.12.0: Binding to GIO

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

System.GIO.Volumes.Volume

Contents

- Details
- Types
- Methods
- Signals

Description

Synopsis

- newtype Volume = Volume (ForeignPtr Volume)
- class GObjectClass o => VolumeClass o
- volumeGetName :: (VolumeClass volume, GlibString string) => volume -> IO string
- volumeGetUUID :: (VolumeClass volume, GlibString string) => 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, GlibString string) => volume -> IO [string]
- volumeGetIdentifier :: (VolumeClass volume, GlibString string) => 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 Source #

Constructors

Volume (ForeignPtr Volume) |

#### Instances

Instances details

Eq Volume Source # |
Instance details Defined in System.GIO.Types Methods (==) :: Volume -> Volume -> Bool Source # (/=) :: Volume -> Volume -> Bool Source #
Ord Volume Source # |
Instance details Defined in System.GIO.Types Methods compare :: Volume -> Volume -> Ordering Source # (<) :: Volume -> Volume -> Bool Source # (<=) :: Volume -> Volume -> Bool Source # (>) :: Volume -> Volume -> Bool Source # (>=) :: Volume -> Volume -> Bool Source # max :: Volume -> Volume -> Volume Source # min :: Volume -> Volume -> Volume Source #
VolumeClass Volume Source # |
Instance details Defined in System.GIO.Types
GObjectClass Volume Source # |
Instance details Defined in System.GIO.Types Methods toGObject :: Volume -> GObject Source # unsafeCastGObject :: GObject -> Volume Source #

class GObjectClass o => VolumeClass o Source #

#### Instances

Instances details

VolumeClass Volume Source # |
Instance details Defined in System.GIO.Types

# Methods

volumeGetName Source #

Arguments

:: (VolumeClass volume, GlibString string) |
=> volume |
-> IO string | returns the name for the given volume.

Gets the name of volume.

volumeGetUUID Source #

Arguments

:: (VolumeClass volume, GlibString string) |
=> 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 Source #

Gets the icon for volume.

volumeGetDrive Source #

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 Source #

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 Source #

Arguments

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

Checks if a volume can be mounted.

volumeShouldAutomount Source #

Arguments

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

Returns whether the volume should be automatically mounted.

volumeGetActivationRoot Source #

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 Source #

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 Source #

Arguments

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

Finishes mounting a volume. If any errors occurred 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 Source #

Arguments

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

Checks if a volume can be ejected.

volumeEjectWithOperation Source #

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 Source #

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, GlibString string) => volume -> IO [string] Source #

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

volumeGetIdentifier Source #

Arguments

:: (VolumeClass volume, GlibString string) |
=> 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 ()) Source #

Emitted when the volume has been changed.

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

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.