{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gio.Objects.Cancellable
(
Cancellable(..) ,
IsCancellable ,
toCancellable ,
noCancellable ,
#if defined(ENABLE_OVERLOADING)
ResolveCancellableMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
CancellableCancelMethodInfo ,
#endif
cancellableCancel ,
#if defined(ENABLE_OVERLOADING)
CancellableConnectMethodInfo ,
#endif
cancellableConnect ,
#if defined(ENABLE_OVERLOADING)
CancellableDisconnectMethodInfo ,
#endif
cancellableDisconnect ,
cancellableGetCurrent ,
#if defined(ENABLE_OVERLOADING)
CancellableGetFdMethodInfo ,
#endif
cancellableGetFd ,
#if defined(ENABLE_OVERLOADING)
CancellableIsCancelledMethodInfo ,
#endif
cancellableIsCancelled ,
#if defined(ENABLE_OVERLOADING)
CancellableMakePollfdMethodInfo ,
#endif
cancellableMakePollfd ,
cancellableNew ,
#if defined(ENABLE_OVERLOADING)
CancellablePopCurrentMethodInfo ,
#endif
cancellablePopCurrent ,
#if defined(ENABLE_OVERLOADING)
CancellablePushCurrentMethodInfo ,
#endif
cancellablePushCurrent ,
#if defined(ENABLE_OVERLOADING)
CancellableReleaseFdMethodInfo ,
#endif
cancellableReleaseFd ,
#if defined(ENABLE_OVERLOADING)
CancellableResetMethodInfo ,
#endif
cancellableReset ,
#if defined(ENABLE_OVERLOADING)
CancellableSetErrorIfCancelledMethodInfo,
#endif
cancellableSetErrorIfCancelled ,
C_CancellableCancelledCallback ,
CancellableCancelledCallback ,
#if defined(ENABLE_OVERLOADING)
CancellableCancelledSignalInfo ,
#endif
afterCancellableCancelled ,
genClosure_CancellableCancelled ,
mk_CancellableCancelledCallback ,
noCancellableCancelledCallback ,
onCancellableCancelled ,
wrap_CancellableCancelledCallback ,
) 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.GLib.Callbacks as GLib.Callbacks
import qualified GI.GLib.Structs.PollFD as GLib.PollFD
import qualified GI.GObject.Callbacks as GObject.Callbacks
import qualified GI.GObject.Objects.Object as GObject.Object
newtype Cancellable = Cancellable (ManagedPtr Cancellable)
deriving (Cancellable -> Cancellable -> Bool
(Cancellable -> Cancellable -> Bool)
-> (Cancellable -> Cancellable -> Bool) -> Eq Cancellable
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Cancellable -> Cancellable -> Bool
$c/= :: Cancellable -> Cancellable -> Bool
== :: Cancellable -> Cancellable -> Bool
$c== :: Cancellable -> Cancellable -> Bool
Eq)
foreign import ccall "g_cancellable_get_type"
c_g_cancellable_get_type :: IO GType
instance GObject Cancellable where
gobjectType :: IO GType
gobjectType = IO GType
c_g_cancellable_get_type
instance B.GValue.IsGValue Cancellable where
toGValue :: Cancellable -> IO GValue
toGValue o :: Cancellable
o = do
GType
gtype <- IO GType
c_g_cancellable_get_type
Cancellable -> (Ptr Cancellable -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Cancellable
o (GType
-> (GValue -> Ptr Cancellable -> IO ())
-> Ptr Cancellable
-> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr Cancellable -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
fromGValue :: GValue -> IO Cancellable
fromGValue gv :: GValue
gv = do
Ptr Cancellable
ptr <- GValue -> IO (Ptr Cancellable)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr Cancellable)
(ManagedPtr Cancellable -> Cancellable)
-> Ptr Cancellable -> IO Cancellable
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr Cancellable -> Cancellable
Cancellable Ptr Cancellable
ptr
class (GObject o, O.IsDescendantOf Cancellable o) => IsCancellable o
instance (GObject o, O.IsDescendantOf Cancellable o) => IsCancellable o
instance O.HasParentTypes Cancellable
type instance O.ParentTypes Cancellable = '[GObject.Object.Object]
toCancellable :: (MonadIO m, IsCancellable o) => o -> m Cancellable
toCancellable :: o -> m Cancellable
toCancellable = IO Cancellable -> m Cancellable
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Cancellable -> m Cancellable)
-> (o -> IO Cancellable) -> o -> m Cancellable
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr Cancellable -> Cancellable) -> o -> IO Cancellable
forall o o'.
(HasCallStack, GObject o, GObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr Cancellable -> Cancellable
Cancellable
noCancellable :: Maybe Cancellable
noCancellable :: Maybe Cancellable
noCancellable = Maybe Cancellable
forall a. Maybe a
Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveCancellableMethod (t :: Symbol) (o :: *) :: * where
ResolveCancellableMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveCancellableMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveCancellableMethod "cancel" o = CancellableCancelMethodInfo
ResolveCancellableMethod "connect" o = CancellableConnectMethodInfo
ResolveCancellableMethod "disconnect" o = CancellableDisconnectMethodInfo
ResolveCancellableMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveCancellableMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveCancellableMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveCancellableMethod "isCancelled" o = CancellableIsCancelledMethodInfo
ResolveCancellableMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveCancellableMethod "makePollfd" o = CancellableMakePollfdMethodInfo
ResolveCancellableMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveCancellableMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveCancellableMethod "popCurrent" o = CancellablePopCurrentMethodInfo
ResolveCancellableMethod "pushCurrent" o = CancellablePushCurrentMethodInfo
ResolveCancellableMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveCancellableMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveCancellableMethod "releaseFd" o = CancellableReleaseFdMethodInfo
ResolveCancellableMethod "reset" o = CancellableResetMethodInfo
ResolveCancellableMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveCancellableMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveCancellableMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveCancellableMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveCancellableMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveCancellableMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveCancellableMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveCancellableMethod "getFd" o = CancellableGetFdMethodInfo
ResolveCancellableMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveCancellableMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveCancellableMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveCancellableMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveCancellableMethod "setErrorIfCancelled" o = CancellableSetErrorIfCancelledMethodInfo
ResolveCancellableMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveCancellableMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveCancellableMethod t Cancellable, O.MethodInfo info Cancellable p) => OL.IsLabel t (Cancellable -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif
type CancellableCancelledCallback =
IO ()
noCancellableCancelledCallback :: Maybe CancellableCancelledCallback
noCancellableCancelledCallback :: Maybe (IO ())
noCancellableCancelledCallback = Maybe (IO ())
forall a. Maybe a
Nothing
type C_CancellableCancelledCallback =
Ptr () ->
Ptr () ->
IO ()
foreign import ccall "wrapper"
mk_CancellableCancelledCallback :: C_CancellableCancelledCallback -> IO (FunPtr C_CancellableCancelledCallback)
genClosure_CancellableCancelled :: MonadIO m => CancellableCancelledCallback -> m (GClosure C_CancellableCancelledCallback)
genClosure_CancellableCancelled :: IO () -> m (GClosure C_CancellableCancelledCallback)
genClosure_CancellableCancelled cb :: IO ()
cb = IO (GClosure C_CancellableCancelledCallback)
-> m (GClosure C_CancellableCancelledCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_CancellableCancelledCallback)
-> m (GClosure C_CancellableCancelledCallback))
-> IO (GClosure C_CancellableCancelledCallback)
-> m (GClosure C_CancellableCancelledCallback)
forall a b. (a -> b) -> a -> b
$ do
let cb' :: C_CancellableCancelledCallback
cb' = IO () -> C_CancellableCancelledCallback
wrap_CancellableCancelledCallback IO ()
cb
C_CancellableCancelledCallback
-> IO (FunPtr C_CancellableCancelledCallback)
mk_CancellableCancelledCallback C_CancellableCancelledCallback
cb' IO (FunPtr C_CancellableCancelledCallback)
-> (FunPtr C_CancellableCancelledCallback
-> IO (GClosure C_CancellableCancelledCallback))
-> IO (GClosure C_CancellableCancelledCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_CancellableCancelledCallback
-> IO (GClosure C_CancellableCancelledCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure
wrap_CancellableCancelledCallback ::
CancellableCancelledCallback ->
C_CancellableCancelledCallback
wrap_CancellableCancelledCallback :: IO () -> C_CancellableCancelledCallback
wrap_CancellableCancelledCallback _cb :: IO ()
_cb _ _ = do
IO ()
_cb
onCancellableCancelled :: (IsCancellable a, MonadIO m) => a -> CancellableCancelledCallback -> m SignalHandlerId
onCancellableCancelled :: a -> IO () -> m SignalHandlerId
onCancellableCancelled obj :: a
obj cb :: IO ()
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
let cb' :: C_CancellableCancelledCallback
cb' = IO () -> C_CancellableCancelledCallback
wrap_CancellableCancelledCallback IO ()
cb
FunPtr C_CancellableCancelledCallback
cb'' <- C_CancellableCancelledCallback
-> IO (FunPtr C_CancellableCancelledCallback)
mk_CancellableCancelledCallback C_CancellableCancelledCallback
cb'
a
-> Text
-> FunPtr C_CancellableCancelledCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj "cancelled" FunPtr C_CancellableCancelledCallback
cb'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing
afterCancellableCancelled :: (IsCancellable a, MonadIO m) => a -> CancellableCancelledCallback -> m SignalHandlerId
afterCancellableCancelled :: a -> IO () -> m SignalHandlerId
afterCancellableCancelled obj :: a
obj cb :: IO ()
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
let cb' :: C_CancellableCancelledCallback
cb' = IO () -> C_CancellableCancelledCallback
wrap_CancellableCancelledCallback IO ()
cb
FunPtr C_CancellableCancelledCallback
cb'' <- C_CancellableCancelledCallback
-> IO (FunPtr C_CancellableCancelledCallback)
mk_CancellableCancelledCallback C_CancellableCancelledCallback
cb'
a
-> Text
-> FunPtr C_CancellableCancelledCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj "cancelled" FunPtr C_CancellableCancelledCallback
cb'' SignalConnectMode
SignalConnectAfter Maybe Text
forall a. Maybe a
Nothing
#if defined(ENABLE_OVERLOADING)
data CancellableCancelledSignalInfo
instance SignalInfo CancellableCancelledSignalInfo where
type HaskellCallbackType CancellableCancelledSignalInfo = CancellableCancelledCallback
connectSignal obj cb connectMode detail = do
let cb' = wrap_CancellableCancelledCallback cb
cb'' <- mk_CancellableCancelledCallback cb'
connectSignalFunPtr obj "cancelled" cb'' connectMode detail
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Cancellable
type instance O.AttributeList Cancellable = CancellableAttributeList
type CancellableAttributeList = ('[ ] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Cancellable = CancellableSignalList
type CancellableSignalList = ('[ '("cancelled", CancellableCancelledSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "g_cancellable_new" g_cancellable_new ::
IO (Ptr Cancellable)
cancellableNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
m Cancellable
cancellableNew :: m Cancellable
cancellableNew = IO Cancellable -> m Cancellable
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Cancellable -> m Cancellable)
-> IO Cancellable -> m Cancellable
forall a b. (a -> b) -> a -> b
$ do
Ptr Cancellable
result <- IO (Ptr Cancellable)
g_cancellable_new
Text -> Ptr Cancellable -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "cancellableNew" Ptr Cancellable
result
Cancellable
result' <- ((ManagedPtr Cancellable -> Cancellable)
-> Ptr Cancellable -> IO Cancellable
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Cancellable -> Cancellable
Cancellable) Ptr Cancellable
result
Cancellable -> IO Cancellable
forall (m :: * -> *) a. Monad m => a -> m a
return Cancellable
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_cancellable_cancel" g_cancellable_cancel ::
Ptr Cancellable ->
IO ()
cancellableCancel ::
(B.CallStack.HasCallStack, MonadIO m, IsCancellable a) =>
a
-> m ()
cancellableCancel :: a -> m ()
cancellableCancel cancellable :: a
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 Cancellable
cancellable' <- a -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
cancellable
Ptr Cancellable -> IO ()
g_cancellable_cancel Ptr Cancellable
cancellable'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
cancellable
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data CancellableCancelMethodInfo
instance (signature ~ (m ()), MonadIO m, IsCancellable a) => O.MethodInfo CancellableCancelMethodInfo a signature where
overloadedMethod = cancellableCancel
#endif
foreign import ccall "g_cancellable_connect" g_cancellable_connect ::
Ptr Cancellable ->
FunPtr GObject.Callbacks.C_Callback ->
Ptr () ->
FunPtr GLib.Callbacks.C_DestroyNotify ->
IO CULong
cancellableConnect ::
(B.CallStack.HasCallStack, MonadIO m, IsCancellable a) =>
a
-> GObject.Callbacks.Callback
-> m CULong
cancellableConnect :: a -> IO () -> m SignalHandlerId
cancellableConnect cancellable :: a
cancellable callback :: IO ()
callback = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
Ptr Cancellable
cancellable' <- a -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
cancellable
FunPtr (IO ())
callback' <- IO () -> IO (FunPtr (IO ()))
GObject.Callbacks.mk_Callback (Maybe (Ptr (FunPtr (IO ()))) -> IO () -> IO ()
GObject.Callbacks.wrap_Callback Maybe (Ptr (FunPtr (IO ())))
forall a. Maybe a
Nothing IO ()
callback)
let data_ :: Ptr ()
data_ = FunPtr (IO ()) -> Ptr ()
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr FunPtr (IO ())
callback'
let dataDestroyFunc :: FunPtr (Ptr a -> IO ())
dataDestroyFunc = FunPtr (Ptr a -> IO ())
forall a. FunPtr (Ptr a -> IO ())
safeFreeFunPtrPtr
SignalHandlerId
result <- Ptr Cancellable
-> FunPtr (IO ())
-> Ptr ()
-> FunPtr C_DestroyNotify
-> IO SignalHandlerId
g_cancellable_connect Ptr Cancellable
cancellable' FunPtr (IO ())
callback' Ptr ()
data_ FunPtr C_DestroyNotify
forall a. FunPtr (Ptr a -> IO ())
dataDestroyFunc
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
cancellable
SignalHandlerId -> IO SignalHandlerId
forall (m :: * -> *) a. Monad m => a -> m a
return SignalHandlerId
result
#if defined(ENABLE_OVERLOADING)
data CancellableConnectMethodInfo
instance (signature ~ (GObject.Callbacks.Callback -> m CULong), MonadIO m, IsCancellable a) => O.MethodInfo CancellableConnectMethodInfo a signature where
overloadedMethod = cancellableConnect
#endif
foreign import ccall "g_cancellable_disconnect" g_cancellable_disconnect ::
Ptr Cancellable ->
CULong ->
IO ()
cancellableDisconnect ::
(B.CallStack.HasCallStack, MonadIO m, IsCancellable a) =>
a
-> CULong
-> m ()
cancellableDisconnect :: a -> SignalHandlerId -> m ()
cancellableDisconnect cancellable :: a
cancellable handlerId :: SignalHandlerId
handlerId = 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 Cancellable
cancellable' <- a -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
cancellable
Ptr Cancellable -> SignalHandlerId -> IO ()
g_cancellable_disconnect Ptr Cancellable
cancellable' SignalHandlerId
handlerId
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
cancellable
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data CancellableDisconnectMethodInfo
instance (signature ~ (CULong -> m ()), MonadIO m, IsCancellable a) => O.MethodInfo CancellableDisconnectMethodInfo a signature where
overloadedMethod = cancellableDisconnect
#endif
foreign import ccall "g_cancellable_get_fd" g_cancellable_get_fd ::
Ptr Cancellable ->
IO Int32
cancellableGetFd ::
(B.CallStack.HasCallStack, MonadIO m, IsCancellable a) =>
a
-> m Int32
cancellableGetFd :: a -> m Int32
cancellableGetFd cancellable :: a
cancellable = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
Ptr Cancellable
cancellable' <- a -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
cancellable
Int32
result <- Ptr Cancellable -> IO Int32
g_cancellable_get_fd Ptr Cancellable
cancellable'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
cancellable
Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result
#if defined(ENABLE_OVERLOADING)
data CancellableGetFdMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsCancellable a) => O.MethodInfo CancellableGetFdMethodInfo a signature where
overloadedMethod = cancellableGetFd
#endif
foreign import ccall "g_cancellable_is_cancelled" g_cancellable_is_cancelled ::
Ptr Cancellable ->
IO CInt
cancellableIsCancelled ::
(B.CallStack.HasCallStack, MonadIO m, IsCancellable a) =>
a
-> m Bool
cancellableIsCancelled :: a -> m Bool
cancellableIsCancelled cancellable :: a
cancellable = 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 Cancellable
cancellable' <- a -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
cancellable
CInt
result <- Ptr Cancellable -> IO CInt
g_cancellable_is_cancelled Ptr Cancellable
cancellable'
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
cancellable
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data CancellableIsCancelledMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsCancellable a) => O.MethodInfo CancellableIsCancelledMethodInfo a signature where
overloadedMethod = cancellableIsCancelled
#endif
foreign import ccall "g_cancellable_make_pollfd" g_cancellable_make_pollfd ::
Ptr Cancellable ->
Ptr GLib.PollFD.PollFD ->
IO CInt
cancellableMakePollfd ::
(B.CallStack.HasCallStack, MonadIO m, IsCancellable a) =>
a
-> GLib.PollFD.PollFD
-> m Bool
cancellableMakePollfd :: a -> PollFD -> m Bool
cancellableMakePollfd cancellable :: a
cancellable pollfd :: PollFD
pollfd = 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 Cancellable
cancellable' <- a -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
cancellable
Ptr PollFD
pollfd' <- PollFD -> IO (Ptr PollFD)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr PollFD
pollfd
CInt
result <- Ptr Cancellable -> Ptr PollFD -> IO CInt
g_cancellable_make_pollfd Ptr Cancellable
cancellable' Ptr PollFD
pollfd'
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
cancellable
PollFD -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr PollFD
pollfd
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data CancellableMakePollfdMethodInfo
instance (signature ~ (GLib.PollFD.PollFD -> m Bool), MonadIO m, IsCancellable a) => O.MethodInfo CancellableMakePollfdMethodInfo a signature where
overloadedMethod = cancellableMakePollfd
#endif
foreign import ccall "g_cancellable_pop_current" g_cancellable_pop_current ::
Ptr Cancellable ->
IO ()
cancellablePopCurrent ::
(B.CallStack.HasCallStack, MonadIO m, IsCancellable a) =>
a
-> m ()
cancellablePopCurrent :: a -> m ()
cancellablePopCurrent cancellable :: a
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 Cancellable
cancellable' <- a -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
cancellable
Ptr Cancellable -> IO ()
g_cancellable_pop_current Ptr Cancellable
cancellable'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
cancellable
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data CancellablePopCurrentMethodInfo
instance (signature ~ (m ()), MonadIO m, IsCancellable a) => O.MethodInfo CancellablePopCurrentMethodInfo a signature where
overloadedMethod = cancellablePopCurrent
#endif
foreign import ccall "g_cancellable_push_current" g_cancellable_push_current ::
Ptr Cancellable ->
IO ()
cancellablePushCurrent ::
(B.CallStack.HasCallStack, MonadIO m, IsCancellable a) =>
a
-> m ()
cancellablePushCurrent :: a -> m ()
cancellablePushCurrent cancellable :: a
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 Cancellable
cancellable' <- a -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
cancellable
Ptr Cancellable -> IO ()
g_cancellable_push_current Ptr Cancellable
cancellable'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
cancellable
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data CancellablePushCurrentMethodInfo
instance (signature ~ (m ()), MonadIO m, IsCancellable a) => O.MethodInfo CancellablePushCurrentMethodInfo a signature where
overloadedMethod = cancellablePushCurrent
#endif
foreign import ccall "g_cancellable_release_fd" g_cancellable_release_fd ::
Ptr Cancellable ->
IO ()
cancellableReleaseFd ::
(B.CallStack.HasCallStack, MonadIO m, IsCancellable a) =>
a
-> m ()
cancellableReleaseFd :: a -> m ()
cancellableReleaseFd cancellable :: a
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 Cancellable
cancellable' <- a -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
cancellable
Ptr Cancellable -> IO ()
g_cancellable_release_fd Ptr Cancellable
cancellable'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
cancellable
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data CancellableReleaseFdMethodInfo
instance (signature ~ (m ()), MonadIO m, IsCancellable a) => O.MethodInfo CancellableReleaseFdMethodInfo a signature where
overloadedMethod = cancellableReleaseFd
#endif
foreign import ccall "g_cancellable_reset" g_cancellable_reset ::
Ptr Cancellable ->
IO ()
cancellableReset ::
(B.CallStack.HasCallStack, MonadIO m, IsCancellable a) =>
a
-> m ()
cancellableReset :: a -> m ()
cancellableReset cancellable :: a
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 Cancellable
cancellable' <- a -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
cancellable
Ptr Cancellable -> IO ()
g_cancellable_reset Ptr Cancellable
cancellable'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
cancellable
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data CancellableResetMethodInfo
instance (signature ~ (m ()), MonadIO m, IsCancellable a) => O.MethodInfo CancellableResetMethodInfo a signature where
overloadedMethod = cancellableReset
#endif
foreign import ccall "g_cancellable_set_error_if_cancelled" g_cancellable_set_error_if_cancelled ::
Ptr Cancellable ->
Ptr (Ptr GError) ->
IO CInt
cancellableSetErrorIfCancelled ::
(B.CallStack.HasCallStack, MonadIO m, IsCancellable a) =>
a
-> m ()
cancellableSetErrorIfCancelled :: a -> m ()
cancellableSetErrorIfCancelled cancellable :: a
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 Cancellable
cancellable' <- a -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
cancellable
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 Cancellable -> Ptr (Ptr GError) -> IO CInt
g_cancellable_set_error_if_cancelled Ptr Cancellable
cancellable'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
cancellable
() -> 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 CancellableSetErrorIfCancelledMethodInfo
instance (signature ~ (m ()), MonadIO m, IsCancellable a) => O.MethodInfo CancellableSetErrorIfCancelledMethodInfo a signature where
overloadedMethod = cancellableSetErrorIfCancelled
#endif
foreign import ccall "g_cancellable_get_current" g_cancellable_get_current ::
IO (Ptr Cancellable)
cancellableGetCurrent ::
(B.CallStack.HasCallStack, MonadIO m) =>
m (Maybe Cancellable)
cancellableGetCurrent :: m (Maybe Cancellable)
cancellableGetCurrent = IO (Maybe Cancellable) -> m (Maybe Cancellable)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Cancellable) -> m (Maybe Cancellable))
-> IO (Maybe Cancellable) -> m (Maybe Cancellable)
forall a b. (a -> b) -> a -> b
$ do
Ptr Cancellable
result <- IO (Ptr Cancellable)
g_cancellable_get_current
Maybe Cancellable
maybeResult <- Ptr Cancellable
-> (Ptr Cancellable -> IO Cancellable) -> IO (Maybe Cancellable)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Cancellable
result ((Ptr Cancellable -> IO Cancellable) -> IO (Maybe Cancellable))
-> (Ptr Cancellable -> IO Cancellable) -> IO (Maybe Cancellable)
forall a b. (a -> b) -> a -> b
$ \result' :: Ptr Cancellable
result' -> do
Cancellable
result'' <- ((ManagedPtr Cancellable -> Cancellable)
-> Ptr Cancellable -> IO Cancellable
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Cancellable -> Cancellable
Cancellable) Ptr Cancellable
result'
Cancellable -> IO Cancellable
forall (m :: * -> *) a. Monad m => a -> m a
return Cancellable
result''
Maybe Cancellable -> IO (Maybe Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Cancellable
maybeResult
#if defined(ENABLE_OVERLOADING)
#endif