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.Mount

Contents

- Details
- Types
- Methods
- Signals

Description

Synopsis

- newtype Mount = Mount (ForeignPtr Mount)
- class GObjectClass o => MountClass o
- mountGetName :: MountClass mount => mount -> IO String
- mountGetUUID :: MountClass mount => mount -> IO (Maybe String)
- mountGetIcon :: MountClass mount => mount -> IO Icon
- mountGetDrive :: MountClass mount => mount -> IO (Maybe Drive)
- mountGetRoot :: MountClass mount => mount -> IO File
- mountGetVolume :: MountClass mount => mount -> IO (Maybe Volume)
- mountGetDefaultLocation :: MountClass mount => mount -> IO File
- mountCanUnmount :: MountClass mount => mount -> IO Bool
- mountUnmountWithOperation :: MountClass mount => mount -> [MountUnmountFlags] -> Maybe MountOperation -> Maybe Cancellable -> AsyncReadyCallback -> IO ()
- mountUnmountWithOperationFinish :: MountClass mount => mount -> AsyncResult -> IO ()
- mountRemount :: MountClass mount => mount -> [MountMountFlags] -> Maybe MountOperation -> Maybe Cancellable -> AsyncReadyCallback -> IO ()
- mountRemountFinish :: MountClass mount => mount -> AsyncResult -> IO ()
- mountCanEject :: MountClass mount => mount -> IO Bool
- mountEjectWithOperation :: MountClass mount => mount -> [MountUnmountFlags] -> Maybe MountOperation -> Maybe Cancellable -> AsyncReadyCallback -> IO ()
- mountEjectWithOperationFinish :: MountClass mount => mount -> AsyncResult -> IO ()
- mountGuessContentType :: MountClass mount => mount -> Bool -> Maybe Cancellable -> AsyncReadyCallback -> IO ()
- mountGuessContentTypeFinish :: MountClass mount => mount -> AsyncResult -> IO [String]
- mountGuessContentTypeSync :: MountClass mount => mount -> Bool -> Maybe Cancellable -> IO [String]
- mountIsShadowed :: MountClass mount => mount -> IO Bool
- mountShadow :: MountClass mount => mount -> IO ()
- mountUnshadow :: MountClass mount => mount -> IO ()
- mountChanged :: MountClass mount => Signal mount (IO ())
- mountPreUnmount :: MountClass mount => Signal mount (IO ())
- mountUnmounted :: MountClass mount => Signal mount (IO ())

# Details

The `Mount` interface represents user-visible mounts. Note, when porting from GnomeVFS, `Mount` is the moral equivalent of GnomeVFSVolume.

`Mount` 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 `Mount` instance is an asynchronous operation. For more information about asynchronous operations, see `AsyncReady` and GSimpleAsyncReady. To unmount a `Mount` instance, first call `mountUnmountWithOperation` the `Mount` instance and a `AsyncReadyCallback`. 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 `mountUnmountWithOperationFinish` with the `Mount` and the `AsyncReady` data to see if the operation was completed successfully. If an error is present when `mountUnmountWithOperationFinish` is called, then it will be filled with any error information.

# Types

newtype Mount

Constructors

Mount (ForeignPtr Mount) |

Instances

Eq Mount |
Ord Mount |
GObjectClass Mount |
MountClass Mount |

class GObjectClass o => MountClass o

Instances

MountClass Mount |

# Methods

mountGetName

Arguments

:: MountClass mount |
=> mount |
-> IO String | returns the name for the given mount.

Gets the name of mount.

mountGetUUID

Arguments

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

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

mountGetIcon

Arguments

:: MountClass mount |
=> mount |
-> IO Icon | returns a `Icon`.

Gets the icon for mount.

mountGetDrive

Arguments

:: MountClass mount |
=> mount |
-> IO (Maybe Drive) | returns the `Drive` for mount or `Nothing` if no `Drive` can be computed.

Gets the drive for the mount.

This is a convenience method for getting the `Volume` and then using that object to get the `Drive`.

mountGetRoot :: MountClass mount => mount -> IO File

Gets the root directory on mount.

mountGetVolume

Arguments

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

Gets the volume directory on mount.

mountGetDefaultLocation :: MountClass mount => mount -> IO File

Gets the default location of mount. The default location of the given mount is a path that reflects the main entry point for the user (e.g. the home directory, or the root of the volume). | Gets the root directory on mount.

mountCanUnmount

Arguments

:: MountClass mount |
=> mount |
-> IO Bool | returns `True` if the mount can be unmounted.

Checks if mount can be mounted.

mountUnmountWithOperation

Arguments

:: MountClass mount |
=> mount |
-> [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 () |

Unmounts a mount. This is an asynchronous operation, and is finished by calling `mountUnmountWithOperationFinish` with the mount and `AsyncResult` data returned in the callback.

mountUnmountWithOperationFinish

Arguments

:: MountClass mount |
=> mount |
-> AsyncResult | `result` a `AsyncResult`.
-> IO () |

Finishes unmounting a mount. 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.

mountRemount

Arguments

:: MountClass mount |
=> mount |
-> [MountMountFlags] | `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 () |

Remounts a mount. This is an asynchronous operation, and is finished by calling `mountRemountFinish` with the mount and `AsyncResult`s data returned in the callback.

Remounting is useful when some setting affecting the operation of the volume has been changed, as these may need a remount to take affect. While this is semantically equivalent with unmounting and then remounting not all backends might need to actually be unmounted.

mountRemountFinish

Arguments

:: MountClass mount |
=> mount |
-> AsyncResult | `result` a `AsyncResult`.
-> IO () |

Finishes remounting a mount. 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.

mountCanEject

Arguments

:: MountClass mount |
=> mount |
-> IO Bool | returns `True` if the mount can be ejected.

Checks if mount can be eject.

mountEjectWithOperation

Arguments

:: MountClass mount |
=> mount |
-> [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 mount. This is an asynchronous operation, and is finished by calling `mountEjectWithOperationFinish` with the mount and `AsyncResult` data returned in the callback.

mountEjectWithOperationFinish

Arguments

:: MountClass mount |
=> mount |
-> AsyncResult | `result` a `AsyncResult`.
-> IO () |

Finishes ejecting a mount. If any errors occurred during the operation.

Throws a `GError` if an error occurs.

mountGuessContentType

Arguments

:: MountClass mount |
=> mount |
-> Bool | `forceRescan` Whether to force a rescan of the content. Otherwise a cached result will be used if available
-> Maybe Cancellable | `cancellable` optional `Cancellable` object, `Nothing` to ignore
-> AsyncReadyCallback | `callback` a `AsyncReadyCallback`
-> IO () |

Tries to guess the type of content stored on mount. Returns one or more textual identifiers of well-known content types (typically prefixed with "x-content\"), e.g. x-contentimage-dcf for camera memory cards. See the shared-mime-info specification for more on x-content types.

This is an asynchronous operation (see `mountGuessContentTypeSync` for the synchronous version), and is finished by calling `mountGuessContentTypeFinish` with the mount and `AsyncResult` data returned in the callback.

mountGuessContentTypeFinish

Arguments

:: MountClass mount |
=> mount |
-> AsyncResult | `result` a `AsyncResult`.
-> IO [String] | returns `True` if the mount was successfully ejected. `False` otherwise.

Finishes guessing content types of mount. If any errors occured during the operation, error will be set to contain the errors and `False` will be returned. In particular, you may get an `IoErrorNotSupported` if the mount does not support content guessing.

mountGuessContentTypeSync

Arguments

:: MountClass mount |
=> mount |
-> Bool | `forceRescan` Whether to force a rescan of the content. Otherwise a cached result will be used if available
-> Maybe Cancellable | `cancellable` optional `Cancellable` object, `Nothing` to ignore
-> IO [String] |

Tries to guess the type of content stored on mount. Returns one or more textual identifiers of well-known content types (typically prefixed with "x-content\"), e.g. x-contentimage-dcf for camera memory cards. See the shared-mime-info specification for more on x-content types.

This is an synchronous operation and as such may block doing IO; see `mountGuessContentType` for the asynchronous version.

mountIsShadowed

Arguments

:: MountClass mount |
=> mount |
-> IO Bool | returns `True` if mount is shadowed.

Determines if mount is shadowed. Applications or libraries should avoid displaying mount in the user interface if it is shadowed.

A mount is said to be shadowed if there exists one or more user visible objects (currently `Mount` objects) with a root that is inside the root of mount.

One application of shadow mounts is when exposing a single file system that is used to address several logical volumes. In this situation, a `VolumeMonitor` implementation would create two `Volume` objects (for example, one for the camera functionality of the device and one for a SD card reader on the device) with activation URIs gphoto2: gphoto2: mounted, said `VolumeMonitor` implementation would create two `Mount` objects (each with their root matching the corresponding volume activation root) that would shadow the original mount.

The proxy monitor in GVfs 2.26 and later, automatically creates and manage shadow mounts (and shadows the underlying mount) if the activation root on a `Volume` is set.

mountShadow :: MountClass mount => mount -> IO ()

Increments the shadow count on mount. Usually used by `VolumeMonitor` implementations when creating a shadow mount for mount, see `mountIsShadowed` for more information. The caller will need to emit the changed signal on mount manually.

mountUnshadow :: MountClass mount => mount -> IO ()

Decrements the shadow count on mount. Usually used by `VolumeMonitor` implementations when destroying a shadow mount for mount, see `mountIsShadowed` for more information. The caller will need to emit the changed signal on mount manually.

# Signals

mountChanged :: MountClass mount => Signal mount (IO ())

Emitted when the mount has been changed.

mountPreUnmount :: MountClass mount => Signal mount (IO ())

This signal is emitted when the `Mount` is about to be unmounted.

mountUnmounted :: MountClass mount => Signal mount (IO ())

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