gi-gio-2.0.20: GI/Gio/Interfaces/Mount.hs
{- |
Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)
The 'GI.Gio.Interfaces.Mount.Mount' interface represents user-visible mounts. Note, when
porting from GnomeVFS, 'GI.Gio.Interfaces.Mount.Mount' is the moral equivalent of @/GnomeVFSVolume/@.
'GI.Gio.Interfaces.Mount.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 'GI.Gio.Interfaces.Mount.Mount' instance is an asynchronous operation. For
more information about asynchronous operations, see 'GI.Gio.Interfaces.AsyncResult.AsyncResult'
and 'GI.Gio.Objects.Task.Task'. To unmount a 'GI.Gio.Interfaces.Mount.Mount' instance, first call
'GI.Gio.Interfaces.Mount.mountUnmountWithOperation' with (at least) the 'GI.Gio.Interfaces.Mount.Mount' instance and a
'GI.Gio.Callbacks.AsyncReadyCallback'. The callback will be fired when the
operation has resolved (either with success or failure), and a
'GI.Gio.Interfaces.AsyncResult.AsyncResult' structure will be passed to the callback. That
callback should then call 'GI.Gio.Interfaces.Mount.mountUnmountWithOperationFinish' with the 'GI.Gio.Interfaces.Mount.Mount'
and the 'GI.Gio.Interfaces.AsyncResult.AsyncResult' data to see if the operation was completed
successfully. If an /@error@/ is present when 'GI.Gio.Interfaces.Mount.mountUnmountWithOperationFinish'
is called, then it will be filled with any error information.
-}
#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Gio.Interfaces.Mount
(
-- * Exported types
Mount(..) ,
noMount ,
IsMount ,
toMount ,
-- * Methods
-- ** canEject #method:canEject#
#if ENABLE_OVERLOADING
MountCanEjectMethodInfo ,
#endif
mountCanEject ,
-- ** canUnmount #method:canUnmount#
#if ENABLE_OVERLOADING
MountCanUnmountMethodInfo ,
#endif
mountCanUnmount ,
-- ** eject #method:eject#
#if ENABLE_OVERLOADING
MountEjectMethodInfo ,
#endif
mountEject ,
-- ** ejectFinish #method:ejectFinish#
#if ENABLE_OVERLOADING
MountEjectFinishMethodInfo ,
#endif
mountEjectFinish ,
-- ** ejectWithOperation #method:ejectWithOperation#
#if ENABLE_OVERLOADING
MountEjectWithOperationMethodInfo ,
#endif
mountEjectWithOperation ,
-- ** ejectWithOperationFinish #method:ejectWithOperationFinish#
#if ENABLE_OVERLOADING
MountEjectWithOperationFinishMethodInfo ,
#endif
mountEjectWithOperationFinish ,
-- ** getDefaultLocation #method:getDefaultLocation#
#if ENABLE_OVERLOADING
MountGetDefaultLocationMethodInfo ,
#endif
mountGetDefaultLocation ,
-- ** getDrive #method:getDrive#
#if ENABLE_OVERLOADING
MountGetDriveMethodInfo ,
#endif
mountGetDrive ,
-- ** getIcon #method:getIcon#
#if ENABLE_OVERLOADING
MountGetIconMethodInfo ,
#endif
mountGetIcon ,
-- ** getName #method:getName#
#if ENABLE_OVERLOADING
MountGetNameMethodInfo ,
#endif
mountGetName ,
-- ** getRoot #method:getRoot#
#if ENABLE_OVERLOADING
MountGetRootMethodInfo ,
#endif
mountGetRoot ,
-- ** getSortKey #method:getSortKey#
#if ENABLE_OVERLOADING
MountGetSortKeyMethodInfo ,
#endif
mountGetSortKey ,
-- ** getSymbolicIcon #method:getSymbolicIcon#
#if ENABLE_OVERLOADING
MountGetSymbolicIconMethodInfo ,
#endif
mountGetSymbolicIcon ,
-- ** getUuid #method:getUuid#
#if ENABLE_OVERLOADING
MountGetUuidMethodInfo ,
#endif
mountGetUuid ,
-- ** getVolume #method:getVolume#
#if ENABLE_OVERLOADING
MountGetVolumeMethodInfo ,
#endif
mountGetVolume ,
-- ** guessContentType #method:guessContentType#
#if ENABLE_OVERLOADING
MountGuessContentTypeMethodInfo ,
#endif
mountGuessContentType ,
-- ** guessContentTypeFinish #method:guessContentTypeFinish#
#if ENABLE_OVERLOADING
MountGuessContentTypeFinishMethodInfo ,
#endif
mountGuessContentTypeFinish ,
-- ** guessContentTypeSync #method:guessContentTypeSync#
#if ENABLE_OVERLOADING
MountGuessContentTypeSyncMethodInfo ,
#endif
mountGuessContentTypeSync ,
-- ** isShadowed #method:isShadowed#
#if ENABLE_OVERLOADING
MountIsShadowedMethodInfo ,
#endif
mountIsShadowed ,
-- ** remount #method:remount#
#if ENABLE_OVERLOADING
MountRemountMethodInfo ,
#endif
mountRemount ,
-- ** remountFinish #method:remountFinish#
#if ENABLE_OVERLOADING
MountRemountFinishMethodInfo ,
#endif
mountRemountFinish ,
-- ** shadow #method:shadow#
#if ENABLE_OVERLOADING
MountShadowMethodInfo ,
#endif
mountShadow ,
-- ** unmount #method:unmount#
#if ENABLE_OVERLOADING
MountUnmountMethodInfo ,
#endif
mountUnmount ,
-- ** unmountFinish #method:unmountFinish#
#if ENABLE_OVERLOADING
MountUnmountFinishMethodInfo ,
#endif
mountUnmountFinish ,
-- ** unmountWithOperation #method:unmountWithOperation#
#if ENABLE_OVERLOADING
MountUnmountWithOperationMethodInfo ,
#endif
mountUnmountWithOperation ,
-- ** unmountWithOperationFinish #method:unmountWithOperationFinish#
#if ENABLE_OVERLOADING
MountUnmountWithOperationFinishMethodInfo,
#endif
mountUnmountWithOperationFinish ,
-- ** unshadow #method:unshadow#
#if ENABLE_OVERLOADING
MountUnshadowMethodInfo ,
#endif
mountUnshadow ,
-- * Signals
-- ** changed #signal:changed#
C_MountChangedCallback ,
MountChangedCallback ,
#if ENABLE_OVERLOADING
MountChangedSignalInfo ,
#endif
afterMountChanged ,
genClosure_MountChanged ,
mk_MountChangedCallback ,
noMountChangedCallback ,
onMountChanged ,
wrap_MountChangedCallback ,
-- ** preUnmount #signal:preUnmount#
C_MountPreUnmountCallback ,
MountPreUnmountCallback ,
#if ENABLE_OVERLOADING
MountPreUnmountSignalInfo ,
#endif
afterMountPreUnmount ,
genClosure_MountPreUnmount ,
mk_MountPreUnmountCallback ,
noMountPreUnmountCallback ,
onMountPreUnmount ,
wrap_MountPreUnmountCallback ,
-- ** unmounted #signal:unmounted#
C_MountUnmountedCallback ,
MountUnmountedCallback ,
#if ENABLE_OVERLOADING
MountUnmountedSignalInfo ,
#endif
afterMountUnmounted ,
genClosure_MountUnmounted ,
mk_MountUnmountedCallback ,
noMountUnmountedCallback ,
onMountUnmounted ,
wrap_MountUnmountedCallback ,
) where
import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P
import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Callbacks as Gio.Callbacks
import {-# SOURCE #-} qualified GI.Gio.Flags as Gio.Flags
import {-# SOURCE #-} qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import {-# SOURCE #-} qualified GI.Gio.Interfaces.Drive as Gio.Drive
import {-# SOURCE #-} qualified GI.Gio.Interfaces.File as Gio.File
import {-# SOURCE #-} qualified GI.Gio.Interfaces.Icon as Gio.Icon
import {-# SOURCE #-} qualified GI.Gio.Interfaces.Volume as Gio.Volume
import {-# SOURCE #-} qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import {-# SOURCE #-} qualified GI.Gio.Objects.MountOperation as Gio.MountOperation
-- interface Mount
-- | Memory-managed wrapper type.
newtype Mount = Mount (ManagedPtr Mount)
-- | A convenience alias for `Nothing` :: `Maybe` `Mount`.
noMount :: Maybe Mount
noMount = Nothing
-- signal Mount::changed
{- |
Emitted when the mount has been changed.
-}
type MountChangedCallback =
IO ()
-- | A convenience synonym for @`Nothing` :: `Maybe` `MountChangedCallback`@.
noMountChangedCallback :: Maybe MountChangedCallback
noMountChangedCallback = Nothing
-- | Type for the callback on the (unwrapped) C side.
type C_MountChangedCallback =
Ptr () -> -- object
Ptr () -> -- user_data
IO ()
-- | Generate a function pointer callable from C code, from a `C_MountChangedCallback`.
foreign import ccall "wrapper"
mk_MountChangedCallback :: C_MountChangedCallback -> IO (FunPtr C_MountChangedCallback)
-- | Wrap the callback into a `GClosure`.
genClosure_MountChanged :: MonadIO m => MountChangedCallback -> m (GClosure C_MountChangedCallback)
genClosure_MountChanged cb = liftIO $ do
let cb' = wrap_MountChangedCallback cb
mk_MountChangedCallback cb' >>= B.GClosure.newGClosure
-- | Wrap a `MountChangedCallback` into a `C_MountChangedCallback`.
wrap_MountChangedCallback ::
MountChangedCallback ->
C_MountChangedCallback
wrap_MountChangedCallback _cb _ _ = do
_cb
{- |
Connect a signal handler for the “@changed@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Signals.on' mount #changed callback
@
-}
onMountChanged :: (IsMount a, MonadIO m) => a -> MountChangedCallback -> m SignalHandlerId
onMountChanged obj cb = liftIO $ do
let cb' = wrap_MountChangedCallback cb
cb'' <- mk_MountChangedCallback cb'
connectSignalFunPtr obj "changed" cb'' SignalConnectBefore
{- |
Connect a signal handler for the “@changed@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Signals.after' mount #changed callback
@
-}
afterMountChanged :: (IsMount a, MonadIO m) => a -> MountChangedCallback -> m SignalHandlerId
afterMountChanged obj cb = liftIO $ do
let cb' = wrap_MountChangedCallback cb
cb'' <- mk_MountChangedCallback cb'
connectSignalFunPtr obj "changed" cb'' SignalConnectAfter
-- signal Mount::pre-unmount
{- |
This signal may be emitted when the 'GI.Gio.Interfaces.Mount.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/
-}
type MountPreUnmountCallback =
IO ()
-- | A convenience synonym for @`Nothing` :: `Maybe` `MountPreUnmountCallback`@.
noMountPreUnmountCallback :: Maybe MountPreUnmountCallback
noMountPreUnmountCallback = Nothing
-- | Type for the callback on the (unwrapped) C side.
type C_MountPreUnmountCallback =
Ptr () -> -- object
Ptr () -> -- user_data
IO ()
-- | Generate a function pointer callable from C code, from a `C_MountPreUnmountCallback`.
foreign import ccall "wrapper"
mk_MountPreUnmountCallback :: C_MountPreUnmountCallback -> IO (FunPtr C_MountPreUnmountCallback)
-- | Wrap the callback into a `GClosure`.
genClosure_MountPreUnmount :: MonadIO m => MountPreUnmountCallback -> m (GClosure C_MountPreUnmountCallback)
genClosure_MountPreUnmount cb = liftIO $ do
let cb' = wrap_MountPreUnmountCallback cb
mk_MountPreUnmountCallback cb' >>= B.GClosure.newGClosure
-- | Wrap a `MountPreUnmountCallback` into a `C_MountPreUnmountCallback`.
wrap_MountPreUnmountCallback ::
MountPreUnmountCallback ->
C_MountPreUnmountCallback
wrap_MountPreUnmountCallback _cb _ _ = do
_cb
{- |
Connect a signal handler for the “@pre-unmount@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Signals.on' mount #preUnmount callback
@
-}
onMountPreUnmount :: (IsMount a, MonadIO m) => a -> MountPreUnmountCallback -> m SignalHandlerId
onMountPreUnmount obj cb = liftIO $ do
let cb' = wrap_MountPreUnmountCallback cb
cb'' <- mk_MountPreUnmountCallback cb'
connectSignalFunPtr obj "pre-unmount" cb'' SignalConnectBefore
{- |
Connect a signal handler for the “@pre-unmount@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Signals.after' mount #preUnmount callback
@
-}
afterMountPreUnmount :: (IsMount a, MonadIO m) => a -> MountPreUnmountCallback -> m SignalHandlerId
afterMountPreUnmount obj cb = liftIO $ do
let cb' = wrap_MountPreUnmountCallback cb
cb'' <- mk_MountPreUnmountCallback cb'
connectSignalFunPtr obj "pre-unmount" cb'' SignalConnectAfter
-- signal Mount::unmounted
{- |
This signal is emitted when the 'GI.Gio.Interfaces.Mount.Mount' have been
unmounted. If the recipient is holding references to the
object they should release them so the object can be
finalized.
-}
type MountUnmountedCallback =
IO ()
-- | A convenience synonym for @`Nothing` :: `Maybe` `MountUnmountedCallback`@.
noMountUnmountedCallback :: Maybe MountUnmountedCallback
noMountUnmountedCallback = Nothing
-- | Type for the callback on the (unwrapped) C side.
type C_MountUnmountedCallback =
Ptr () -> -- object
Ptr () -> -- user_data
IO ()
-- | Generate a function pointer callable from C code, from a `C_MountUnmountedCallback`.
foreign import ccall "wrapper"
mk_MountUnmountedCallback :: C_MountUnmountedCallback -> IO (FunPtr C_MountUnmountedCallback)
-- | Wrap the callback into a `GClosure`.
genClosure_MountUnmounted :: MonadIO m => MountUnmountedCallback -> m (GClosure C_MountUnmountedCallback)
genClosure_MountUnmounted cb = liftIO $ do
let cb' = wrap_MountUnmountedCallback cb
mk_MountUnmountedCallback cb' >>= B.GClosure.newGClosure
-- | Wrap a `MountUnmountedCallback` into a `C_MountUnmountedCallback`.
wrap_MountUnmountedCallback ::
MountUnmountedCallback ->
C_MountUnmountedCallback
wrap_MountUnmountedCallback _cb _ _ = do
_cb
{- |
Connect a signal handler for the “@unmounted@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Signals.on' mount #unmounted callback
@
-}
onMountUnmounted :: (IsMount a, MonadIO m) => a -> MountUnmountedCallback -> m SignalHandlerId
onMountUnmounted obj cb = liftIO $ do
let cb' = wrap_MountUnmountedCallback cb
cb'' <- mk_MountUnmountedCallback cb'
connectSignalFunPtr obj "unmounted" cb'' SignalConnectBefore
{- |
Connect a signal handler for the “@unmounted@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Signals.after' mount #unmounted callback
@
-}
afterMountUnmounted :: (IsMount a, MonadIO m) => a -> MountUnmountedCallback -> m SignalHandlerId
afterMountUnmounted obj cb = liftIO $ do
let cb' = wrap_MountUnmountedCallback cb
cb'' <- mk_MountUnmountedCallback cb'
connectSignalFunPtr obj "unmounted" cb'' SignalConnectAfter
#if ENABLE_OVERLOADING
data MountChangedSignalInfo
instance SignalInfo MountChangedSignalInfo where
type HaskellCallbackType MountChangedSignalInfo = MountChangedCallback
connectSignal _ obj cb connectMode = do
let cb' = wrap_MountChangedCallback cb
cb'' <- mk_MountChangedCallback cb'
connectSignalFunPtr obj "changed" cb'' connectMode
data MountPreUnmountSignalInfo
instance SignalInfo MountPreUnmountSignalInfo where
type HaskellCallbackType MountPreUnmountSignalInfo = MountPreUnmountCallback
connectSignal _ obj cb connectMode = do
let cb' = wrap_MountPreUnmountCallback cb
cb'' <- mk_MountPreUnmountCallback cb'
connectSignalFunPtr obj "pre-unmount" cb'' connectMode
data MountUnmountedSignalInfo
instance SignalInfo MountUnmountedSignalInfo where
type HaskellCallbackType MountUnmountedSignalInfo = MountUnmountedCallback
connectSignal _ obj cb connectMode = do
let cb' = wrap_MountUnmountedCallback cb
cb'' <- mk_MountUnmountedCallback cb'
connectSignalFunPtr obj "unmounted" cb'' connectMode
type instance O.SignalList Mount = MountSignalList
type MountSignalList = ('[ '("changed", MountChangedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("preUnmount", MountPreUnmountSignalInfo), '("unmounted", MountUnmountedSignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "g_mount_get_type"
c_g_mount_get_type :: IO GType
instance GObject Mount where
gobjectType = c_g_mount_get_type
-- | Type class for types which can be safely cast to `Mount`, for instance with `toMount`.
class (GObject o, O.IsDescendantOf Mount o) => IsMount o
instance (GObject o, O.IsDescendantOf Mount o) => IsMount o
instance O.HasParentTypes Mount
type instance O.ParentTypes Mount = '[GObject.Object.Object]
-- | Cast to `Mount`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toMount :: (MonadIO m, IsMount o) => o -> m Mount
toMount = liftIO . unsafeCastTo Mount
#if ENABLE_OVERLOADING
instance O.HasAttributeList Mount
type instance O.AttributeList Mount = MountAttributeList
type MountAttributeList = ('[ ] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
#endif
#if ENABLE_OVERLOADING
type family ResolveMountMethod (t :: Symbol) (o :: *) :: * where
ResolveMountMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveMountMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveMountMethod "canEject" o = MountCanEjectMethodInfo
ResolveMountMethod "canUnmount" o = MountCanUnmountMethodInfo
ResolveMountMethod "eject" o = MountEjectMethodInfo
ResolveMountMethod "ejectFinish" o = MountEjectFinishMethodInfo
ResolveMountMethod "ejectWithOperation" o = MountEjectWithOperationMethodInfo
ResolveMountMethod "ejectWithOperationFinish" o = MountEjectWithOperationFinishMethodInfo
ResolveMountMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveMountMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveMountMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveMountMethod "guessContentType" o = MountGuessContentTypeMethodInfo
ResolveMountMethod "guessContentTypeFinish" o = MountGuessContentTypeFinishMethodInfo
ResolveMountMethod "guessContentTypeSync" o = MountGuessContentTypeSyncMethodInfo
ResolveMountMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveMountMethod "isShadowed" o = MountIsShadowedMethodInfo
ResolveMountMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveMountMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveMountMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveMountMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveMountMethod "remount" o = MountRemountMethodInfo
ResolveMountMethod "remountFinish" o = MountRemountFinishMethodInfo
ResolveMountMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveMountMethod "shadow" o = MountShadowMethodInfo
ResolveMountMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveMountMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveMountMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveMountMethod "unmount" o = MountUnmountMethodInfo
ResolveMountMethod "unmountFinish" o = MountUnmountFinishMethodInfo
ResolveMountMethod "unmountWithOperation" o = MountUnmountWithOperationMethodInfo
ResolveMountMethod "unmountWithOperationFinish" o = MountUnmountWithOperationFinishMethodInfo
ResolveMountMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveMountMethod "unshadow" o = MountUnshadowMethodInfo
ResolveMountMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveMountMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveMountMethod "getDefaultLocation" o = MountGetDefaultLocationMethodInfo
ResolveMountMethod "getDrive" o = MountGetDriveMethodInfo
ResolveMountMethod "getIcon" o = MountGetIconMethodInfo
ResolveMountMethod "getName" o = MountGetNameMethodInfo
ResolveMountMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveMountMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveMountMethod "getRoot" o = MountGetRootMethodInfo
ResolveMountMethod "getSortKey" o = MountGetSortKeyMethodInfo
ResolveMountMethod "getSymbolicIcon" o = MountGetSymbolicIconMethodInfo
ResolveMountMethod "getUuid" o = MountGetUuidMethodInfo
ResolveMountMethod "getVolume" o = MountGetVolumeMethodInfo
ResolveMountMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveMountMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveMountMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveMountMethod t Mount, O.MethodInfo info Mount p) => OL.IsLabel t (Mount -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif
-- method Mount::can_eject
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mount", argType = TInterface (Name {namespace = "Gio", name = "Mount"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GMount.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False
foreign import ccall "g_mount_can_eject" g_mount_can_eject ::
Ptr Mount -> -- mount : TInterface (Name {namespace = "Gio", name = "Mount"})
IO CInt
{- |
Checks if /@mount@/ can be ejected.
-}
mountCanEject ::
(B.CallStack.HasCallStack, MonadIO m, IsMount a) =>
a
{- ^ /@mount@/: a 'GI.Gio.Interfaces.Mount.Mount'. -}
-> m Bool
{- ^ __Returns:__ 'True' if the /@mount@/ can be ejected. -}
mountCanEject mount = liftIO $ do
mount' <- unsafeManagedPtrCastPtr mount
result <- g_mount_can_eject mount'
let result' = (/= 0) result
touchManagedPtr mount
return result'
#if ENABLE_OVERLOADING
data MountCanEjectMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsMount a) => O.MethodInfo MountCanEjectMethodInfo a signature where
overloadedMethod _ = mountCanEject
#endif
-- method Mount::can_unmount
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mount", argType = TInterface (Name {namespace = "Gio", name = "Mount"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GMount.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False
foreign import ccall "g_mount_can_unmount" g_mount_can_unmount ::
Ptr Mount -> -- mount : TInterface (Name {namespace = "Gio", name = "Mount"})
IO CInt
{- |
Checks if /@mount@/ can be unmounted.
-}
mountCanUnmount ::
(B.CallStack.HasCallStack, MonadIO m, IsMount a) =>
a
{- ^ /@mount@/: a 'GI.Gio.Interfaces.Mount.Mount'. -}
-> m Bool
{- ^ __Returns:__ 'True' if the /@mount@/ can be unmounted. -}
mountCanUnmount mount = liftIO $ do
mount' <- unsafeManagedPtrCastPtr mount
result <- g_mount_can_unmount mount'
let result' = (/= 0) result
touchManagedPtr mount
return result'
#if ENABLE_OVERLOADING
data MountCanUnmountMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsMount a) => O.MethodInfo MountCanUnmountMethodInfo a signature where
overloadedMethod _ = mountCanUnmount
#endif
-- method Mount::eject
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mount", argType = TInterface (Name {namespace = "Gio", name = "Mount"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GMount.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gio", name = "MountUnmountFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "flags affecting the unmount if required for eject", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "optional #GCancellable object, %NULL to ignore.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "callback", argType = TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GAsyncReadyCallback, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = 4, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data passed to @callback.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False
foreign import ccall "g_mount_eject" g_mount_eject ::
Ptr Mount -> -- mount : TInterface (Name {namespace = "Gio", name = "Mount"})
CUInt -> -- flags : TInterface (Name {namespace = "Gio", name = "MountUnmountFlags"})
Ptr Gio.Cancellable.Cancellable -> -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
Ptr () -> -- user_data : TBasicType TPtr
IO ()
{-# DEPRECATED mountEject ["(Since version 2.22)","Use 'GI.Gio.Interfaces.Mount.mountEjectWithOperation' instead."] #-}
{- |
Ejects a mount. This is an asynchronous operation, and is
finished by calling 'GI.Gio.Interfaces.Mount.mountEjectFinish' with the /@mount@/
and 'GI.Gio.Interfaces.AsyncResult.AsyncResult' data returned in the /@callback@/.
-}
mountEject ::
(B.CallStack.HasCallStack, MonadIO m, IsMount a, Gio.Cancellable.IsCancellable b) =>
a
{- ^ /@mount@/: a 'GI.Gio.Interfaces.Mount.Mount'. -}
-> [Gio.Flags.MountUnmountFlags]
{- ^ /@flags@/: flags affecting the unmount if required for eject -}
-> Maybe (b)
{- ^ /@cancellable@/: optional 'GI.Gio.Objects.Cancellable.Cancellable' object, 'Nothing' to ignore. -}
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
{- ^ /@callback@/: a 'GI.Gio.Callbacks.AsyncReadyCallback', or 'Nothing'. -}
-> m ()
mountEject mount flags cancellable callback = liftIO $ do
mount' <- unsafeManagedPtrCastPtr mount
let flags' = gflagsToWord flags
maybeCancellable <- case cancellable of
Nothing -> return nullPtr
Just jCancellable -> do
jCancellable' <- unsafeManagedPtrCastPtr jCancellable
return jCancellable'
maybeCallback <- case callback of
Nothing -> return (castPtrToFunPtr nullPtr)
Just jCallback -> do
ptrcallback <- callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback))
poke ptrcallback jCallback'
return jCallback'
let userData = nullPtr
g_mount_eject mount' flags' maybeCancellable maybeCallback userData
touchManagedPtr mount
whenJust cancellable touchManagedPtr
return ()
#if ENABLE_OVERLOADING
data MountEjectMethodInfo
instance (signature ~ ([Gio.Flags.MountUnmountFlags] -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsMount a, Gio.Cancellable.IsCancellable b) => O.MethodInfo MountEjectMethodInfo a signature where
overloadedMethod _ = mountEject
#endif
-- method Mount::eject_finish
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mount", argType = TInterface (Name {namespace = "Gio", name = "Mount"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GMount.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "result", argType = TInterface (Name {namespace = "Gio", name = "AsyncResult"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GAsyncResult.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False
foreign import ccall "g_mount_eject_finish" g_mount_eject_finish ::
Ptr Mount -> -- mount : TInterface (Name {namespace = "Gio", name = "Mount"})
Ptr Gio.AsyncResult.AsyncResult -> -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
Ptr (Ptr GError) -> -- error
IO CInt
{-# DEPRECATED mountEjectFinish ["(Since version 2.22)","Use 'GI.Gio.Interfaces.Mount.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.
-}
mountEjectFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsMount a, Gio.AsyncResult.IsAsyncResult b) =>
a
{- ^ /@mount@/: a 'GI.Gio.Interfaces.Mount.Mount'. -}
-> b
{- ^ /@result@/: a 'GI.Gio.Interfaces.AsyncResult.AsyncResult'. -}
-> m ()
{- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
mountEjectFinish mount result_ = liftIO $ do
mount' <- unsafeManagedPtrCastPtr mount
result_' <- unsafeManagedPtrCastPtr result_
onException (do
_ <- propagateGError $ g_mount_eject_finish mount' result_'
touchManagedPtr mount
touchManagedPtr result_
return ()
) (do
return ()
)
#if ENABLE_OVERLOADING
data MountEjectFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsMount a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo MountEjectFinishMethodInfo a signature where
overloadedMethod _ = mountEjectFinish
#endif
-- method Mount::eject_with_operation
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mount", argType = TInterface (Name {namespace = "Gio", name = "Mount"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GMount.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gio", name = "MountUnmountFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "flags affecting the unmount if required for eject", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "mount_operation", argType = TInterface (Name {namespace = "Gio", name = "MountOperation"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GMountOperation or %NULL to avoid\n user interaction.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "optional #GCancellable object, %NULL to ignore.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "callback", argType = TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GAsyncReadyCallback, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = 5, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data passed to @callback.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False
foreign import ccall "g_mount_eject_with_operation" g_mount_eject_with_operation ::
Ptr Mount -> -- mount : TInterface (Name {namespace = "Gio", name = "Mount"})
CUInt -> -- flags : TInterface (Name {namespace = "Gio", name = "MountUnmountFlags"})
Ptr Gio.MountOperation.MountOperation -> -- mount_operation : TInterface (Name {namespace = "Gio", name = "MountOperation"})
Ptr Gio.Cancellable.Cancellable -> -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
Ptr () -> -- user_data : TBasicType TPtr
IO ()
{- |
Ejects a mount. This is an asynchronous operation, and is
finished by calling 'GI.Gio.Interfaces.Mount.mountEjectWithOperationFinish' with the /@mount@/
and 'GI.Gio.Interfaces.AsyncResult.AsyncResult' data returned in the /@callback@/.
/Since: 2.22/
-}
mountEjectWithOperation ::
(B.CallStack.HasCallStack, MonadIO m, IsMount a, Gio.MountOperation.IsMountOperation b, Gio.Cancellable.IsCancellable c) =>
a
{- ^ /@mount@/: a 'GI.Gio.Interfaces.Mount.Mount'. -}
-> [Gio.Flags.MountUnmountFlags]
{- ^ /@flags@/: flags affecting the unmount if required for eject -}
-> Maybe (b)
{- ^ /@mountOperation@/: a 'GI.Gio.Objects.MountOperation.MountOperation' or 'Nothing' to avoid
user interaction. -}
-> Maybe (c)
{- ^ /@cancellable@/: optional 'GI.Gio.Objects.Cancellable.Cancellable' object, 'Nothing' to ignore. -}
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
{- ^ /@callback@/: a 'GI.Gio.Callbacks.AsyncReadyCallback', or 'Nothing'. -}
-> m ()
mountEjectWithOperation mount flags mountOperation cancellable callback = liftIO $ do
mount' <- unsafeManagedPtrCastPtr mount
let flags' = gflagsToWord flags
maybeMountOperation <- case mountOperation of
Nothing -> return nullPtr
Just jMountOperation -> do
jMountOperation' <- unsafeManagedPtrCastPtr jMountOperation
return jMountOperation'
maybeCancellable <- case cancellable of
Nothing -> return nullPtr
Just jCancellable -> do
jCancellable' <- unsafeManagedPtrCastPtr jCancellable
return jCancellable'
maybeCallback <- case callback of
Nothing -> return (castPtrToFunPtr nullPtr)
Just jCallback -> do
ptrcallback <- callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback))
poke ptrcallback jCallback'
return jCallback'
let userData = nullPtr
g_mount_eject_with_operation mount' flags' maybeMountOperation maybeCancellable maybeCallback userData
touchManagedPtr mount
whenJust mountOperation touchManagedPtr
whenJust cancellable touchManagedPtr
return ()
#if ENABLE_OVERLOADING
data MountEjectWithOperationMethodInfo
instance (signature ~ ([Gio.Flags.MountUnmountFlags] -> Maybe (b) -> Maybe (c) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsMount a, Gio.MountOperation.IsMountOperation b, Gio.Cancellable.IsCancellable c) => O.MethodInfo MountEjectWithOperationMethodInfo a signature where
overloadedMethod _ = mountEjectWithOperation
#endif
-- method Mount::eject_with_operation_finish
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mount", argType = TInterface (Name {namespace = "Gio", name = "Mount"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GMount.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "result", argType = TInterface (Name {namespace = "Gio", name = "AsyncResult"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GAsyncResult.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False
foreign import ccall "g_mount_eject_with_operation_finish" g_mount_eject_with_operation_finish ::
Ptr Mount -> -- mount : TInterface (Name {namespace = "Gio", name = "Mount"})
Ptr Gio.AsyncResult.AsyncResult -> -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
Ptr (Ptr GError) -> -- error
IO CInt
{- |
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/
-}
mountEjectWithOperationFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsMount a, Gio.AsyncResult.IsAsyncResult b) =>
a
{- ^ /@mount@/: a 'GI.Gio.Interfaces.Mount.Mount'. -}
-> b
{- ^ /@result@/: a 'GI.Gio.Interfaces.AsyncResult.AsyncResult'. -}
-> m ()
{- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
mountEjectWithOperationFinish mount result_ = liftIO $ do
mount' <- unsafeManagedPtrCastPtr mount
result_' <- unsafeManagedPtrCastPtr result_
onException (do
_ <- propagateGError $ g_mount_eject_with_operation_finish mount' result_'
touchManagedPtr mount
touchManagedPtr result_
return ()
) (do
return ()
)
#if ENABLE_OVERLOADING
data MountEjectWithOperationFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsMount a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo MountEjectWithOperationFinishMethodInfo a signature where
overloadedMethod _ = mountEjectWithOperationFinish
#endif
-- method Mount::get_default_location
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mount", argType = TInterface (Name {namespace = "Gio", name = "Mount"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GMount.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "File"}))
-- throws : False
-- Skip return : False
foreign import ccall "g_mount_get_default_location" g_mount_get_default_location ::
Ptr Mount -> -- mount : TInterface (Name {namespace = "Gio", name = "Mount"})
IO (Ptr Gio.File.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).
-}
mountGetDefaultLocation ::
(B.CallStack.HasCallStack, MonadIO m, IsMount a) =>
a
{- ^ /@mount@/: a 'GI.Gio.Interfaces.Mount.Mount'. -}
-> m Gio.File.File
{- ^ __Returns:__ a 'GI.Gio.Interfaces.File.File'.
The returned object should be unreffed with
'GI.GObject.Objects.Object.objectUnref' when no longer needed. -}
mountGetDefaultLocation mount = liftIO $ do
mount' <- unsafeManagedPtrCastPtr mount
result <- g_mount_get_default_location mount'
checkUnexpectedReturnNULL "mountGetDefaultLocation" result
result' <- (wrapObject Gio.File.File) result
touchManagedPtr mount
return result'
#if ENABLE_OVERLOADING
data MountGetDefaultLocationMethodInfo
instance (signature ~ (m Gio.File.File), MonadIO m, IsMount a) => O.MethodInfo MountGetDefaultLocationMethodInfo a signature where
overloadedMethod _ = mountGetDefaultLocation
#endif
-- method Mount::get_drive
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mount", argType = TInterface (Name {namespace = "Gio", name = "Mount"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GMount.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "Drive"}))
-- throws : False
-- Skip return : False
foreign import ccall "g_mount_get_drive" g_mount_get_drive ::
Ptr Mount -> -- mount : TInterface (Name {namespace = "Gio", name = "Mount"})
IO (Ptr Gio.Drive.Drive)
{- |
Gets the drive for the /@mount@/.
This is a convenience method for getting the 'GI.Gio.Interfaces.Volume.Volume' and then
using that object to get the 'GI.Gio.Interfaces.Drive.Drive'.
-}
mountGetDrive ::
(B.CallStack.HasCallStack, MonadIO m, IsMount a) =>
a
{- ^ /@mount@/: a 'GI.Gio.Interfaces.Mount.Mount'. -}
-> m (Maybe Gio.Drive.Drive)
{- ^ __Returns:__ a 'GI.Gio.Interfaces.Drive.Drive' or 'Nothing' if /@mount@/ is not
associated with a volume or a drive.
The returned object should be unreffed with
'GI.GObject.Objects.Object.objectUnref' when no longer needed. -}
mountGetDrive mount = liftIO $ do
mount' <- unsafeManagedPtrCastPtr mount
result <- g_mount_get_drive mount'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (wrapObject Gio.Drive.Drive) result'
return result''
touchManagedPtr mount
return maybeResult
#if ENABLE_OVERLOADING
data MountGetDriveMethodInfo
instance (signature ~ (m (Maybe Gio.Drive.Drive)), MonadIO m, IsMount a) => O.MethodInfo MountGetDriveMethodInfo a signature where
overloadedMethod _ = mountGetDrive
#endif
-- method Mount::get_icon
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mount", argType = TInterface (Name {namespace = "Gio", name = "Mount"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GMount.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "Icon"}))
-- throws : False
-- Skip return : False
foreign import ccall "g_mount_get_icon" g_mount_get_icon ::
Ptr Mount -> -- mount : TInterface (Name {namespace = "Gio", name = "Mount"})
IO (Ptr Gio.Icon.Icon)
{- |
Gets the icon for /@mount@/.
-}
mountGetIcon ::
(B.CallStack.HasCallStack, MonadIO m, IsMount a) =>
a
{- ^ /@mount@/: a 'GI.Gio.Interfaces.Mount.Mount'. -}
-> m Gio.Icon.Icon
{- ^ __Returns:__ a 'GI.Gio.Interfaces.Icon.Icon'.
The returned object should be unreffed with
'GI.GObject.Objects.Object.objectUnref' when no longer needed. -}
mountGetIcon mount = liftIO $ do
mount' <- unsafeManagedPtrCastPtr mount
result <- g_mount_get_icon mount'
checkUnexpectedReturnNULL "mountGetIcon" result
result' <- (wrapObject Gio.Icon.Icon) result
touchManagedPtr mount
return result'
#if ENABLE_OVERLOADING
data MountGetIconMethodInfo
instance (signature ~ (m Gio.Icon.Icon), MonadIO m, IsMount a) => O.MethodInfo MountGetIconMethodInfo a signature where
overloadedMethod _ = mountGetIcon
#endif
-- method Mount::get_name
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mount", argType = TInterface (Name {namespace = "Gio", name = "Mount"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GMount.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False
foreign import ccall "g_mount_get_name" g_mount_get_name ::
Ptr Mount -> -- mount : TInterface (Name {namespace = "Gio", name = "Mount"})
IO CString
{- |
Gets the name of /@mount@/.
-}
mountGetName ::
(B.CallStack.HasCallStack, MonadIO m, IsMount a) =>
a
{- ^ /@mount@/: a 'GI.Gio.Interfaces.Mount.Mount'. -}
-> m T.Text
{- ^ __Returns:__ the name for the given /@mount@/.
The returned string should be freed with 'GI.GLib.Functions.free'
when no longer needed. -}
mountGetName mount = liftIO $ do
mount' <- unsafeManagedPtrCastPtr mount
result <- g_mount_get_name mount'
checkUnexpectedReturnNULL "mountGetName" result
result' <- cstringToText result
freeMem result
touchManagedPtr mount
return result'
#if ENABLE_OVERLOADING
data MountGetNameMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsMount a) => O.MethodInfo MountGetNameMethodInfo a signature where
overloadedMethod _ = mountGetName
#endif
-- method Mount::get_root
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mount", argType = TInterface (Name {namespace = "Gio", name = "Mount"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GMount.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "File"}))
-- throws : False
-- Skip return : False
foreign import ccall "g_mount_get_root" g_mount_get_root ::
Ptr Mount -> -- mount : TInterface (Name {namespace = "Gio", name = "Mount"})
IO (Ptr Gio.File.File)
{- |
Gets the root directory on /@mount@/.
-}
mountGetRoot ::
(B.CallStack.HasCallStack, MonadIO m, IsMount a) =>
a
{- ^ /@mount@/: a 'GI.Gio.Interfaces.Mount.Mount'. -}
-> m Gio.File.File
{- ^ __Returns:__ a 'GI.Gio.Interfaces.File.File'.
The returned object should be unreffed with
'GI.GObject.Objects.Object.objectUnref' when no longer needed. -}
mountGetRoot mount = liftIO $ do
mount' <- unsafeManagedPtrCastPtr mount
result <- g_mount_get_root mount'
checkUnexpectedReturnNULL "mountGetRoot" result
result' <- (wrapObject Gio.File.File) result
touchManagedPtr mount
return result'
#if ENABLE_OVERLOADING
data MountGetRootMethodInfo
instance (signature ~ (m Gio.File.File), MonadIO m, IsMount a) => O.MethodInfo MountGetRootMethodInfo a signature where
overloadedMethod _ = mountGetRoot
#endif
-- method Mount::get_sort_key
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mount", argType = TInterface (Name {namespace = "Gio", name = "Mount"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GMount.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False
foreign import ccall "g_mount_get_sort_key" g_mount_get_sort_key ::
Ptr Mount -> -- mount : TInterface (Name {namespace = "Gio", name = "Mount"})
IO CString
{- |
Gets the sort key for /@mount@/, if any.
/Since: 2.32/
-}
mountGetSortKey ::
(B.CallStack.HasCallStack, MonadIO m, IsMount a) =>
a
{- ^ /@mount@/: A 'GI.Gio.Interfaces.Mount.Mount'. -}
-> m (Maybe T.Text)
{- ^ __Returns:__ Sorting key for /@mount@/ or 'Nothing' if no such key is available. -}
mountGetSortKey mount = liftIO $ do
mount' <- unsafeManagedPtrCastPtr mount
result <- g_mount_get_sort_key mount'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- cstringToText result'
return result''
touchManagedPtr mount
return maybeResult
#if ENABLE_OVERLOADING
data MountGetSortKeyMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m, IsMount a) => O.MethodInfo MountGetSortKeyMethodInfo a signature where
overloadedMethod _ = mountGetSortKey
#endif
-- method Mount::get_symbolic_icon
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mount", argType = TInterface (Name {namespace = "Gio", name = "Mount"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GMount.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "Icon"}))
-- throws : False
-- Skip return : False
foreign import ccall "g_mount_get_symbolic_icon" g_mount_get_symbolic_icon ::
Ptr Mount -> -- mount : TInterface (Name {namespace = "Gio", name = "Mount"})
IO (Ptr Gio.Icon.Icon)
{- |
Gets the symbolic icon for /@mount@/.
/Since: 2.34/
-}
mountGetSymbolicIcon ::
(B.CallStack.HasCallStack, MonadIO m, IsMount a) =>
a
{- ^ /@mount@/: a 'GI.Gio.Interfaces.Mount.Mount'. -}
-> m Gio.Icon.Icon
{- ^ __Returns:__ a 'GI.Gio.Interfaces.Icon.Icon'.
The returned object should be unreffed with
'GI.GObject.Objects.Object.objectUnref' when no longer needed. -}
mountGetSymbolicIcon mount = liftIO $ do
mount' <- unsafeManagedPtrCastPtr mount
result <- g_mount_get_symbolic_icon mount'
checkUnexpectedReturnNULL "mountGetSymbolicIcon" result
result' <- (wrapObject Gio.Icon.Icon) result
touchManagedPtr mount
return result'
#if ENABLE_OVERLOADING
data MountGetSymbolicIconMethodInfo
instance (signature ~ (m Gio.Icon.Icon), MonadIO m, IsMount a) => O.MethodInfo MountGetSymbolicIconMethodInfo a signature where
overloadedMethod _ = mountGetSymbolicIcon
#endif
-- method Mount::get_uuid
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mount", argType = TInterface (Name {namespace = "Gio", name = "Mount"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GMount.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False
foreign import ccall "g_mount_get_uuid" g_mount_get_uuid ::
Ptr Mount -> -- mount : TInterface (Name {namespace = "Gio", name = "Mount"})
IO CString
{- |
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.
-}
mountGetUuid ::
(B.CallStack.HasCallStack, MonadIO m, IsMount a) =>
a
{- ^ /@mount@/: a 'GI.Gio.Interfaces.Mount.Mount'. -}
-> m (Maybe T.Text)
{- ^ __Returns:__ the UUID for /@mount@/ or 'Nothing' if no UUID
can be computed.
The returned string should be freed with 'GI.GLib.Functions.free'
when no longer needed. -}
mountGetUuid mount = liftIO $ do
mount' <- unsafeManagedPtrCastPtr mount
result <- g_mount_get_uuid mount'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- cstringToText result'
freeMem result'
return result''
touchManagedPtr mount
return maybeResult
#if ENABLE_OVERLOADING
data MountGetUuidMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m, IsMount a) => O.MethodInfo MountGetUuidMethodInfo a signature where
overloadedMethod _ = mountGetUuid
#endif
-- method Mount::get_volume
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mount", argType = TInterface (Name {namespace = "Gio", name = "Mount"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GMount.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "Volume"}))
-- throws : False
-- Skip return : False
foreign import ccall "g_mount_get_volume" g_mount_get_volume ::
Ptr Mount -> -- mount : TInterface (Name {namespace = "Gio", name = "Mount"})
IO (Ptr Gio.Volume.Volume)
{- |
Gets the volume for the /@mount@/.
-}
mountGetVolume ::
(B.CallStack.HasCallStack, MonadIO m, IsMount a) =>
a
{- ^ /@mount@/: a 'GI.Gio.Interfaces.Mount.Mount'. -}
-> m (Maybe Gio.Volume.Volume)
{- ^ __Returns:__ a 'GI.Gio.Interfaces.Volume.Volume' or 'Nothing' if /@mount@/ is not
associated with a volume.
The returned object should be unreffed with
'GI.GObject.Objects.Object.objectUnref' when no longer needed. -}
mountGetVolume mount = liftIO $ do
mount' <- unsafeManagedPtrCastPtr mount
result <- g_mount_get_volume mount'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (wrapObject Gio.Volume.Volume) result'
return result''
touchManagedPtr mount
return maybeResult
#if ENABLE_OVERLOADING
data MountGetVolumeMethodInfo
instance (signature ~ (m (Maybe Gio.Volume.Volume)), MonadIO m, IsMount a) => O.MethodInfo MountGetVolumeMethodInfo a signature where
overloadedMethod _ = mountGetVolume
#endif
-- method Mount::guess_content_type
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mount", argType = TInterface (Name {namespace = "Gio", name = "Mount"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GMount", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "force_rescan", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Whether to force a rescan of the content.\n Otherwise a cached result will be used if available", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "optional #GCancellable object, %NULL to ignore", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "callback", argType = TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GAsyncReadyCallback", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = 4, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data passed to @callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False
foreign import ccall "g_mount_guess_content_type" g_mount_guess_content_type ::
Ptr Mount -> -- mount : TInterface (Name {namespace = "Gio", name = "Mount"})
CInt -> -- force_rescan : TBasicType TBoolean
Ptr Gio.Cancellable.Cancellable -> -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
Ptr () -> -- user_data : TBasicType TPtr
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-content\/image-dcf for camera
memory cards. See the
<http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec shared-mime-info>
specification for more on x-content types.
This is an asynchronous operation (see
'GI.Gio.Interfaces.Mount.mountGuessContentTypeSync' for the synchronous version), and
is finished by calling 'GI.Gio.Interfaces.Mount.mountGuessContentTypeFinish' with the
/@mount@/ and 'GI.Gio.Interfaces.AsyncResult.AsyncResult' data returned in the /@callback@/.
/Since: 2.18/
-}
mountGuessContentType ::
(B.CallStack.HasCallStack, MonadIO m, IsMount a, Gio.Cancellable.IsCancellable b) =>
a
{- ^ /@mount@/: a 'GI.Gio.Interfaces.Mount.Mount' -}
-> Bool
{- ^ /@forceRescan@/: Whether to force a rescan of the content.
Otherwise a cached result will be used if available -}
-> Maybe (b)
{- ^ /@cancellable@/: optional 'GI.Gio.Objects.Cancellable.Cancellable' object, 'Nothing' to ignore -}
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
{- ^ /@callback@/: a 'GI.Gio.Callbacks.AsyncReadyCallback' -}
-> m ()
mountGuessContentType mount forceRescan cancellable callback = liftIO $ do
mount' <- unsafeManagedPtrCastPtr mount
let forceRescan' = (fromIntegral . fromEnum) forceRescan
maybeCancellable <- case cancellable of
Nothing -> return nullPtr
Just jCancellable -> do
jCancellable' <- unsafeManagedPtrCastPtr jCancellable
return jCancellable'
maybeCallback <- case callback of
Nothing -> return (castPtrToFunPtr nullPtr)
Just jCallback -> do
ptrcallback <- callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback))
poke ptrcallback jCallback'
return jCallback'
let userData = nullPtr
g_mount_guess_content_type mount' forceRescan' maybeCancellable maybeCallback userData
touchManagedPtr mount
whenJust cancellable touchManagedPtr
return ()
#if ENABLE_OVERLOADING
data MountGuessContentTypeMethodInfo
instance (signature ~ (Bool -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsMount a, Gio.Cancellable.IsCancellable b) => O.MethodInfo MountGuessContentTypeMethodInfo a signature where
overloadedMethod _ = mountGuessContentType
#endif
-- method Mount::guess_content_type_finish
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mount", argType = TInterface (Name {namespace = "Gio", name = "Mount"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GMount", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "result", argType = TInterface (Name {namespace = "Gio", name = "AsyncResult"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GAsyncResult", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TCArray True (-1) (-1) (TBasicType TUTF8))
-- throws : True
-- Skip return : False
foreign import ccall "g_mount_guess_content_type_finish" g_mount_guess_content_type_finish ::
Ptr Mount -> -- mount : TInterface (Name {namespace = "Gio", name = "Mount"})
Ptr Gio.AsyncResult.AsyncResult -> -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
Ptr (Ptr GError) -> -- error
IO (Ptr CString)
{- |
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
'GI.Gio.Enums.IOErrorEnumNotSupported' if the mount does not support content
guessing.
/Since: 2.18/
-}
mountGuessContentTypeFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsMount a, Gio.AsyncResult.IsAsyncResult b) =>
a
{- ^ /@mount@/: a 'GI.Gio.Interfaces.Mount.Mount' -}
-> b
{- ^ /@result@/: a 'GI.Gio.Interfaces.AsyncResult.AsyncResult' -}
-> m [T.Text]
{- ^ __Returns:__ a 'Nothing'-terminated array of content types or 'Nothing' on error.
Caller should free this array with 'GI.GLib.Functions.strfreev' when done with it. /(Can throw 'Data.GI.Base.GError.GError')/ -}
mountGuessContentTypeFinish mount result_ = liftIO $ do
mount' <- unsafeManagedPtrCastPtr mount
result_' <- unsafeManagedPtrCastPtr result_
onException (do
result <- propagateGError $ g_mount_guess_content_type_finish mount' result_'
checkUnexpectedReturnNULL "mountGuessContentTypeFinish" result
result' <- unpackZeroTerminatedUTF8CArray result
mapZeroTerminatedCArray freeMem result
freeMem result
touchManagedPtr mount
touchManagedPtr result_
return result'
) (do
return ()
)
#if ENABLE_OVERLOADING
data MountGuessContentTypeFinishMethodInfo
instance (signature ~ (b -> m [T.Text]), MonadIO m, IsMount a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo MountGuessContentTypeFinishMethodInfo a signature where
overloadedMethod _ = mountGuessContentTypeFinish
#endif
-- method Mount::guess_content_type_sync
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mount", argType = TInterface (Name {namespace = "Gio", name = "Mount"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GMount", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "force_rescan", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Whether to force a rescan of the content.\n Otherwise a cached result will be used if available", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "optional #GCancellable object, %NULL to ignore", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TCArray True (-1) (-1) (TBasicType TUTF8))
-- throws : True
-- Skip return : False
foreign import ccall "g_mount_guess_content_type_sync" g_mount_guess_content_type_sync ::
Ptr Mount -> -- mount : TInterface (Name {namespace = "Gio", name = "Mount"})
CInt -> -- force_rescan : TBasicType TBoolean
Ptr Gio.Cancellable.Cancellable -> -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
Ptr (Ptr GError) -> -- error
IO (Ptr CString)
{- |
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
<http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec shared-mime-info>
specification for more on x-content types.
This is an synchronous operation and as such may block doing IO;
see 'GI.Gio.Interfaces.Mount.mountGuessContentType' for the asynchronous version.
/Since: 2.18/
-}
mountGuessContentTypeSync ::
(B.CallStack.HasCallStack, MonadIO m, IsMount a, Gio.Cancellable.IsCancellable b) =>
a
{- ^ /@mount@/: a 'GI.Gio.Interfaces.Mount.Mount' -}
-> Bool
{- ^ /@forceRescan@/: Whether to force a rescan of the content.
Otherwise a cached result will be used if available -}
-> Maybe (b)
{- ^ /@cancellable@/: optional 'GI.Gio.Objects.Cancellable.Cancellable' object, 'Nothing' to ignore -}
-> m [T.Text]
{- ^ __Returns:__ a 'Nothing'-terminated array of content types or 'Nothing' on error.
Caller should free this array with 'GI.GLib.Functions.strfreev' when done with it. /(Can throw 'Data.GI.Base.GError.GError')/ -}
mountGuessContentTypeSync mount forceRescan cancellable = liftIO $ do
mount' <- unsafeManagedPtrCastPtr mount
let forceRescan' = (fromIntegral . fromEnum) forceRescan
maybeCancellable <- case cancellable of
Nothing -> return nullPtr
Just jCancellable -> do
jCancellable' <- unsafeManagedPtrCastPtr jCancellable
return jCancellable'
onException (do
result <- propagateGError $ g_mount_guess_content_type_sync mount' forceRescan' maybeCancellable
checkUnexpectedReturnNULL "mountGuessContentTypeSync" result
result' <- unpackZeroTerminatedUTF8CArray result
mapZeroTerminatedCArray freeMem result
freeMem result
touchManagedPtr mount
whenJust cancellable touchManagedPtr
return result'
) (do
return ()
)
#if ENABLE_OVERLOADING
data MountGuessContentTypeSyncMethodInfo
instance (signature ~ (Bool -> Maybe (b) -> m [T.Text]), MonadIO m, IsMount a, Gio.Cancellable.IsCancellable b) => O.MethodInfo MountGuessContentTypeSyncMethodInfo a signature where
overloadedMethod _ = mountGuessContentTypeSync
#endif
-- method Mount::is_shadowed
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mount", argType = TInterface (Name {namespace = "Gio", name = "Mount"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GMount.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False
foreign import ccall "g_mount_is_shadowed" g_mount_is_shadowed ::
Ptr Mount -> -- mount : TInterface (Name {namespace = "Gio", name = "Mount"})
IO CInt
{- |
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 'GI.Gio.Interfaces.Mount.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 'GI.Gio.Objects.VolumeMonitor.VolumeMonitor' implementation would create two
'GI.Gio.Interfaces.Volume.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
'GI.Gio.Objects.VolumeMonitor.VolumeMonitor' implementation would create two 'GI.Gio.Interfaces.Mount.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 'GI.Gio.Interfaces.Volume.Volume' is set.
/Since: 2.20/
-}
mountIsShadowed ::
(B.CallStack.HasCallStack, MonadIO m, IsMount a) =>
a
{- ^ /@mount@/: A 'GI.Gio.Interfaces.Mount.Mount'. -}
-> m Bool
{- ^ __Returns:__ 'True' if /@mount@/ is shadowed. -}
mountIsShadowed mount = liftIO $ do
mount' <- unsafeManagedPtrCastPtr mount
result <- g_mount_is_shadowed mount'
let result' = (/= 0) result
touchManagedPtr mount
return result'
#if ENABLE_OVERLOADING
data MountIsShadowedMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsMount a) => O.MethodInfo MountIsShadowedMethodInfo a signature where
overloadedMethod _ = mountIsShadowed
#endif
-- method Mount::remount
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mount", argType = TInterface (Name {namespace = "Gio", name = "Mount"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GMount.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gio", name = "MountMountFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "flags affecting the operation", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "mount_operation", argType = TInterface (Name {namespace = "Gio", name = "MountOperation"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GMountOperation or %NULL to avoid\n user interaction.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "optional #GCancellable object, %NULL to ignore.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "callback", argType = TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GAsyncReadyCallback, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = 5, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data passed to @callback.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False
foreign import ccall "g_mount_remount" g_mount_remount ::
Ptr Mount -> -- mount : TInterface (Name {namespace = "Gio", name = "Mount"})
CUInt -> -- flags : TInterface (Name {namespace = "Gio", name = "MountMountFlags"})
Ptr Gio.MountOperation.MountOperation -> -- mount_operation : TInterface (Name {namespace = "Gio", name = "MountOperation"})
Ptr Gio.Cancellable.Cancellable -> -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
Ptr () -> -- user_data : TBasicType TPtr
IO ()
{- |
Remounts a mount. This is an asynchronous operation, and is
finished by calling 'GI.Gio.Interfaces.Mount.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.
-}
mountRemount ::
(B.CallStack.HasCallStack, MonadIO m, IsMount a, Gio.MountOperation.IsMountOperation b, Gio.Cancellable.IsCancellable c) =>
a
{- ^ /@mount@/: a 'GI.Gio.Interfaces.Mount.Mount'. -}
-> [Gio.Flags.MountMountFlags]
{- ^ /@flags@/: flags affecting the operation -}
-> Maybe (b)
{- ^ /@mountOperation@/: a 'GI.Gio.Objects.MountOperation.MountOperation' or 'Nothing' to avoid
user interaction. -}
-> Maybe (c)
{- ^ /@cancellable@/: optional 'GI.Gio.Objects.Cancellable.Cancellable' object, 'Nothing' to ignore. -}
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
{- ^ /@callback@/: a 'GI.Gio.Callbacks.AsyncReadyCallback', or 'Nothing'. -}
-> m ()
mountRemount mount flags mountOperation cancellable callback = liftIO $ do
mount' <- unsafeManagedPtrCastPtr mount
let flags' = gflagsToWord flags
maybeMountOperation <- case mountOperation of
Nothing -> return nullPtr
Just jMountOperation -> do
jMountOperation' <- unsafeManagedPtrCastPtr jMountOperation
return jMountOperation'
maybeCancellable <- case cancellable of
Nothing -> return nullPtr
Just jCancellable -> do
jCancellable' <- unsafeManagedPtrCastPtr jCancellable
return jCancellable'
maybeCallback <- case callback of
Nothing -> return (castPtrToFunPtr nullPtr)
Just jCallback -> do
ptrcallback <- callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback))
poke ptrcallback jCallback'
return jCallback'
let userData = nullPtr
g_mount_remount mount' flags' maybeMountOperation maybeCancellable maybeCallback userData
touchManagedPtr mount
whenJust mountOperation touchManagedPtr
whenJust cancellable touchManagedPtr
return ()
#if ENABLE_OVERLOADING
data MountRemountMethodInfo
instance (signature ~ ([Gio.Flags.MountMountFlags] -> Maybe (b) -> Maybe (c) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsMount a, Gio.MountOperation.IsMountOperation b, Gio.Cancellable.IsCancellable c) => O.MethodInfo MountRemountMethodInfo a signature where
overloadedMethod _ = mountRemount
#endif
-- method Mount::remount_finish
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mount", argType = TInterface (Name {namespace = "Gio", name = "Mount"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GMount.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "result", argType = TInterface (Name {namespace = "Gio", name = "AsyncResult"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GAsyncResult.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False
foreign import ccall "g_mount_remount_finish" g_mount_remount_finish ::
Ptr Mount -> -- mount : TInterface (Name {namespace = "Gio", name = "Mount"})
Ptr Gio.AsyncResult.AsyncResult -> -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
Ptr (Ptr GError) -> -- error
IO CInt
{- |
Finishes remounting a mount. If any errors occurred during the operation,
/@error@/ will be set to contain the errors and 'False' will be returned.
-}
mountRemountFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsMount a, Gio.AsyncResult.IsAsyncResult b) =>
a
{- ^ /@mount@/: a 'GI.Gio.Interfaces.Mount.Mount'. -}
-> b
{- ^ /@result@/: a 'GI.Gio.Interfaces.AsyncResult.AsyncResult'. -}
-> m ()
{- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
mountRemountFinish mount result_ = liftIO $ do
mount' <- unsafeManagedPtrCastPtr mount
result_' <- unsafeManagedPtrCastPtr result_
onException (do
_ <- propagateGError $ g_mount_remount_finish mount' result_'
touchManagedPtr mount
touchManagedPtr result_
return ()
) (do
return ()
)
#if ENABLE_OVERLOADING
data MountRemountFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsMount a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo MountRemountFinishMethodInfo a signature where
overloadedMethod _ = mountRemountFinish
#endif
-- method Mount::shadow
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mount", argType = TInterface (Name {namespace = "Gio", name = "Mount"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GMount.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False
foreign import ccall "g_mount_shadow" g_mount_shadow ::
Ptr Mount -> -- mount : TInterface (Name {namespace = "Gio", name = "Mount"})
IO ()
{- |
Increments the shadow count on /@mount@/. Usually used by
'GI.Gio.Objects.VolumeMonitor.VolumeMonitor' implementations when creating a shadow mount for
/@mount@/, see 'GI.Gio.Interfaces.Mount.mountIsShadowed' for more information. The caller
will need to emit the 'GI.Gio.Interfaces.Mount.Mount'::@/changed/@ signal on /@mount@/ manually.
/Since: 2.20/
-}
mountShadow ::
(B.CallStack.HasCallStack, MonadIO m, IsMount a) =>
a
{- ^ /@mount@/: A 'GI.Gio.Interfaces.Mount.Mount'. -}
-> m ()
mountShadow mount = liftIO $ do
mount' <- unsafeManagedPtrCastPtr mount
g_mount_shadow mount'
touchManagedPtr mount
return ()
#if ENABLE_OVERLOADING
data MountShadowMethodInfo
instance (signature ~ (m ()), MonadIO m, IsMount a) => O.MethodInfo MountShadowMethodInfo a signature where
overloadedMethod _ = mountShadow
#endif
-- method Mount::unmount
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mount", argType = TInterface (Name {namespace = "Gio", name = "Mount"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GMount.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gio", name = "MountUnmountFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "flags affecting the operation", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "optional #GCancellable object, %NULL to ignore.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "callback", argType = TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GAsyncReadyCallback, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = 4, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data passed to @callback.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False
foreign import ccall "g_mount_unmount" g_mount_unmount ::
Ptr Mount -> -- mount : TInterface (Name {namespace = "Gio", name = "Mount"})
CUInt -> -- flags : TInterface (Name {namespace = "Gio", name = "MountUnmountFlags"})
Ptr Gio.Cancellable.Cancellable -> -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
Ptr () -> -- user_data : TBasicType TPtr
IO ()
{-# DEPRECATED mountUnmount ["(Since version 2.22)","Use 'GI.Gio.Interfaces.Mount.mountUnmountWithOperation' instead."] #-}
{- |
Unmounts a mount. This is an asynchronous operation, and is
finished by calling 'GI.Gio.Interfaces.Mount.mountUnmountFinish' with the /@mount@/
and 'GI.Gio.Interfaces.AsyncResult.AsyncResult' data returned in the /@callback@/.
-}
mountUnmount ::
(B.CallStack.HasCallStack, MonadIO m, IsMount a, Gio.Cancellable.IsCancellable b) =>
a
{- ^ /@mount@/: a 'GI.Gio.Interfaces.Mount.Mount'. -}
-> [Gio.Flags.MountUnmountFlags]
{- ^ /@flags@/: flags affecting the operation -}
-> Maybe (b)
{- ^ /@cancellable@/: optional 'GI.Gio.Objects.Cancellable.Cancellable' object, 'Nothing' to ignore. -}
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
{- ^ /@callback@/: a 'GI.Gio.Callbacks.AsyncReadyCallback', or 'Nothing'. -}
-> m ()
mountUnmount mount flags cancellable callback = liftIO $ do
mount' <- unsafeManagedPtrCastPtr mount
let flags' = gflagsToWord flags
maybeCancellable <- case cancellable of
Nothing -> return nullPtr
Just jCancellable -> do
jCancellable' <- unsafeManagedPtrCastPtr jCancellable
return jCancellable'
maybeCallback <- case callback of
Nothing -> return (castPtrToFunPtr nullPtr)
Just jCallback -> do
ptrcallback <- callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback))
poke ptrcallback jCallback'
return jCallback'
let userData = nullPtr
g_mount_unmount mount' flags' maybeCancellable maybeCallback userData
touchManagedPtr mount
whenJust cancellable touchManagedPtr
return ()
#if ENABLE_OVERLOADING
data MountUnmountMethodInfo
instance (signature ~ ([Gio.Flags.MountUnmountFlags] -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsMount a, Gio.Cancellable.IsCancellable b) => O.MethodInfo MountUnmountMethodInfo a signature where
overloadedMethod _ = mountUnmount
#endif
-- method Mount::unmount_finish
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mount", argType = TInterface (Name {namespace = "Gio", name = "Mount"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GMount.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "result", argType = TInterface (Name {namespace = "Gio", name = "AsyncResult"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GAsyncResult.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False
foreign import ccall "g_mount_unmount_finish" g_mount_unmount_finish ::
Ptr Mount -> -- mount : TInterface (Name {namespace = "Gio", name = "Mount"})
Ptr Gio.AsyncResult.AsyncResult -> -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
Ptr (Ptr GError) -> -- error
IO CInt
{-# DEPRECATED mountUnmountFinish ["(Since version 2.22)","Use 'GI.Gio.Interfaces.Mount.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.
-}
mountUnmountFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsMount a, Gio.AsyncResult.IsAsyncResult b) =>
a
{- ^ /@mount@/: a 'GI.Gio.Interfaces.Mount.Mount'. -}
-> b
{- ^ /@result@/: a 'GI.Gio.Interfaces.AsyncResult.AsyncResult'. -}
-> m ()
{- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
mountUnmountFinish mount result_ = liftIO $ do
mount' <- unsafeManagedPtrCastPtr mount
result_' <- unsafeManagedPtrCastPtr result_
onException (do
_ <- propagateGError $ g_mount_unmount_finish mount' result_'
touchManagedPtr mount
touchManagedPtr result_
return ()
) (do
return ()
)
#if ENABLE_OVERLOADING
data MountUnmountFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsMount a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo MountUnmountFinishMethodInfo a signature where
overloadedMethod _ = mountUnmountFinish
#endif
-- method Mount::unmount_with_operation
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mount", argType = TInterface (Name {namespace = "Gio", name = "Mount"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GMount.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gio", name = "MountUnmountFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "flags affecting the operation", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "mount_operation", argType = TInterface (Name {namespace = "Gio", name = "MountOperation"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GMountOperation or %NULL to avoid\n user interaction.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "optional #GCancellable object, %NULL to ignore.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "callback", argType = TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GAsyncReadyCallback, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = 5, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data passed to @callback.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False
foreign import ccall "g_mount_unmount_with_operation" g_mount_unmount_with_operation ::
Ptr Mount -> -- mount : TInterface (Name {namespace = "Gio", name = "Mount"})
CUInt -> -- flags : TInterface (Name {namespace = "Gio", name = "MountUnmountFlags"})
Ptr Gio.MountOperation.MountOperation -> -- mount_operation : TInterface (Name {namespace = "Gio", name = "MountOperation"})
Ptr Gio.Cancellable.Cancellable -> -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
Ptr () -> -- user_data : TBasicType TPtr
IO ()
{- |
Unmounts a mount. This is an asynchronous operation, and is
finished by calling 'GI.Gio.Interfaces.Mount.mountUnmountWithOperationFinish' with the /@mount@/
and 'GI.Gio.Interfaces.AsyncResult.AsyncResult' data returned in the /@callback@/.
/Since: 2.22/
-}
mountUnmountWithOperation ::
(B.CallStack.HasCallStack, MonadIO m, IsMount a, Gio.MountOperation.IsMountOperation b, Gio.Cancellable.IsCancellable c) =>
a
{- ^ /@mount@/: a 'GI.Gio.Interfaces.Mount.Mount'. -}
-> [Gio.Flags.MountUnmountFlags]
{- ^ /@flags@/: flags affecting the operation -}
-> Maybe (b)
{- ^ /@mountOperation@/: a 'GI.Gio.Objects.MountOperation.MountOperation' or 'Nothing' to avoid
user interaction. -}
-> Maybe (c)
{- ^ /@cancellable@/: optional 'GI.Gio.Objects.Cancellable.Cancellable' object, 'Nothing' to ignore. -}
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
{- ^ /@callback@/: a 'GI.Gio.Callbacks.AsyncReadyCallback', or 'Nothing'. -}
-> m ()
mountUnmountWithOperation mount flags mountOperation cancellable callback = liftIO $ do
mount' <- unsafeManagedPtrCastPtr mount
let flags' = gflagsToWord flags
maybeMountOperation <- case mountOperation of
Nothing -> return nullPtr
Just jMountOperation -> do
jMountOperation' <- unsafeManagedPtrCastPtr jMountOperation
return jMountOperation'
maybeCancellable <- case cancellable of
Nothing -> return nullPtr
Just jCancellable -> do
jCancellable' <- unsafeManagedPtrCastPtr jCancellable
return jCancellable'
maybeCallback <- case callback of
Nothing -> return (castPtrToFunPtr nullPtr)
Just jCallback -> do
ptrcallback <- callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback))
poke ptrcallback jCallback'
return jCallback'
let userData = nullPtr
g_mount_unmount_with_operation mount' flags' maybeMountOperation maybeCancellable maybeCallback userData
touchManagedPtr mount
whenJust mountOperation touchManagedPtr
whenJust cancellable touchManagedPtr
return ()
#if ENABLE_OVERLOADING
data MountUnmountWithOperationMethodInfo
instance (signature ~ ([Gio.Flags.MountUnmountFlags] -> Maybe (b) -> Maybe (c) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsMount a, Gio.MountOperation.IsMountOperation b, Gio.Cancellable.IsCancellable c) => O.MethodInfo MountUnmountWithOperationMethodInfo a signature where
overloadedMethod _ = mountUnmountWithOperation
#endif
-- method Mount::unmount_with_operation_finish
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mount", argType = TInterface (Name {namespace = "Gio", name = "Mount"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GMount.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "result", argType = TInterface (Name {namespace = "Gio", name = "AsyncResult"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GAsyncResult.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False
foreign import ccall "g_mount_unmount_with_operation_finish" g_mount_unmount_with_operation_finish ::
Ptr Mount -> -- mount : TInterface (Name {namespace = "Gio", name = "Mount"})
Ptr Gio.AsyncResult.AsyncResult -> -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
Ptr (Ptr GError) -> -- error
IO CInt
{- |
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/
-}
mountUnmountWithOperationFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsMount a, Gio.AsyncResult.IsAsyncResult b) =>
a
{- ^ /@mount@/: a 'GI.Gio.Interfaces.Mount.Mount'. -}
-> b
{- ^ /@result@/: a 'GI.Gio.Interfaces.AsyncResult.AsyncResult'. -}
-> m ()
{- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
mountUnmountWithOperationFinish mount result_ = liftIO $ do
mount' <- unsafeManagedPtrCastPtr mount
result_' <- unsafeManagedPtrCastPtr result_
onException (do
_ <- propagateGError $ g_mount_unmount_with_operation_finish mount' result_'
touchManagedPtr mount
touchManagedPtr result_
return ()
) (do
return ()
)
#if ENABLE_OVERLOADING
data MountUnmountWithOperationFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsMount a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo MountUnmountWithOperationFinishMethodInfo a signature where
overloadedMethod _ = mountUnmountWithOperationFinish
#endif
-- method Mount::unshadow
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "mount", argType = TInterface (Name {namespace = "Gio", name = "Mount"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GMount.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False
foreign import ccall "g_mount_unshadow" g_mount_unshadow ::
Ptr Mount -> -- mount : TInterface (Name {namespace = "Gio", name = "Mount"})
IO ()
{- |
Decrements the shadow count on /@mount@/. Usually used by
'GI.Gio.Objects.VolumeMonitor.VolumeMonitor' implementations when destroying a shadow mount for
/@mount@/, see 'GI.Gio.Interfaces.Mount.mountIsShadowed' for more information. The caller
will need to emit the 'GI.Gio.Interfaces.Mount.Mount'::@/changed/@ signal on /@mount@/ manually.
/Since: 2.20/
-}
mountUnshadow ::
(B.CallStack.HasCallStack, MonadIO m, IsMount a) =>
a
{- ^ /@mount@/: A 'GI.Gio.Interfaces.Mount.Mount'. -}
-> m ()
mountUnshadow mount = liftIO $ do
mount' <- unsafeManagedPtrCastPtr mount
g_mount_unshadow mount'
touchManagedPtr mount
return ()
#if ENABLE_OVERLOADING
data MountUnshadowMethodInfo
instance (signature ~ (m ()), MonadIO m, IsMount a) => O.MethodInfo MountUnshadowMethodInfo a signature where
overloadedMethod _ = mountUnshadow
#endif