Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | None |
Language | Haskell2010 |
- Exported types
- Methods
- Overloaded methods
- canEject
- canUnmount
- eject
- ejectFinish
- ejectWithOperation
- ejectWithOperationFinish
- getDefaultLocation
- getDrive
- getIcon
- getName
- getRoot
- getSortKey
- getSymbolicIcon
- getUuid
- getVolume
- guessContentType
- guessContentTypeFinish
- guessContentTypeSync
- isShadowed
- remount
- remountFinish
- shadow
- unmount
- unmountFinish
- unmountWithOperation
- unmountWithOperationFinish
- unshadow
- Signals
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 AsyncResult
and Task
. To unmount a Mount
instance, first call
mountUnmountWithOperation
with (at least) the Mount
instance and a
AsyncReadyCallback
. The callback will be fired when the
operation has resolved (either with success or failure), and a
AsyncResult
structure will be passed to the callback. That
callback should then call mountUnmountWithOperationFinish
with the Mount
and the AsyncResult
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.
Synopsis
- newtype Mount = Mount (ManagedPtr Mount)
- noMount :: Maybe Mount
- class (GObject o, IsDescendantOf Mount o) => IsMount o
- toMount :: (MonadIO m, IsMount o) => o -> m Mount
- mountCanEject :: (HasCallStack, MonadIO m, IsMount a) => a -> m Bool
- mountCanUnmount :: (HasCallStack, MonadIO m, IsMount a) => a -> m Bool
- mountEject :: (HasCallStack, MonadIO m, IsMount a, IsCancellable b) => a -> [MountUnmountFlags] -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- mountEjectFinish :: (HasCallStack, MonadIO m, IsMount a, IsAsyncResult b) => a -> b -> m ()
- mountEjectWithOperation :: (HasCallStack, MonadIO m, IsMount a, IsMountOperation b, IsCancellable c) => a -> [MountUnmountFlags] -> Maybe b -> Maybe c -> Maybe AsyncReadyCallback -> m ()
- mountEjectWithOperationFinish :: (HasCallStack, MonadIO m, IsMount a, IsAsyncResult b) => a -> b -> m ()
- mountGetDefaultLocation :: (HasCallStack, MonadIO m, IsMount a) => a -> m File
- mountGetDrive :: (HasCallStack, MonadIO m, IsMount a) => a -> m (Maybe Drive)
- mountGetIcon :: (HasCallStack, MonadIO m, IsMount a) => a -> m Icon
- mountGetName :: (HasCallStack, MonadIO m, IsMount a) => a -> m Text
- mountGetRoot :: (HasCallStack, MonadIO m, IsMount a) => a -> m File
- mountGetSortKey :: (HasCallStack, MonadIO m, IsMount a) => a -> m (Maybe Text)
- mountGetSymbolicIcon :: (HasCallStack, MonadIO m, IsMount a) => a -> m Icon
- mountGetUuid :: (HasCallStack, MonadIO m, IsMount a) => a -> m (Maybe Text)
- mountGetVolume :: (HasCallStack, MonadIO m, IsMount a) => a -> m (Maybe Volume)
- mountGuessContentType :: (HasCallStack, MonadIO m, IsMount a, IsCancellable b) => a -> Bool -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- mountGuessContentTypeFinish :: (HasCallStack, MonadIO m, IsMount a, IsAsyncResult b) => a -> b -> m [Text]
- mountGuessContentTypeSync :: (HasCallStack, MonadIO m, IsMount a, IsCancellable b) => a -> Bool -> Maybe b -> m [Text]
- mountIsShadowed :: (HasCallStack, MonadIO m, IsMount a) => a -> m Bool
- mountRemount :: (HasCallStack, MonadIO m, IsMount a, IsMountOperation b, IsCancellable c) => a -> [MountMountFlags] -> Maybe b -> Maybe c -> Maybe AsyncReadyCallback -> m ()
- mountRemountFinish :: (HasCallStack, MonadIO m, IsMount a, IsAsyncResult b) => a -> b -> m ()
- mountShadow :: (HasCallStack, MonadIO m, IsMount a) => a -> m ()
- mountUnmount :: (HasCallStack, MonadIO m, IsMount a, IsCancellable b) => a -> [MountUnmountFlags] -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- mountUnmountFinish :: (HasCallStack, MonadIO m, IsMount a, IsAsyncResult b) => a -> b -> m ()
- mountUnmountWithOperation :: (HasCallStack, MonadIO m, IsMount a, IsMountOperation b, IsCancellable c) => a -> [MountUnmountFlags] -> Maybe b -> Maybe c -> Maybe AsyncReadyCallback -> m ()
- mountUnmountWithOperationFinish :: (HasCallStack, MonadIO m, IsMount a, IsAsyncResult b) => a -> b -> m ()
- mountUnshadow :: (HasCallStack, MonadIO m, IsMount a) => a -> m ()
- type C_MountChangedCallback = Ptr () -> Ptr () -> IO ()
- type MountChangedCallback = IO ()
- afterMountChanged :: (IsMount a, MonadIO m) => a -> MountChangedCallback -> m SignalHandlerId
- genClosure_MountChanged :: MonadIO m => MountChangedCallback -> m (GClosure C_MountChangedCallback)
- mk_MountChangedCallback :: C_MountChangedCallback -> IO (FunPtr C_MountChangedCallback)
- noMountChangedCallback :: Maybe MountChangedCallback
- onMountChanged :: (IsMount a, MonadIO m) => a -> MountChangedCallback -> m SignalHandlerId
- wrap_MountChangedCallback :: MountChangedCallback -> C_MountChangedCallback
- type C_MountPreUnmountCallback = Ptr () -> Ptr () -> IO ()
- type MountPreUnmountCallback = IO ()
- afterMountPreUnmount :: (IsMount a, MonadIO m) => a -> MountPreUnmountCallback -> m SignalHandlerId
- genClosure_MountPreUnmount :: MonadIO m => MountPreUnmountCallback -> m (GClosure C_MountPreUnmountCallback)
- mk_MountPreUnmountCallback :: C_MountPreUnmountCallback -> IO (FunPtr C_MountPreUnmountCallback)
- noMountPreUnmountCallback :: Maybe MountPreUnmountCallback
- onMountPreUnmount :: (IsMount a, MonadIO m) => a -> MountPreUnmountCallback -> m SignalHandlerId
- wrap_MountPreUnmountCallback :: MountPreUnmountCallback -> C_MountPreUnmountCallback
- type C_MountUnmountedCallback = Ptr () -> Ptr () -> IO ()
- type MountUnmountedCallback = IO ()
- afterMountUnmounted :: (IsMount a, MonadIO m) => a -> MountUnmountedCallback -> m SignalHandlerId
- genClosure_MountUnmounted :: MonadIO m => MountUnmountedCallback -> m (GClosure C_MountUnmountedCallback)
- mk_MountUnmountedCallback :: C_MountUnmountedCallback -> IO (FunPtr C_MountUnmountedCallback)
- noMountUnmountedCallback :: Maybe MountUnmountedCallback
- onMountUnmounted :: (IsMount a, MonadIO m) => a -> MountUnmountedCallback -> m SignalHandlerId
- wrap_MountUnmountedCallback :: MountUnmountedCallback -> C_MountUnmountedCallback
Exported types
Memory-managed wrapper type.
Instances
Eq Mount Source # | |
GObject Mount Source # | |
Defined in GI.Gio.Interfaces.Mount gobjectType :: IO GType # | |
IsGValue Mount Source # | Convert |
HasParentTypes Mount Source # | |
Defined in GI.Gio.Interfaces.Mount | |
type ParentTypes Mount Source # | |
Defined in GI.Gio.Interfaces.Mount |
class (GObject o, IsDescendantOf Mount o) => IsMount o Source #
Instances
(GObject o, IsDescendantOf Mount o) => IsMount o Source # | |
Defined in GI.Gio.Interfaces.Mount |
Methods
Overloaded methods
canEject
:: (HasCallStack, MonadIO m, IsMount a) | |
=> a |
|
-> m Bool | Returns: |
Checks if mount
can be ejected.
canUnmount
:: (HasCallStack, MonadIO m, IsMount a) | |
=> a |
|
-> m Bool | Returns: |
Checks if mount
can be unmounted.
eject
:: (HasCallStack, MonadIO m, IsMount a, IsCancellable b) | |
=> a |
|
-> [MountUnmountFlags] |
|
-> Maybe b |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
Deprecated: (Since version 2.22)Use mountEjectWithOperation
instead.
Ejects a mount. This is an asynchronous operation, and is
finished by calling mountEjectFinish
with the mount
and AsyncResult
data returned in the callback
.
ejectFinish
:: (HasCallStack, MonadIO m, IsMount a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m () | (Can throw |
Deprecated: (Since version 2.22)Use mountEjectWithOperationFinish
instead.
Finishes ejecting a mount. If any errors occurred during the operation,
error
will be set to contain the errors and False
will be returned.
ejectWithOperation
mountEjectWithOperation Source #
:: (HasCallStack, MonadIO m, IsMount a, IsMountOperation b, IsCancellable c) | |
=> a |
|
-> [MountUnmountFlags] |
|
-> Maybe b |
|
-> Maybe c |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
Ejects a mount. This is an asynchronous operation, and is
finished by calling mountEjectWithOperationFinish
with the mount
and AsyncResult
data returned in the callback
.
Since: 2.22
ejectWithOperationFinish
mountEjectWithOperationFinish Source #
:: (HasCallStack, MonadIO m, IsMount a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m () | (Can throw |
Finishes ejecting a mount. If any errors occurred during the operation,
error
will be set to contain the errors and False
will be returned.
Since: 2.22
getDefaultLocation
mountGetDefaultLocation Source #
:: (HasCallStack, MonadIO m, IsMount a) | |
=> a |
|
-> m File | Returns: a |
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).
getDrive
:: (HasCallStack, MonadIO m, IsMount a) | |
=> a |
|
-> m (Maybe Drive) | Returns: a |
getIcon
:: (HasCallStack, MonadIO m, IsMount a) | |
=> a |
|
-> m Icon | Returns: a |
Gets the icon for mount
.
getName
:: (HasCallStack, MonadIO m, IsMount a) | |
=> a |
|
-> m Text | Returns: the name for the given |
Gets the name of mount
.
getRoot
:: (HasCallStack, MonadIO m, IsMount a) | |
=> a |
|
-> m File | Returns: a |
Gets the root directory on mount
.
getSortKey
:: (HasCallStack, MonadIO m, IsMount a) | |
=> a |
|
-> m (Maybe Text) | Returns: Sorting key for |
Gets the sort key for mount
, if any.
Since: 2.32
getSymbolicIcon
:: (HasCallStack, MonadIO m, IsMount a) | |
=> a |
|
-> m Icon | Returns: a |
Gets the symbolic icon for mount
.
Since: 2.34
getUuid
:: (HasCallStack, MonadIO m, IsMount a) | |
=> a |
|
-> m (Maybe Text) | Returns: the UUID for |
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.
getVolume
:: (HasCallStack, MonadIO m, IsMount a) | |
=> a |
|
-> m (Maybe Volume) | Returns: a |
Gets the volume for the mount
.
guessContentType
mountGuessContentType Source #
:: (HasCallStack, MonadIO m, IsMount a, IsCancellable b) | |
=> a |
|
-> Bool |
|
-> Maybe b |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
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-content/image-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
.
Since: 2.18
guessContentTypeFinish
mountGuessContentTypeFinish Source #
:: (HasCallStack, MonadIO m, IsMount a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m [Text] | Returns: a |
Finishes guessing content types of mount
. If any errors occurred
during the operation, error
will be set to contain the errors and
False
will be returned. In particular, you may get an
IOErrorEnumNotSupported
if the mount does not support content
guessing.
Since: 2.18
guessContentTypeSync
mountGuessContentTypeSync Source #
:: (HasCallStack, MonadIO m, IsMount a, IsCancellable b) | |
=> a |
|
-> Bool |
|
-> Maybe b |
|
-> m [Text] | Returns: a |
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-content/image-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.
Since: 2.18
isShadowed
:: (HasCallStack, MonadIO m, IsMount a) | |
=> a |
|
-> m Bool | Returns: |
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://[usb:001,002]/store1/
and gphoto2://[usb:001,002]/store2/
. When the
underlying mount (with root
gphoto2://[usb:001,002]/
) is 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.
Since: 2.20
remount
:: (HasCallStack, MonadIO m, IsMount a, IsMountOperation b, IsCancellable c) | |
=> a |
|
-> [MountMountFlags] |
|
-> Maybe b |
|
-> Maybe c |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
Remounts a mount. This is an asynchronous operation, and is
finished by calling mountRemountFinish
with the mount
and GAsyncResults
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.
remountFinish
:: (HasCallStack, MonadIO m, IsMount a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m () | (Can throw |
Finishes remounting a mount. If any errors occurred during the operation,
error
will be set to contain the errors and False
will be returned.
shadow
:: (HasCallStack, MonadIO m, IsMount a) | |
=> a |
|
-> m () |
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.
Since: 2.20
unmount
:: (HasCallStack, MonadIO m, IsMount a, IsCancellable b) | |
=> a |
|
-> [MountUnmountFlags] |
|
-> Maybe b |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
Deprecated: (Since version 2.22)Use mountUnmountWithOperation
instead.
Unmounts a mount. This is an asynchronous operation, and is
finished by calling mountUnmountFinish
with the mount
and AsyncResult
data returned in the callback
.
unmountFinish
:: (HasCallStack, MonadIO m, IsMount a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m () | (Can throw |
Deprecated: (Since version 2.22)Use mountUnmountWithOperationFinish
instead.
Finishes unmounting a mount. If any errors occurred during the operation,
error
will be set to contain the errors and False
will be returned.
unmountWithOperation
mountUnmountWithOperation Source #
:: (HasCallStack, MonadIO m, IsMount a, IsMountOperation b, IsCancellable c) | |
=> a |
|
-> [MountUnmountFlags] |
|
-> Maybe b |
|
-> Maybe c |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
Unmounts a mount. This is an asynchronous operation, and is
finished by calling mountUnmountWithOperationFinish
with the mount
and AsyncResult
data returned in the callback
.
Since: 2.22
unmountWithOperationFinish
mountUnmountWithOperationFinish Source #
:: (HasCallStack, MonadIO m, IsMount a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m () | (Can throw |
Finishes unmounting a mount. If any errors occurred during the operation,
error
will be set to contain the errors and False
will be returned.
Since: 2.22
unshadow
:: (HasCallStack, MonadIO m, IsMount a) | |
=> a |
|
-> m () |
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.
Since: 2.20
Signals
changed
type C_MountChangedCallback = Ptr () -> Ptr () -> IO () Source #
Type for the callback on the (unwrapped) C side.
type MountChangedCallback = IO () Source #
Emitted when the mount has been changed.
afterMountChanged :: (IsMount a, MonadIO m) => a -> MountChangedCallback -> m SignalHandlerId Source #
Connect a signal handler for the changed signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
mount #changed callback
genClosure_MountChanged :: MonadIO m => MountChangedCallback -> m (GClosure C_MountChangedCallback) Source #
Wrap the callback into a GClosure
.
mk_MountChangedCallback :: C_MountChangedCallback -> IO (FunPtr C_MountChangedCallback) Source #
Generate a function pointer callable from C code, from a C_MountChangedCallback
.
noMountChangedCallback :: Maybe MountChangedCallback Source #
A convenience synonym for
.Nothing
:: Maybe
MountChangedCallback
onMountChanged :: (IsMount a, MonadIO m) => a -> MountChangedCallback -> m SignalHandlerId Source #
Connect a signal handler for the changed signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
mount #changed callback
wrap_MountChangedCallback :: MountChangedCallback -> C_MountChangedCallback Source #
Wrap a MountChangedCallback
into a C_MountChangedCallback
.
preUnmount
type C_MountPreUnmountCallback = Ptr () -> Ptr () -> IO () Source #
Type for the callback on the (unwrapped) C side.
type MountPreUnmountCallback = IO () Source #
This signal may be emitted when the Mount
is about to be
unmounted.
This signal depends on the backend and is only emitted if GIO was used to unmount.
Since: 2.22
afterMountPreUnmount :: (IsMount a, MonadIO m) => a -> MountPreUnmountCallback -> m SignalHandlerId Source #
Connect a signal handler for the preUnmount signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
mount #preUnmount callback
genClosure_MountPreUnmount :: MonadIO m => MountPreUnmountCallback -> m (GClosure C_MountPreUnmountCallback) Source #
Wrap the callback into a GClosure
.
mk_MountPreUnmountCallback :: C_MountPreUnmountCallback -> IO (FunPtr C_MountPreUnmountCallback) Source #
Generate a function pointer callable from C code, from a C_MountPreUnmountCallback
.
noMountPreUnmountCallback :: Maybe MountPreUnmountCallback Source #
A convenience synonym for
.Nothing
:: Maybe
MountPreUnmountCallback
onMountPreUnmount :: (IsMount a, MonadIO m) => a -> MountPreUnmountCallback -> m SignalHandlerId Source #
Connect a signal handler for the preUnmount signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
mount #preUnmount callback
wrap_MountPreUnmountCallback :: MountPreUnmountCallback -> C_MountPreUnmountCallback Source #
Wrap a MountPreUnmountCallback
into a C_MountPreUnmountCallback
.
unmounted
type C_MountUnmountedCallback = Ptr () -> Ptr () -> IO () Source #
Type for the callback on the (unwrapped) C side.
type MountUnmountedCallback = IO () Source #
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.
afterMountUnmounted :: (IsMount a, MonadIO m) => a -> MountUnmountedCallback -> m SignalHandlerId Source #
Connect a signal handler for the unmounted signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
mount #unmounted callback
genClosure_MountUnmounted :: MonadIO m => MountUnmountedCallback -> m (GClosure C_MountUnmountedCallback) Source #
Wrap the callback into a GClosure
.
mk_MountUnmountedCallback :: C_MountUnmountedCallback -> IO (FunPtr C_MountUnmountedCallback) Source #
Generate a function pointer callable from C code, from a C_MountUnmountedCallback
.
noMountUnmountedCallback :: Maybe MountUnmountedCallback Source #
A convenience synonym for
.Nothing
:: Maybe
MountUnmountedCallback
onMountUnmounted :: (IsMount a, MonadIO m) => a -> MountUnmountedCallback -> m SignalHandlerId Source #
Connect a signal handler for the unmounted signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
mount #unmounted callback