{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gio.Objects.FileEnumerator
(
FileEnumerator(..) ,
IsFileEnumerator ,
toFileEnumerator ,
noFileEnumerator ,
#if defined(ENABLE_OVERLOADING)
ResolveFileEnumeratorMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
FileEnumeratorCloseMethodInfo ,
#endif
fileEnumeratorClose ,
#if defined(ENABLE_OVERLOADING)
FileEnumeratorCloseAsyncMethodInfo ,
#endif
fileEnumeratorCloseAsync ,
#if defined(ENABLE_OVERLOADING)
FileEnumeratorCloseFinishMethodInfo ,
#endif
fileEnumeratorCloseFinish ,
#if defined(ENABLE_OVERLOADING)
FileEnumeratorGetChildMethodInfo ,
#endif
fileEnumeratorGetChild ,
#if defined(ENABLE_OVERLOADING)
FileEnumeratorGetContainerMethodInfo ,
#endif
fileEnumeratorGetContainer ,
#if defined(ENABLE_OVERLOADING)
FileEnumeratorHasPendingMethodInfo ,
#endif
fileEnumeratorHasPending ,
#if defined(ENABLE_OVERLOADING)
FileEnumeratorIsClosedMethodInfo ,
#endif
fileEnumeratorIsClosed ,
#if defined(ENABLE_OVERLOADING)
FileEnumeratorIterateMethodInfo ,
#endif
fileEnumeratorIterate ,
#if defined(ENABLE_OVERLOADING)
FileEnumeratorNextFileMethodInfo ,
#endif
fileEnumeratorNextFile ,
#if defined(ENABLE_OVERLOADING)
FileEnumeratorNextFilesAsyncMethodInfo ,
#endif
fileEnumeratorNextFilesAsync ,
#if defined(ENABLE_OVERLOADING)
FileEnumeratorNextFilesFinishMethodInfo ,
#endif
fileEnumeratorNextFilesFinish ,
#if defined(ENABLE_OVERLOADING)
FileEnumeratorSetPendingMethodInfo ,
#endif
fileEnumeratorSetPending ,
#if defined(ENABLE_OVERLOADING)
FileEnumeratorContainerPropertyInfo ,
#endif
constructFileEnumeratorContainer ,
#if defined(ENABLE_OVERLOADING)
fileEnumeratorContainer ,
#endif
) 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.GI.Base.Signals as B.Signals
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.Interfaces.AsyncResult as Gio.AsyncResult
import {-# SOURCE #-} qualified GI.Gio.Interfaces.File as Gio.File
import {-# SOURCE #-} qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import {-# SOURCE #-} qualified GI.Gio.Objects.FileInfo as Gio.FileInfo
newtype FileEnumerator = FileEnumerator (ManagedPtr FileEnumerator)
deriving (FileEnumerator -> FileEnumerator -> Bool
(FileEnumerator -> FileEnumerator -> Bool)
-> (FileEnumerator -> FileEnumerator -> Bool) -> Eq FileEnumerator
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FileEnumerator -> FileEnumerator -> Bool
$c/= :: FileEnumerator -> FileEnumerator -> Bool
== :: FileEnumerator -> FileEnumerator -> Bool
$c== :: FileEnumerator -> FileEnumerator -> Bool
Eq)
foreign import ccall "g_file_enumerator_get_type"
c_g_file_enumerator_get_type :: IO GType
instance GObject FileEnumerator where
gobjectType :: IO GType
gobjectType = IO GType
c_g_file_enumerator_get_type
instance B.GValue.IsGValue FileEnumerator where
toGValue :: FileEnumerator -> IO GValue
toGValue o :: FileEnumerator
o = do
GType
gtype <- IO GType
c_g_file_enumerator_get_type
FileEnumerator -> (Ptr FileEnumerator -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr FileEnumerator
o (GType
-> (GValue -> Ptr FileEnumerator -> IO ())
-> Ptr FileEnumerator
-> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr FileEnumerator -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
fromGValue :: GValue -> IO FileEnumerator
fromGValue gv :: GValue
gv = do
Ptr FileEnumerator
ptr <- GValue -> IO (Ptr FileEnumerator)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr FileEnumerator)
(ManagedPtr FileEnumerator -> FileEnumerator)
-> Ptr FileEnumerator -> IO FileEnumerator
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr FileEnumerator -> FileEnumerator
FileEnumerator Ptr FileEnumerator
ptr
class (GObject o, O.IsDescendantOf FileEnumerator o) => IsFileEnumerator o
instance (GObject o, O.IsDescendantOf FileEnumerator o) => IsFileEnumerator o
instance O.HasParentTypes FileEnumerator
type instance O.ParentTypes FileEnumerator = '[GObject.Object.Object]
toFileEnumerator :: (MonadIO m, IsFileEnumerator o) => o -> m FileEnumerator
toFileEnumerator :: o -> m FileEnumerator
toFileEnumerator = IO FileEnumerator -> m FileEnumerator
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FileEnumerator -> m FileEnumerator)
-> (o -> IO FileEnumerator) -> o -> m FileEnumerator
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr FileEnumerator -> FileEnumerator)
-> o -> IO FileEnumerator
forall o o'.
(HasCallStack, GObject o, GObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr FileEnumerator -> FileEnumerator
FileEnumerator
noFileEnumerator :: Maybe FileEnumerator
noFileEnumerator :: Maybe FileEnumerator
noFileEnumerator = Maybe FileEnumerator
forall a. Maybe a
Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveFileEnumeratorMethod (t :: Symbol) (o :: *) :: * where
ResolveFileEnumeratorMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveFileEnumeratorMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveFileEnumeratorMethod "close" o = FileEnumeratorCloseMethodInfo
ResolveFileEnumeratorMethod "closeAsync" o = FileEnumeratorCloseAsyncMethodInfo
ResolveFileEnumeratorMethod "closeFinish" o = FileEnumeratorCloseFinishMethodInfo
ResolveFileEnumeratorMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveFileEnumeratorMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveFileEnumeratorMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveFileEnumeratorMethod "hasPending" o = FileEnumeratorHasPendingMethodInfo
ResolveFileEnumeratorMethod "isClosed" o = FileEnumeratorIsClosedMethodInfo
ResolveFileEnumeratorMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveFileEnumeratorMethod "iterate" o = FileEnumeratorIterateMethodInfo
ResolveFileEnumeratorMethod "nextFile" o = FileEnumeratorNextFileMethodInfo
ResolveFileEnumeratorMethod "nextFilesAsync" o = FileEnumeratorNextFilesAsyncMethodInfo
ResolveFileEnumeratorMethod "nextFilesFinish" o = FileEnumeratorNextFilesFinishMethodInfo
ResolveFileEnumeratorMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveFileEnumeratorMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveFileEnumeratorMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveFileEnumeratorMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveFileEnumeratorMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveFileEnumeratorMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveFileEnumeratorMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveFileEnumeratorMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveFileEnumeratorMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveFileEnumeratorMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveFileEnumeratorMethod "getChild" o = FileEnumeratorGetChildMethodInfo
ResolveFileEnumeratorMethod "getContainer" o = FileEnumeratorGetContainerMethodInfo
ResolveFileEnumeratorMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveFileEnumeratorMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveFileEnumeratorMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveFileEnumeratorMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveFileEnumeratorMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveFileEnumeratorMethod "setPending" o = FileEnumeratorSetPendingMethodInfo
ResolveFileEnumeratorMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveFileEnumeratorMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveFileEnumeratorMethod t FileEnumerator, O.MethodInfo info FileEnumerator p) => OL.IsLabel t (FileEnumerator -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif
constructFileEnumeratorContainer :: (IsFileEnumerator o, Gio.File.IsFile a) => a -> IO (GValueConstruct o)
constructFileEnumeratorContainer :: a -> IO (GValueConstruct o)
constructFileEnumeratorContainer val :: a
val = String -> Maybe a -> IO (GValueConstruct o)
forall a o.
GObject a =>
String -> Maybe a -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyObject "container" (a -> Maybe a
forall a. a -> Maybe a
Just a
val)
#if defined(ENABLE_OVERLOADING)
data FileEnumeratorContainerPropertyInfo
instance AttrInfo FileEnumeratorContainerPropertyInfo where
type AttrAllowedOps FileEnumeratorContainerPropertyInfo = '[ 'AttrConstruct, 'AttrClear]
type AttrBaseTypeConstraint FileEnumeratorContainerPropertyInfo = IsFileEnumerator
type AttrSetTypeConstraint FileEnumeratorContainerPropertyInfo = Gio.File.IsFile
type AttrTransferTypeConstraint FileEnumeratorContainerPropertyInfo = Gio.File.IsFile
type AttrTransferType FileEnumeratorContainerPropertyInfo = Gio.File.File
type AttrGetType FileEnumeratorContainerPropertyInfo = ()
type AttrLabel FileEnumeratorContainerPropertyInfo = "container"
type AttrOrigin FileEnumeratorContainerPropertyInfo = FileEnumerator
attrGet = undefined
attrSet = undefined
attrTransfer _ v = do
unsafeCastTo Gio.File.File v
attrConstruct = constructFileEnumeratorContainer
attrClear = undefined
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList FileEnumerator
type instance O.AttributeList FileEnumerator = FileEnumeratorAttributeList
type FileEnumeratorAttributeList = ('[ '("container", FileEnumeratorContainerPropertyInfo)] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
fileEnumeratorContainer :: AttrLabelProxy "container"
fileEnumeratorContainer = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList FileEnumerator = FileEnumeratorSignalList
type FileEnumeratorSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "g_file_enumerator_close" g_file_enumerator_close ::
Ptr FileEnumerator ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO CInt
fileEnumeratorClose ::
(B.CallStack.HasCallStack, MonadIO m, IsFileEnumerator a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (b)
-> m ()
fileEnumeratorClose :: a -> Maybe b -> m ()
fileEnumeratorClose enumerator :: a
enumerator cancellable :: Maybe b
cancellable = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr FileEnumerator
enumerator' <- a -> IO (Ptr FileEnumerator)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
enumerator
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr FileEnumerator
-> Ptr Cancellable -> Ptr (Ptr GError) -> IO CInt
g_file_enumerator_close Ptr FileEnumerator
enumerator' Ptr Cancellable
maybeCancellable
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
enumerator
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileEnumeratorCloseMethodInfo
instance (signature ~ (Maybe (b) -> m ()), MonadIO m, IsFileEnumerator a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileEnumeratorCloseMethodInfo a signature where
overloadedMethod = fileEnumeratorClose
#endif
foreign import ccall "g_file_enumerator_close_async" g_file_enumerator_close_async ::
Ptr FileEnumerator ->
Int32 ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
fileEnumeratorCloseAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsFileEnumerator a, Gio.Cancellable.IsCancellable b) =>
a
-> Int32
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
fileEnumeratorCloseAsync :: a -> Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()
fileEnumeratorCloseAsync enumerator :: a
enumerator ioPriority :: Int32
ioPriority cancellable :: Maybe b
cancellable callback :: Maybe AsyncReadyCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr FileEnumerator
enumerator' <- a -> IO (Ptr FileEnumerator)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
enumerator
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just jCallback :: AsyncReadyCallback
jCallback -> do
Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr FileEnumerator
-> Int32
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_file_enumerator_close_async Ptr FileEnumerator
enumerator' Int32
ioPriority Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
enumerator
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data FileEnumeratorCloseAsyncMethodInfo
instance (signature ~ (Int32 -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsFileEnumerator a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileEnumeratorCloseAsyncMethodInfo a signature where
overloadedMethod = fileEnumeratorCloseAsync
#endif
foreign import ccall "g_file_enumerator_close_finish" g_file_enumerator_close_finish ::
Ptr FileEnumerator ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO CInt
fileEnumeratorCloseFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsFileEnumerator a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m ()
fileEnumeratorCloseFinish :: a -> b -> m ()
fileEnumeratorCloseFinish enumerator :: a
enumerator result_ :: b
result_ = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr FileEnumerator
enumerator' <- a -> IO (Ptr FileEnumerator)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
enumerator
Ptr AsyncResult
result_' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr FileEnumerator
-> Ptr AsyncResult -> Ptr (Ptr GError) -> IO CInt
g_file_enumerator_close_finish Ptr FileEnumerator
enumerator' Ptr AsyncResult
result_'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
enumerator
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileEnumeratorCloseFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsFileEnumerator a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo FileEnumeratorCloseFinishMethodInfo a signature where
overloadedMethod = fileEnumeratorCloseFinish
#endif
foreign import ccall "g_file_enumerator_get_child" g_file_enumerator_get_child ::
Ptr FileEnumerator ->
Ptr Gio.FileInfo.FileInfo ->
IO (Ptr Gio.File.File)
fileEnumeratorGetChild ::
(B.CallStack.HasCallStack, MonadIO m, IsFileEnumerator a, Gio.FileInfo.IsFileInfo b) =>
a
-> b
-> m Gio.File.File
fileEnumeratorGetChild :: a -> b -> m File
fileEnumeratorGetChild enumerator :: a
enumerator info :: b
info = IO File -> m File
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO File -> m File) -> IO File -> m File
forall a b. (a -> b) -> a -> b
$ do
Ptr FileEnumerator
enumerator' <- a -> IO (Ptr FileEnumerator)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
enumerator
Ptr FileInfo
info' <- b -> IO (Ptr FileInfo)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
info
Ptr File
result <- Ptr FileEnumerator -> Ptr FileInfo -> IO (Ptr File)
g_file_enumerator_get_child Ptr FileEnumerator
enumerator' Ptr FileInfo
info'
Text -> Ptr File -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileEnumeratorGetChild" Ptr File
result
File
result' <- ((ManagedPtr File -> File) -> Ptr File -> IO File
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr File -> File
Gio.File.File) Ptr File
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
enumerator
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
info
File -> IO File
forall (m :: * -> *) a. Monad m => a -> m a
return File
result'
#if defined(ENABLE_OVERLOADING)
data FileEnumeratorGetChildMethodInfo
instance (signature ~ (b -> m Gio.File.File), MonadIO m, IsFileEnumerator a, Gio.FileInfo.IsFileInfo b) => O.MethodInfo FileEnumeratorGetChildMethodInfo a signature where
overloadedMethod = fileEnumeratorGetChild
#endif
foreign import ccall "g_file_enumerator_get_container" g_file_enumerator_get_container ::
Ptr FileEnumerator ->
IO (Ptr Gio.File.File)
fileEnumeratorGetContainer ::
(B.CallStack.HasCallStack, MonadIO m, IsFileEnumerator a) =>
a
-> m Gio.File.File
fileEnumeratorGetContainer :: a -> m File
fileEnumeratorGetContainer enumerator :: a
enumerator = IO File -> m File
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO File -> m File) -> IO File -> m File
forall a b. (a -> b) -> a -> b
$ do
Ptr FileEnumerator
enumerator' <- a -> IO (Ptr FileEnumerator)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
enumerator
Ptr File
result <- Ptr FileEnumerator -> IO (Ptr File)
g_file_enumerator_get_container Ptr FileEnumerator
enumerator'
Text -> Ptr File -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "fileEnumeratorGetContainer" Ptr File
result
File
result' <- ((ManagedPtr File -> File) -> Ptr File -> IO File
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr File -> File
Gio.File.File) Ptr File
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
enumerator
File -> IO File
forall (m :: * -> *) a. Monad m => a -> m a
return File
result'
#if defined(ENABLE_OVERLOADING)
data FileEnumeratorGetContainerMethodInfo
instance (signature ~ (m Gio.File.File), MonadIO m, IsFileEnumerator a) => O.MethodInfo FileEnumeratorGetContainerMethodInfo a signature where
overloadedMethod = fileEnumeratorGetContainer
#endif
foreign import ccall "g_file_enumerator_has_pending" g_file_enumerator_has_pending ::
Ptr FileEnumerator ->
IO CInt
fileEnumeratorHasPending ::
(B.CallStack.HasCallStack, MonadIO m, IsFileEnumerator a) =>
a
-> m Bool
fileEnumeratorHasPending :: a -> m Bool
fileEnumeratorHasPending enumerator :: a
enumerator = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr FileEnumerator
enumerator' <- a -> IO (Ptr FileEnumerator)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
enumerator
CInt
result <- Ptr FileEnumerator -> IO CInt
g_file_enumerator_has_pending Ptr FileEnumerator
enumerator'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
enumerator
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data FileEnumeratorHasPendingMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsFileEnumerator a) => O.MethodInfo FileEnumeratorHasPendingMethodInfo a signature where
overloadedMethod = fileEnumeratorHasPending
#endif
foreign import ccall "g_file_enumerator_is_closed" g_file_enumerator_is_closed ::
Ptr FileEnumerator ->
IO CInt
fileEnumeratorIsClosed ::
(B.CallStack.HasCallStack, MonadIO m, IsFileEnumerator a) =>
a
-> m Bool
fileEnumeratorIsClosed :: a -> m Bool
fileEnumeratorIsClosed enumerator :: a
enumerator = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr FileEnumerator
enumerator' <- a -> IO (Ptr FileEnumerator)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
enumerator
CInt
result <- Ptr FileEnumerator -> IO CInt
g_file_enumerator_is_closed Ptr FileEnumerator
enumerator'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
enumerator
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data FileEnumeratorIsClosedMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsFileEnumerator a) => O.MethodInfo FileEnumeratorIsClosedMethodInfo a signature where
overloadedMethod = fileEnumeratorIsClosed
#endif
foreign import ccall "g_file_enumerator_iterate" g_file_enumerator_iterate ::
Ptr FileEnumerator ->
Ptr (Ptr Gio.FileInfo.FileInfo) ->
Ptr (Ptr Gio.File.File) ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO CInt
fileEnumeratorIterate ::
(B.CallStack.HasCallStack, MonadIO m, IsFileEnumerator a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (b)
-> m ((Gio.FileInfo.FileInfo, Gio.File.File))
fileEnumeratorIterate :: a -> Maybe b -> m (FileInfo, File)
fileEnumeratorIterate direnum :: a
direnum cancellable :: Maybe b
cancellable = IO (FileInfo, File) -> m (FileInfo, File)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (FileInfo, File) -> m (FileInfo, File))
-> IO (FileInfo, File) -> m (FileInfo, File)
forall a b. (a -> b) -> a -> b
$ do
Ptr FileEnumerator
direnum' <- a -> IO (Ptr FileEnumerator)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
direnum
Ptr (Ptr FileInfo)
outInfo <- IO (Ptr (Ptr FileInfo))
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr (Ptr Gio.FileInfo.FileInfo))
Ptr (Ptr File)
outChild <- IO (Ptr (Ptr File))
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr (Ptr Gio.File.File))
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO (FileInfo, File) -> IO () -> IO (FileInfo, File)
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr FileEnumerator
-> Ptr (Ptr FileInfo)
-> Ptr (Ptr File)
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO CInt
g_file_enumerator_iterate Ptr FileEnumerator
direnum' Ptr (Ptr FileInfo)
outInfo Ptr (Ptr File)
outChild Ptr Cancellable
maybeCancellable
Ptr FileInfo
outInfo' <- Ptr (Ptr FileInfo) -> IO (Ptr FileInfo)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr FileInfo)
outInfo
FileInfo
outInfo'' <- ((ManagedPtr FileInfo -> FileInfo) -> Ptr FileInfo -> IO FileInfo
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr FileInfo -> FileInfo
Gio.FileInfo.FileInfo) Ptr FileInfo
outInfo'
Ptr File
outChild' <- Ptr (Ptr File) -> IO (Ptr File)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr File)
outChild
File
outChild'' <- ((ManagedPtr File -> File) -> Ptr File -> IO File
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr File -> File
Gio.File.File) Ptr File
outChild'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
direnum
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Ptr (Ptr FileInfo) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr FileInfo)
outInfo
Ptr (Ptr File) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr File)
outChild
(FileInfo, File) -> IO (FileInfo, File)
forall (m :: * -> *) a. Monad m => a -> m a
return (FileInfo
outInfo'', File
outChild'')
) (do
Ptr (Ptr FileInfo) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr FileInfo)
outInfo
Ptr (Ptr File) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr File)
outChild
)
#if defined(ENABLE_OVERLOADING)
data FileEnumeratorIterateMethodInfo
instance (signature ~ (Maybe (b) -> m ((Gio.FileInfo.FileInfo, Gio.File.File))), MonadIO m, IsFileEnumerator a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileEnumeratorIterateMethodInfo a signature where
overloadedMethod = fileEnumeratorIterate
#endif
foreign import ccall "g_file_enumerator_next_file" g_file_enumerator_next_file ::
Ptr FileEnumerator ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr Gio.FileInfo.FileInfo)
fileEnumeratorNextFile ::
(B.CallStack.HasCallStack, MonadIO m, IsFileEnumerator a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (b)
-> m (Maybe Gio.FileInfo.FileInfo)
fileEnumeratorNextFile :: a -> Maybe b -> m (Maybe FileInfo)
fileEnumeratorNextFile enumerator :: a
enumerator cancellable :: Maybe b
cancellable = IO (Maybe FileInfo) -> m (Maybe FileInfo)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe FileInfo) -> m (Maybe FileInfo))
-> IO (Maybe FileInfo) -> m (Maybe FileInfo)
forall a b. (a -> b) -> a -> b
$ do
Ptr FileEnumerator
enumerator' <- a -> IO (Ptr FileEnumerator)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
enumerator
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO (Maybe FileInfo) -> IO () -> IO (Maybe FileInfo)
forall a b. IO a -> IO b -> IO a
onException (do
Ptr FileInfo
result <- (Ptr (Ptr GError) -> IO (Ptr FileInfo)) -> IO (Ptr FileInfo)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr FileInfo)) -> IO (Ptr FileInfo))
-> (Ptr (Ptr GError) -> IO (Ptr FileInfo)) -> IO (Ptr FileInfo)
forall a b. (a -> b) -> a -> b
$ Ptr FileEnumerator
-> Ptr Cancellable -> Ptr (Ptr GError) -> IO (Ptr FileInfo)
g_file_enumerator_next_file Ptr FileEnumerator
enumerator' Ptr Cancellable
maybeCancellable
Maybe FileInfo
maybeResult <- Ptr FileInfo
-> (Ptr FileInfo -> IO FileInfo) -> IO (Maybe FileInfo)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr FileInfo
result ((Ptr FileInfo -> IO FileInfo) -> IO (Maybe FileInfo))
-> (Ptr FileInfo -> IO FileInfo) -> IO (Maybe FileInfo)
forall a b. (a -> b) -> a -> b
$ \result' :: Ptr FileInfo
result' -> do
FileInfo
result'' <- ((ManagedPtr FileInfo -> FileInfo) -> Ptr FileInfo -> IO FileInfo
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr FileInfo -> FileInfo
Gio.FileInfo.FileInfo) Ptr FileInfo
result'
FileInfo -> IO FileInfo
forall (m :: * -> *) a. Monad m => a -> m a
return FileInfo
result''
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
enumerator
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Maybe FileInfo -> IO (Maybe FileInfo)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe FileInfo
maybeResult
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileEnumeratorNextFileMethodInfo
instance (signature ~ (Maybe (b) -> m (Maybe Gio.FileInfo.FileInfo)), MonadIO m, IsFileEnumerator a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileEnumeratorNextFileMethodInfo a signature where
overloadedMethod = fileEnumeratorNextFile
#endif
foreign import ccall "g_file_enumerator_next_files_async" g_file_enumerator_next_files_async ::
Ptr FileEnumerator ->
Int32 ->
Int32 ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
fileEnumeratorNextFilesAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsFileEnumerator a, Gio.Cancellable.IsCancellable b) =>
a
-> Int32
-> Int32
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
fileEnumeratorNextFilesAsync :: a -> Int32 -> Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()
fileEnumeratorNextFilesAsync enumerator :: a
enumerator numFiles :: Int32
numFiles ioPriority :: Int32
ioPriority cancellable :: Maybe b
cancellable callback :: Maybe AsyncReadyCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr FileEnumerator
enumerator' <- a -> IO (Ptr FileEnumerator)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
enumerator
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just jCallback :: AsyncReadyCallback
jCallback -> do
Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr FileEnumerator
-> Int32
-> Int32
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_file_enumerator_next_files_async Ptr FileEnumerator
enumerator' Int32
numFiles Int32
ioPriority Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
enumerator
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data FileEnumeratorNextFilesAsyncMethodInfo
instance (signature ~ (Int32 -> Int32 -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsFileEnumerator a, Gio.Cancellable.IsCancellable b) => O.MethodInfo FileEnumeratorNextFilesAsyncMethodInfo a signature where
overloadedMethod = fileEnumeratorNextFilesAsync
#endif
foreign import ccall "g_file_enumerator_next_files_finish" g_file_enumerator_next_files_finish ::
Ptr FileEnumerator ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO (Ptr (GList (Ptr Gio.FileInfo.FileInfo)))
fileEnumeratorNextFilesFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsFileEnumerator a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m [Gio.FileInfo.FileInfo]
fileEnumeratorNextFilesFinish :: a -> b -> m [FileInfo]
fileEnumeratorNextFilesFinish enumerator :: a
enumerator result_ :: b
result_ = IO [FileInfo] -> m [FileInfo]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [FileInfo] -> m [FileInfo]) -> IO [FileInfo] -> m [FileInfo]
forall a b. (a -> b) -> a -> b
$ do
Ptr FileEnumerator
enumerator' <- a -> IO (Ptr FileEnumerator)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
enumerator
Ptr AsyncResult
result_' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
IO [FileInfo] -> IO () -> IO [FileInfo]
forall a b. IO a -> IO b -> IO a
onException (do
Ptr (GList (Ptr FileInfo))
result <- (Ptr (Ptr GError) -> IO (Ptr (GList (Ptr FileInfo))))
-> IO (Ptr (GList (Ptr FileInfo)))
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr (GList (Ptr FileInfo))))
-> IO (Ptr (GList (Ptr FileInfo))))
-> (Ptr (Ptr GError) -> IO (Ptr (GList (Ptr FileInfo))))
-> IO (Ptr (GList (Ptr FileInfo)))
forall a b. (a -> b) -> a -> b
$ Ptr FileEnumerator
-> Ptr AsyncResult
-> Ptr (Ptr GError)
-> IO (Ptr (GList (Ptr FileInfo)))
g_file_enumerator_next_files_finish Ptr FileEnumerator
enumerator' Ptr AsyncResult
result_'
[Ptr FileInfo]
result' <- Ptr (GList (Ptr FileInfo)) -> IO [Ptr FileInfo]
forall a. Ptr (GList (Ptr a)) -> IO [Ptr a]
unpackGList Ptr (GList (Ptr FileInfo))
result
[FileInfo]
result'' <- (Ptr FileInfo -> IO FileInfo) -> [Ptr FileInfo] -> IO [FileInfo]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM ((ManagedPtr FileInfo -> FileInfo) -> Ptr FileInfo -> IO FileInfo
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr FileInfo -> FileInfo
Gio.FileInfo.FileInfo) [Ptr FileInfo]
result'
Ptr (GList (Ptr FileInfo)) -> IO ()
forall a. Ptr (GList a) -> IO ()
g_list_free Ptr (GList (Ptr FileInfo))
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
enumerator
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
[FileInfo] -> IO [FileInfo]
forall (m :: * -> *) a. Monad m => a -> m a
return [FileInfo]
result''
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data FileEnumeratorNextFilesFinishMethodInfo
instance (signature ~ (b -> m [Gio.FileInfo.FileInfo]), MonadIO m, IsFileEnumerator a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo FileEnumeratorNextFilesFinishMethodInfo a signature where
overloadedMethod = fileEnumeratorNextFilesFinish
#endif
foreign import ccall "g_file_enumerator_set_pending" g_file_enumerator_set_pending ::
Ptr FileEnumerator ->
CInt ->
IO ()
fileEnumeratorSetPending ::
(B.CallStack.HasCallStack, MonadIO m, IsFileEnumerator a) =>
a
-> Bool
-> m ()
fileEnumeratorSetPending :: a -> Bool -> m ()
fileEnumeratorSetPending enumerator :: a
enumerator pending :: Bool
pending = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr FileEnumerator
enumerator' <- a -> IO (Ptr FileEnumerator)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
enumerator
let pending' :: CInt
pending' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
pending
Ptr FileEnumerator -> CInt -> IO ()
g_file_enumerator_set_pending Ptr FileEnumerator
enumerator' CInt
pending'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
enumerator
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data FileEnumeratorSetPendingMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m, IsFileEnumerator a) => O.MethodInfo FileEnumeratorSetPendingMethodInfo a signature where
overloadedMethod = fileEnumeratorSetPending
#endif