gi-gio-2.0.24: Gio bindings

CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (inaki@blueleaf.cc)
Safe HaskellNone
LanguageHaskell2010

GI.Gio.Interfaces.Mount

Contents

Description

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

Exported types

newtype Mount Source #

Memory-managed wrapper type.

Constructors

Mount (ManagedPtr Mount) 
Instances
GObject Mount Source # 
Instance details

Defined in GI.Gio.Interfaces.Mount

Methods

gobjectType :: IO GType #

HasParentTypes Mount Source # 
Instance details

Defined in GI.Gio.Interfaces.Mount

type ParentTypes Mount Source # 
Instance details

Defined in GI.Gio.Interfaces.Mount

type ParentTypes Mount = Object ': ([] :: [Type])

noMount :: Maybe Mount Source #

A convenience alias for Nothing :: Maybe Mount.

class (GObject o, IsDescendantOf Mount o) => IsMount o Source #

Type class for types which can be safely cast to Mount, for instance with toMount.

Instances
(GObject o, IsDescendantOf Mount o) => IsMount o Source # 
Instance details

Defined in GI.Gio.Interfaces.Mount

toMount :: (MonadIO m, IsMount o) => o -> m Mount Source #

Cast to Mount, for types for which this is known to be safe. For general casts, use castTo.

Methods

canEject

mountCanEject Source #

Arguments

:: (HasCallStack, MonadIO m, IsMount a) 
=> a

mount: a Mount.

-> m Bool

Returns: True if the mount can be ejected.

Checks if mount can be ejected.

canUnmount

mountCanUnmount Source #

Arguments

:: (HasCallStack, MonadIO m, IsMount a) 
=> a

mount: a Mount.

-> m Bool

Returns: True if the mount can be unmounted.

Checks if mount can be unmounted.

eject

mountEject Source #

Arguments

:: (HasCallStack, MonadIO m, IsMount a, IsCancellable b) 
=> a

mount: a Mount.

-> [MountUnmountFlags]

flags: flags affecting the unmount if required for eject

-> Maybe b

cancellable: optional Cancellable object, Nothing to ignore.

-> Maybe AsyncReadyCallback

callback: a AsyncReadyCallback, or Nothing.

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

mountEjectFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsMount a, IsAsyncResult b) 
=> a

mount: a Mount.

-> b

result: a AsyncResult.

-> m ()

(Can throw GError)

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 #

Arguments

:: (HasCallStack, MonadIO m, IsMount a, IsMountOperation b, IsCancellable c) 
=> a

mount: a Mount.

-> [MountUnmountFlags]

flags: flags affecting the unmount if required for eject

-> Maybe b

mountOperation: a MountOperation or Nothing to avoid user interaction.

-> Maybe c

cancellable: optional Cancellable object, Nothing to ignore.

-> Maybe AsyncReadyCallback

callback: a AsyncReadyCallback, or Nothing.

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

Arguments

:: (HasCallStack, MonadIO m, IsMount a, IsAsyncResult b) 
=> a

mount: a Mount.

-> b

result: a AsyncResult.

-> m ()

(Can throw GError)

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 #

Arguments

:: (HasCallStack, MonadIO m, IsMount a) 
=> a

mount: a Mount.

-> m File

Returns: a File. The returned object should be unreffed with objectUnref when no longer needed.

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

mountGetDrive Source #

Arguments

:: (HasCallStack, MonadIO m, IsMount a) 
=> a

mount: a Mount.

-> m (Maybe Drive)

Returns: a Drive or Nothing if mount is not associated with a volume or a drive. The returned object should be unreffed with objectUnref when no longer needed.

Gets the drive for the mount.

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

getIcon

mountGetIcon Source #

Arguments

:: (HasCallStack, MonadIO m, IsMount a) 
=> a

mount: a Mount.

-> m Icon

Returns: a Icon. The returned object should be unreffed with objectUnref when no longer needed.

Gets the icon for mount.

getName

mountGetName Source #

Arguments

:: (HasCallStack, MonadIO m, IsMount a) 
=> a

mount: a Mount.

-> m Text

Returns: the name for the given mount. The returned string should be freed with free when no longer needed.

Gets the name of mount.

getRoot

mountGetRoot Source #

Arguments

:: (HasCallStack, MonadIO m, IsMount a) 
=> a

mount: a Mount.

-> m File

Returns: a File. The returned object should be unreffed with objectUnref when no longer needed.

Gets the root directory on mount.

getSortKey

mountGetSortKey Source #

Arguments

:: (HasCallStack, MonadIO m, IsMount a) 
=> a

mount: A Mount.

-> m (Maybe Text)

Returns: Sorting key for mount or Nothing if no such key is available.

Gets the sort key for mount, if any.

Since: 2.32

getSymbolicIcon

mountGetSymbolicIcon Source #

Arguments

:: (HasCallStack, MonadIO m, IsMount a) 
=> a

mount: a Mount.

-> m Icon

Returns: a Icon. The returned object should be unreffed with objectUnref when no longer needed.

Gets the symbolic icon for mount.

Since: 2.34

getUuid

mountGetUuid Source #

Arguments

:: (HasCallStack, MonadIO m, IsMount a) 
=> a

mount: a Mount.

-> m (Maybe Text)

Returns: the UUID for mount or Nothing if no UUID can be computed. The returned string should be freed with free when no longer needed.

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

mountGetVolume Source #

Arguments

:: (HasCallStack, MonadIO m, IsMount a) 
=> a

mount: a Mount.

-> m (Maybe Volume)

Returns: a Volume or Nothing if mount is not associated with a volume. The returned object should be unreffed with objectUnref when no longer needed.

Gets the volume for the mount.

guessContentType

mountGuessContentType Source #

Arguments

:: (HasCallStack, MonadIO m, IsMount a, IsCancellable b) 
=> a

mount: a Mount

-> Bool

forceRescan: Whether to force a rescan of the content. Otherwise a cached result will be used if available

-> Maybe b

cancellable: optional Cancellable object, Nothing to ignore

-> Maybe AsyncReadyCallback

callback: a 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 #

Arguments

:: (HasCallStack, MonadIO m, IsMount a, IsAsyncResult b) 
=> a

mount: a Mount

-> b

result: a AsyncResult

-> m [Text]

Returns: a Nothing-terminated array of content types or Nothing on error. Caller should free this array with strfreev when done with it. (Can throw GError)

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 #

Arguments

:: (HasCallStack, MonadIO m, IsMount a, IsCancellable b) 
=> a

mount: a Mount

-> Bool

forceRescan: Whether to force a rescan of the content. Otherwise a cached result will be used if available

-> Maybe b

cancellable: optional Cancellable object, Nothing to ignore

-> m [Text]

Returns: a Nothing-terminated array of content types or Nothing on error. Caller should free this array with strfreev when done with it. (Can throw GError)

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

mountIsShadowed Source #

Arguments

:: (HasCallStack, MonadIO m, IsMount a) 
=> a

mount: A Mount.

-> m 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://[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

mountRemount Source #

Arguments

:: (HasCallStack, MonadIO m, IsMount a, IsMountOperation b, IsCancellable c) 
=> a

mount: a Mount.

-> [MountMountFlags]

flags: flags affecting the operation

-> Maybe b

mountOperation: a MountOperation or Nothing to avoid user interaction.

-> Maybe c

cancellable: optional Cancellable object, Nothing to ignore.

-> Maybe AsyncReadyCallback

callback: a AsyncReadyCallback, or Nothing.

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

mountRemountFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsMount a, IsAsyncResult b) 
=> a

mount: a Mount.

-> b

result: a AsyncResult.

-> m ()

(Can throw GError)

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

mountShadow Source #

Arguments

:: (HasCallStack, MonadIO m, IsMount a) 
=> a

mount: A Mount.

-> 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 Mount::changed signal on mount manually.

Since: 2.20

unmount

mountUnmount Source #

Arguments

:: (HasCallStack, MonadIO m, IsMount a, IsCancellable b) 
=> a

mount: a Mount.

-> [MountUnmountFlags]

flags: flags affecting the operation

-> Maybe b

cancellable: optional Cancellable object, Nothing to ignore.

-> Maybe AsyncReadyCallback

callback: a AsyncReadyCallback, or Nothing.

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

mountUnmountFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsMount a, IsAsyncResult b) 
=> a

mount: a Mount.

-> b

result: a AsyncResult.

-> m ()

(Can throw GError)

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 #

Arguments

:: (HasCallStack, MonadIO m, IsMount a, IsMountOperation b, IsCancellable c) 
=> a

mount: a Mount.

-> [MountUnmountFlags]

flags: flags affecting the operation

-> Maybe b

mountOperation: a MountOperation or Nothing to avoid user interaction.

-> Maybe c

cancellable: optional Cancellable object, Nothing to ignore.

-> Maybe AsyncReadyCallback

callback: a AsyncReadyCallback, or Nothing.

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

Arguments

:: (HasCallStack, MonadIO m, IsMount a, IsAsyncResult b) 
=> a

mount: a Mount.

-> b

result: a AsyncResult.

-> m ()

(Can throw GError)

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

mountUnshadow Source #

Arguments

:: (HasCallStack, MonadIO m, IsMount a) 
=> a

mount: A Mount.

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

mk_MountChangedCallback :: C_MountChangedCallback -> IO (FunPtr C_MountChangedCallback) Source #

Generate a function pointer callable from C code, from a C_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

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 “pre-unmount” signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after mount #preUnmount callback

onMountPreUnmount :: (IsMount a, MonadIO m) => a -> MountPreUnmountCallback -> m SignalHandlerId Source #

Connect a signal handler for the “pre-unmount” signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on mount #preUnmount callback

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

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