Portability | portable (depends on GHC) |
---|---|
Stability | alpha |
Maintainer | gtk2hs-devel@lists.sourceforge.net |
Safe Haskell | None |
- 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
class GObjectClass o => VolumeClass o Source
Methods
:: VolumeClass volume | |
=> volume | |
-> IO String | returns the name for the given volume. |
Gets the name of volume.
:: VolumeClass volume | |
=> volume | |
-> IO (Maybe String) | returns the UUID for volume or |
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 IconSource
Gets the icon for volume.
:: VolumeClass volume | |
=> volume | |
-> IO (Maybe Drive) | returns a |
Gets the drive for the volume.
:: VolumeClass volume | |
=> volume | |
-> IO (Maybe Mount) | returns a |
Gets the mount for the volume.
:: VolumeClass volume | |
=> volume | |
-> IO Bool |
Checks if a volume can be mounted.
:: VolumeClass volume | |
=> volume | |
-> IO Bool | returns |
Returns whether the volume should be automatically mounted.
:: VolumeClass volume | |
=> volume | |
-> IO (Maybe File) | returns the activation root of volume or |
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.
:: VolumeClass volume | |
=> volume | |
-> [MountMountFlags] |
|
-> Maybe MountOperation |
|
-> Maybe Cancellable |
|
-> 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.
:: VolumeClass volume | |
=> volume | |
-> 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.
:: VolumeClass volume | |
=> volume | |
-> IO Bool |
Checks if a volume can be ejected.
volumeEjectWithOperationSource
:: VolumeClass volume | |
=> volume | |
-> [MountUnmountFlags] |
|
-> Maybe MountOperation |
|
-> Maybe Cancellable |
|
-> 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.
volumeEjectWithOperationFinishSource
:: VolumeClass volume | |
=> volume | |
-> AsyncResult |
|
-> IO () |
volumeEnumerateIdentifiers :: VolumeClass volume => volume -> IO [String]Source
Gets the kinds of identifiers that volume has. Use volumeGetIdentifer
to obtain the
identifiers themselves.
:: VolumeClass volume | |
=> volume | |
-> String |
|
-> 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.