{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.GLib.Structs.Source
(
Source(..) ,
newZeroSource ,
#if defined(ENABLE_OVERLOADING)
ResolveSourceMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
SourceAddChildSourceMethodInfo ,
#endif
sourceAddChildSource ,
#if defined(ENABLE_OVERLOADING)
SourceAddPollMethodInfo ,
#endif
sourceAddPoll ,
#if defined(ENABLE_OVERLOADING)
SourceAddUnixFdMethodInfo ,
#endif
sourceAddUnixFd ,
#if defined(ENABLE_OVERLOADING)
SourceAttachMethodInfo ,
#endif
sourceAttach ,
#if defined(ENABLE_OVERLOADING)
SourceDestroyMethodInfo ,
#endif
sourceDestroy ,
#if defined(ENABLE_OVERLOADING)
SourceGetCanRecurseMethodInfo ,
#endif
sourceGetCanRecurse ,
#if defined(ENABLE_OVERLOADING)
SourceGetContextMethodInfo ,
#endif
sourceGetContext ,
#if defined(ENABLE_OVERLOADING)
SourceGetCurrentTimeMethodInfo ,
#endif
sourceGetCurrentTime ,
#if defined(ENABLE_OVERLOADING)
SourceGetIdMethodInfo ,
#endif
sourceGetId ,
#if defined(ENABLE_OVERLOADING)
SourceGetNameMethodInfo ,
#endif
sourceGetName ,
#if defined(ENABLE_OVERLOADING)
SourceGetPriorityMethodInfo ,
#endif
sourceGetPriority ,
#if defined(ENABLE_OVERLOADING)
SourceGetReadyTimeMethodInfo ,
#endif
sourceGetReadyTime ,
#if defined(ENABLE_OVERLOADING)
SourceGetTimeMethodInfo ,
#endif
sourceGetTime ,
#if defined(ENABLE_OVERLOADING)
SourceIsDestroyedMethodInfo ,
#endif
sourceIsDestroyed ,
#if defined(ENABLE_OVERLOADING)
SourceModifyUnixFdMethodInfo ,
#endif
sourceModifyUnixFd ,
sourceNew ,
#if defined(ENABLE_OVERLOADING)
SourceQueryUnixFdMethodInfo ,
#endif
sourceQueryUnixFd ,
#if defined(ENABLE_OVERLOADING)
SourceRefMethodInfo ,
#endif
sourceRef ,
sourceRemove ,
sourceRemoveByFuncsUserData ,
sourceRemoveByUserData ,
#if defined(ENABLE_OVERLOADING)
SourceRemoveChildSourceMethodInfo ,
#endif
sourceRemoveChildSource ,
#if defined(ENABLE_OVERLOADING)
SourceRemovePollMethodInfo ,
#endif
sourceRemovePoll ,
#if defined(ENABLE_OVERLOADING)
SourceRemoveUnixFdMethodInfo ,
#endif
sourceRemoveUnixFd ,
#if defined(ENABLE_OVERLOADING)
SourceSetCallbackMethodInfo ,
#endif
sourceSetCallback ,
#if defined(ENABLE_OVERLOADING)
SourceSetCallbackIndirectMethodInfo ,
#endif
sourceSetCallbackIndirect ,
#if defined(ENABLE_OVERLOADING)
SourceSetCanRecurseMethodInfo ,
#endif
sourceSetCanRecurse ,
#if defined(ENABLE_OVERLOADING)
SourceSetFuncsMethodInfo ,
#endif
sourceSetFuncs ,
#if defined(ENABLE_OVERLOADING)
SourceSetNameMethodInfo ,
#endif
sourceSetName ,
sourceSetNameById ,
#if defined(ENABLE_OVERLOADING)
SourceSetPriorityMethodInfo ,
#endif
sourceSetPriority ,
#if defined(ENABLE_OVERLOADING)
SourceSetReadyTimeMethodInfo ,
#endif
sourceSetReadyTime ,
#if defined(ENABLE_OVERLOADING)
SourceSetStaticNameMethodInfo ,
#endif
sourceSetStaticName ,
#if defined(ENABLE_OVERLOADING)
SourceUnrefMethodInfo ,
#endif
sourceUnref ,
) 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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
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 Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
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 GHC.Records as R
import qualified GI.GLib.Callbacks as GLib.Callbacks
import {-# SOURCE #-} qualified GI.GLib.Flags as GLib.Flags
import {-# SOURCE #-} qualified GI.GLib.Structs.MainContext as GLib.MainContext
import {-# SOURCE #-} qualified GI.GLib.Structs.PollFD as GLib.PollFD
import {-# SOURCE #-} qualified GI.GLib.Structs.SourceCallbackFuncs as GLib.SourceCallbackFuncs
import {-# SOURCE #-} qualified GI.GLib.Structs.SourceFuncs as GLib.SourceFuncs
import {-# SOURCE #-} qualified GI.GLib.Structs.TimeVal as GLib.TimeVal
newtype Source = Source (SP.ManagedPtr Source)
deriving (Source -> Source -> Bool
(Source -> Source -> Bool)
-> (Source -> Source -> Bool) -> Eq Source
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Source -> Source -> Bool
$c/= :: Source -> Source -> Bool
== :: Source -> Source -> Bool
$c== :: Source -> Source -> Bool
Eq)
instance SP.ManagedPtrNewtype Source where
toManagedPtr :: Source -> ManagedPtr Source
toManagedPtr (Source ManagedPtr Source
p) = ManagedPtr Source
p
foreign import ccall "g_source_get_type" c_g_source_get_type ::
IO GType
type instance O.ParentTypes Source = '[]
instance O.HasParentTypes Source
instance B.Types.TypedObject Source where
glibType :: IO GType
glibType = IO GType
c_g_source_get_type
instance B.Types.GBoxed Source
instance B.GValue.IsGValue (Maybe Source) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_g_source_get_type
gvalueSet_ :: Ptr GValue -> Maybe Source -> IO ()
gvalueSet_ Ptr GValue
gv Maybe Source
P.Nothing = Ptr GValue -> Ptr Source -> IO ()
forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv (Ptr Source
forall a. Ptr a
FP.nullPtr :: FP.Ptr Source)
gvalueSet_ Ptr GValue
gv (P.Just Source
obj) = Source -> (Ptr Source -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Source
obj (Ptr GValue -> Ptr Source -> IO ()
forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe Source)
gvalueGet_ Ptr GValue
gv = do
Ptr Source
ptr <- Ptr GValue -> IO (Ptr Source)
forall b. Ptr GValue -> IO (Ptr b)
B.GValue.get_boxed Ptr GValue
gv :: IO (Ptr Source)
if Ptr Source
ptr Ptr Source -> Ptr Source -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr Source
forall a. Ptr a
FP.nullPtr
then Source -> Maybe Source
forall a. a -> Maybe a
P.Just (Source -> Maybe Source) -> IO Source -> IO (Maybe Source)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr Source -> Source) -> Ptr Source -> IO Source
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.newBoxed ManagedPtr Source -> Source
Source Ptr Source
ptr
else Maybe Source -> IO (Maybe Source)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Source
forall a. Maybe a
P.Nothing
newZeroSource :: MonadIO m => m Source
newZeroSource :: forall (m :: * -> *). MonadIO m => m Source
newZeroSource = IO Source -> m Source
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Source -> m Source) -> IO Source -> m Source
forall a b. (a -> b) -> a -> b
$ Int -> IO (Ptr Source)
forall a. GBoxed a => Int -> IO (Ptr a)
callocBoxedBytes Int
96 IO (Ptr Source) -> (Ptr Source -> IO Source) -> IO Source
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr Source -> Source) -> Ptr Source -> IO Source
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Source -> Source
Source
instance tag ~ 'AttrSet => Constructible Source tag where
new :: forall (m :: * -> *).
MonadIO m =>
(ManagedPtr Source -> Source) -> [AttrOp Source tag] -> m Source
new ManagedPtr Source -> Source
_ [AttrOp Source tag]
attrs = do
Source
o <- m Source
forall (m :: * -> *). MonadIO m => m Source
newZeroSource
Source -> [AttrOp Source 'AttrSet] -> m ()
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set Source
o [AttrOp Source tag]
[AttrOp Source 'AttrSet]
attrs
Source -> m Source
forall (m :: * -> *) a. Monad m => a -> m a
return Source
o
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Source
type instance O.AttributeList Source = SourceAttributeList
type SourceAttributeList = ('[ ] :: [(Symbol, *)])
#endif
foreign import ccall "g_source_new" g_source_new ::
Ptr GLib.SourceFuncs.SourceFuncs ->
Word32 ->
IO (Ptr Source)
sourceNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
GLib.SourceFuncs.SourceFuncs
-> Word32
-> m Source
sourceNew :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
SourceFuncs -> Word32 -> m Source
sourceNew SourceFuncs
sourceFuncs Word32
structSize = IO Source -> m Source
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Source -> m Source) -> IO Source -> m Source
forall a b. (a -> b) -> a -> b
$ do
Ptr SourceFuncs
sourceFuncs' <- SourceFuncs -> IO (Ptr SourceFuncs)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SourceFuncs
sourceFuncs
Ptr Source
result <- Ptr SourceFuncs -> Word32 -> IO (Ptr Source)
g_source_new Ptr SourceFuncs
sourceFuncs' Word32
structSize
Text -> Ptr Source -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"sourceNew" Ptr Source
result
Source
result' <- ((ManagedPtr Source -> Source) -> Ptr Source -> IO Source
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Source -> Source
Source) Ptr Source
result
SourceFuncs -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr SourceFuncs
sourceFuncs
Source -> IO Source
forall (m :: * -> *) a. Monad m => a -> m a
return Source
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_source_add_child_source" g_source_add_child_source ::
Ptr Source ->
Ptr Source ->
IO ()
sourceAddChildSource ::
(B.CallStack.HasCallStack, MonadIO m) =>
Source
-> Source
-> m ()
sourceAddChildSource :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> Source -> m ()
sourceAddChildSource Source
source Source
childSource = 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 Source
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
Ptr Source
childSource' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
childSource
Ptr Source -> Ptr Source -> IO ()
g_source_add_child_source Ptr Source
source' Ptr Source
childSource'
Source -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Source
source
Source -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Source
childSource
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data SourceAddChildSourceMethodInfo
instance (signature ~ (Source -> m ()), MonadIO m) => O.OverloadedMethod SourceAddChildSourceMethodInfo Source signature where
overloadedMethod = sourceAddChildSource
instance O.OverloadedMethodInfo SourceAddChildSourceMethodInfo Source where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.Source.sourceAddChildSource",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-Source.html#v:sourceAddChildSource"
})
#endif
foreign import ccall "g_source_add_poll" g_source_add_poll ::
Ptr Source ->
Ptr GLib.PollFD.PollFD ->
IO ()
sourceAddPoll ::
(B.CallStack.HasCallStack, MonadIO m) =>
Source
-> GLib.PollFD.PollFD
-> m ()
sourceAddPoll :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> PollFD -> m ()
sourceAddPoll Source
source PollFD
fd = 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 Source
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
Ptr PollFD
fd' <- PollFD -> IO (Ptr PollFD)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr PollFD
fd
Ptr Source -> Ptr PollFD -> IO ()
g_source_add_poll Ptr Source
source' Ptr PollFD
fd'
Source -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Source
source
PollFD -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr PollFD
fd
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data SourceAddPollMethodInfo
instance (signature ~ (GLib.PollFD.PollFD -> m ()), MonadIO m) => O.OverloadedMethod SourceAddPollMethodInfo Source signature where
overloadedMethod = sourceAddPoll
instance O.OverloadedMethodInfo SourceAddPollMethodInfo Source where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.Source.sourceAddPoll",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-Source.html#v:sourceAddPoll"
})
#endif
foreign import ccall "g_source_add_unix_fd" g_source_add_unix_fd ::
Ptr Source ->
Int32 ->
CUInt ->
IO (Ptr ())
sourceAddUnixFd ::
(B.CallStack.HasCallStack, MonadIO m) =>
Source
-> Int32
-> [GLib.Flags.IOCondition]
-> m (Ptr ())
sourceAddUnixFd :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> Int32 -> [IOCondition] -> m (Ptr ())
sourceAddUnixFd Source
source Int32
fd [IOCondition]
events = IO (Ptr ()) -> m (Ptr ())
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Ptr ()) -> m (Ptr ())) -> IO (Ptr ()) -> m (Ptr ())
forall a b. (a -> b) -> a -> b
$ do
Ptr Source
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
let events' :: CUInt
events' = [IOCondition] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [IOCondition]
events
Ptr ()
result <- Ptr Source -> Int32 -> CUInt -> IO (Ptr ())
g_source_add_unix_fd Ptr Source
source' Int32
fd CUInt
events'
Source -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Source
source
Ptr () -> IO (Ptr ())
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr ()
result
#if defined(ENABLE_OVERLOADING)
data SourceAddUnixFdMethodInfo
instance (signature ~ (Int32 -> [GLib.Flags.IOCondition] -> m (Ptr ())), MonadIO m) => O.OverloadedMethod SourceAddUnixFdMethodInfo Source signature where
overloadedMethod = sourceAddUnixFd
instance O.OverloadedMethodInfo SourceAddUnixFdMethodInfo Source where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.Source.sourceAddUnixFd",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-Source.html#v:sourceAddUnixFd"
})
#endif
foreign import ccall "g_source_attach" g_source_attach ::
Ptr Source ->
Ptr GLib.MainContext.MainContext ->
IO Word32
sourceAttach ::
(B.CallStack.HasCallStack, MonadIO m) =>
Source
-> Maybe (GLib.MainContext.MainContext)
-> m Word32
sourceAttach :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> Maybe MainContext -> m Word32
sourceAttach Source
source Maybe MainContext
context = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
Ptr Source
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
Ptr MainContext
maybeContext <- case Maybe MainContext
context of
Maybe MainContext
Nothing -> Ptr MainContext -> IO (Ptr MainContext)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr MainContext
forall a. Ptr a
nullPtr
Just MainContext
jContext -> do
Ptr MainContext
jContext' <- MainContext -> IO (Ptr MainContext)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr MainContext
jContext
Ptr MainContext -> IO (Ptr MainContext)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr MainContext
jContext'
Word32
result <- Ptr Source -> Ptr MainContext -> IO Word32
g_source_attach Ptr Source
source' Ptr MainContext
maybeContext
Source -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Source
source
Maybe MainContext -> (MainContext -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe MainContext
context MainContext -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result
#if defined(ENABLE_OVERLOADING)
data SourceAttachMethodInfo
instance (signature ~ (Maybe (GLib.MainContext.MainContext) -> m Word32), MonadIO m) => O.OverloadedMethod SourceAttachMethodInfo Source signature where
overloadedMethod = sourceAttach
instance O.OverloadedMethodInfo SourceAttachMethodInfo Source where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.Source.sourceAttach",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-Source.html#v:sourceAttach"
})
#endif
foreign import ccall "g_source_destroy" g_source_destroy ::
Ptr Source ->
IO ()
sourceDestroy ::
(B.CallStack.HasCallStack, MonadIO m) =>
Source
-> m ()
sourceDestroy :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Source -> m ()
sourceDestroy Source
source = 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 Source
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
Ptr Source -> IO ()
g_source_destroy Ptr Source
source'
Source -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Source
source
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data SourceDestroyMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.OverloadedMethod SourceDestroyMethodInfo Source signature where
overloadedMethod = sourceDestroy
instance O.OverloadedMethodInfo SourceDestroyMethodInfo Source where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.Source.sourceDestroy",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-Source.html#v:sourceDestroy"
})
#endif
foreign import ccall "g_source_get_can_recurse" g_source_get_can_recurse ::
Ptr Source ->
IO CInt
sourceGetCanRecurse ::
(B.CallStack.HasCallStack, MonadIO m) =>
Source
-> m Bool
sourceGetCanRecurse :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Source -> m Bool
sourceGetCanRecurse Source
source = 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 Source
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
CInt
result <- Ptr Source -> IO CInt
g_source_get_can_recurse Ptr Source
source'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
Source -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Source
source
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data SourceGetCanRecurseMethodInfo
instance (signature ~ (m Bool), MonadIO m) => O.OverloadedMethod SourceGetCanRecurseMethodInfo Source signature where
overloadedMethod = sourceGetCanRecurse
instance O.OverloadedMethodInfo SourceGetCanRecurseMethodInfo Source where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.Source.sourceGetCanRecurse",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-Source.html#v:sourceGetCanRecurse"
})
#endif
foreign import ccall "g_source_get_context" g_source_get_context ::
Ptr Source ->
IO (Ptr GLib.MainContext.MainContext)
sourceGetContext ::
(B.CallStack.HasCallStack, MonadIO m) =>
Source
-> m (Maybe GLib.MainContext.MainContext)
sourceGetContext :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> m (Maybe MainContext)
sourceGetContext Source
source = IO (Maybe MainContext) -> m (Maybe MainContext)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe MainContext) -> m (Maybe MainContext))
-> IO (Maybe MainContext) -> m (Maybe MainContext)
forall a b. (a -> b) -> a -> b
$ do
Ptr Source
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
Ptr MainContext
result <- Ptr Source -> IO (Ptr MainContext)
g_source_get_context Ptr Source
source'
Maybe MainContext
maybeResult <- Ptr MainContext
-> (Ptr MainContext -> IO MainContext) -> IO (Maybe MainContext)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr MainContext
result ((Ptr MainContext -> IO MainContext) -> IO (Maybe MainContext))
-> (Ptr MainContext -> IO MainContext) -> IO (Maybe MainContext)
forall a b. (a -> b) -> a -> b
$ \Ptr MainContext
result' -> do
MainContext
result'' <- ((ManagedPtr MainContext -> MainContext)
-> Ptr MainContext -> IO MainContext
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr MainContext -> MainContext
GLib.MainContext.MainContext) Ptr MainContext
result'
MainContext -> IO MainContext
forall (m :: * -> *) a. Monad m => a -> m a
return MainContext
result''
Source -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Source
source
Maybe MainContext -> IO (Maybe MainContext)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe MainContext
maybeResult
#if defined(ENABLE_OVERLOADING)
data SourceGetContextMethodInfo
instance (signature ~ (m (Maybe GLib.MainContext.MainContext)), MonadIO m) => O.OverloadedMethod SourceGetContextMethodInfo Source signature where
overloadedMethod = sourceGetContext
instance O.OverloadedMethodInfo SourceGetContextMethodInfo Source where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.Source.sourceGetContext",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-Source.html#v:sourceGetContext"
})
#endif
foreign import ccall "g_source_get_current_time" g_source_get_current_time ::
Ptr Source ->
Ptr GLib.TimeVal.TimeVal ->
IO ()
{-# DEPRECATED sourceGetCurrentTime ["(Since version 2.28)","use 'GI.GLib.Structs.Source.sourceGetTime' instead"] #-}
sourceGetCurrentTime ::
(B.CallStack.HasCallStack, MonadIO m) =>
Source
-> GLib.TimeVal.TimeVal
-> m ()
sourceGetCurrentTime :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> TimeVal -> m ()
sourceGetCurrentTime Source
source TimeVal
timeval = 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 Source
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
Ptr TimeVal
timeval' <- TimeVal -> IO (Ptr TimeVal)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr TimeVal
timeval
Ptr Source -> Ptr TimeVal -> IO ()
g_source_get_current_time Ptr Source
source' Ptr TimeVal
timeval'
Source -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Source
source
TimeVal -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr TimeVal
timeval
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data SourceGetCurrentTimeMethodInfo
instance (signature ~ (GLib.TimeVal.TimeVal -> m ()), MonadIO m) => O.OverloadedMethod SourceGetCurrentTimeMethodInfo Source signature where
overloadedMethod = sourceGetCurrentTime
instance O.OverloadedMethodInfo SourceGetCurrentTimeMethodInfo Source where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.Source.sourceGetCurrentTime",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-Source.html#v:sourceGetCurrentTime"
})
#endif
foreign import ccall "g_source_get_id" g_source_get_id ::
Ptr Source ->
IO Word32
sourceGetId ::
(B.CallStack.HasCallStack, MonadIO m) =>
Source
-> m Word32
sourceGetId :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> m Word32
sourceGetId Source
source = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
Ptr Source
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
Word32
result <- Ptr Source -> IO Word32
g_source_get_id Ptr Source
source'
Source -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Source
source
Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result
#if defined(ENABLE_OVERLOADING)
data SourceGetIdMethodInfo
instance (signature ~ (m Word32), MonadIO m) => O.OverloadedMethod SourceGetIdMethodInfo Source signature where
overloadedMethod = sourceGetId
instance O.OverloadedMethodInfo SourceGetIdMethodInfo Source where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.Source.sourceGetId",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-Source.html#v:sourceGetId"
})
#endif
foreign import ccall "g_source_get_name" g_source_get_name ::
Ptr Source ->
IO CString
sourceGetName ::
(B.CallStack.HasCallStack, MonadIO m) =>
Source
-> m (Maybe T.Text)
sourceGetName :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> m (Maybe Text)
sourceGetName Source
source = IO (Maybe Text) -> m (Maybe Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
Ptr Source
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
CString
result <- Ptr Source -> IO CString
g_source_get_name Ptr Source
source'
Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
Source -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Source
source
Maybe Text -> IO (Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult
#if defined(ENABLE_OVERLOADING)
data SourceGetNameMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m) => O.OverloadedMethod SourceGetNameMethodInfo Source signature where
overloadedMethod = sourceGetName
instance O.OverloadedMethodInfo SourceGetNameMethodInfo Source where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.Source.sourceGetName",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-Source.html#v:sourceGetName"
})
#endif
foreign import ccall "g_source_get_priority" g_source_get_priority ::
Ptr Source ->
IO Int32
sourceGetPriority ::
(B.CallStack.HasCallStack, MonadIO m) =>
Source
-> m Int32
sourceGetPriority :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> m Int32
sourceGetPriority Source
source = 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 Source
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
Int32
result <- Ptr Source -> IO Int32
g_source_get_priority Ptr Source
source'
Source -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Source
source
Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result
#if defined(ENABLE_OVERLOADING)
data SourceGetPriorityMethodInfo
instance (signature ~ (m Int32), MonadIO m) => O.OverloadedMethod SourceGetPriorityMethodInfo Source signature where
overloadedMethod = sourceGetPriority
instance O.OverloadedMethodInfo SourceGetPriorityMethodInfo Source where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.Source.sourceGetPriority",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-Source.html#v:sourceGetPriority"
})
#endif
foreign import ccall "g_source_get_ready_time" g_source_get_ready_time ::
Ptr Source ->
IO Int64
sourceGetReadyTime ::
(B.CallStack.HasCallStack, MonadIO m) =>
Source
-> m Int64
sourceGetReadyTime :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> m Int64
sourceGetReadyTime Source
source = IO Int64 -> m Int64
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int64 -> m Int64) -> IO Int64 -> m Int64
forall a b. (a -> b) -> a -> b
$ do
Ptr Source
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
Int64
result <- Ptr Source -> IO Int64
g_source_get_ready_time Ptr Source
source'
Source -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Source
source
Int64 -> IO Int64
forall (m :: * -> *) a. Monad m => a -> m a
return Int64
result
#if defined(ENABLE_OVERLOADING)
data SourceGetReadyTimeMethodInfo
instance (signature ~ (m Int64), MonadIO m) => O.OverloadedMethod SourceGetReadyTimeMethodInfo Source signature where
overloadedMethod = sourceGetReadyTime
instance O.OverloadedMethodInfo SourceGetReadyTimeMethodInfo Source where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.Source.sourceGetReadyTime",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-Source.html#v:sourceGetReadyTime"
})
#endif
foreign import ccall "g_source_get_time" g_source_get_time ::
Ptr Source ->
IO Int64
sourceGetTime ::
(B.CallStack.HasCallStack, MonadIO m) =>
Source
-> m Int64
sourceGetTime :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> m Int64
sourceGetTime Source
source = IO Int64 -> m Int64
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int64 -> m Int64) -> IO Int64 -> m Int64
forall a b. (a -> b) -> a -> b
$ do
Ptr Source
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
Int64
result <- Ptr Source -> IO Int64
g_source_get_time Ptr Source
source'
Source -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Source
source
Int64 -> IO Int64
forall (m :: * -> *) a. Monad m => a -> m a
return Int64
result
#if defined(ENABLE_OVERLOADING)
data SourceGetTimeMethodInfo
instance (signature ~ (m Int64), MonadIO m) => O.OverloadedMethod SourceGetTimeMethodInfo Source signature where
overloadedMethod = sourceGetTime
instance O.OverloadedMethodInfo SourceGetTimeMethodInfo Source where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.Source.sourceGetTime",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-Source.html#v:sourceGetTime"
})
#endif
foreign import ccall "g_source_is_destroyed" g_source_is_destroyed ::
Ptr Source ->
IO CInt
sourceIsDestroyed ::
(B.CallStack.HasCallStack, MonadIO m) =>
Source
-> m Bool
sourceIsDestroyed :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Source -> m Bool
sourceIsDestroyed Source
source = 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 Source
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
CInt
result <- Ptr Source -> IO CInt
g_source_is_destroyed Ptr Source
source'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
Source -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Source
source
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data SourceIsDestroyedMethodInfo
instance (signature ~ (m Bool), MonadIO m) => O.OverloadedMethod SourceIsDestroyedMethodInfo Source signature where
overloadedMethod = sourceIsDestroyed
instance O.OverloadedMethodInfo SourceIsDestroyedMethodInfo Source where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.Source.sourceIsDestroyed",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-Source.html#v:sourceIsDestroyed"
})
#endif
foreign import ccall "g_source_modify_unix_fd" g_source_modify_unix_fd ::
Ptr Source ->
Ptr () ->
CUInt ->
IO ()
sourceModifyUnixFd ::
(B.CallStack.HasCallStack, MonadIO m) =>
Source
-> Ptr ()
-> [GLib.Flags.IOCondition]
-> m ()
sourceModifyUnixFd :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> Ptr () -> [IOCondition] -> m ()
sourceModifyUnixFd Source
source Ptr ()
tag [IOCondition]
newEvents = 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 Source
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
let newEvents' :: CUInt
newEvents' = [IOCondition] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [IOCondition]
newEvents
Ptr Source -> Ptr () -> CUInt -> IO ()
g_source_modify_unix_fd Ptr Source
source' Ptr ()
tag CUInt
newEvents'
Source -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Source
source
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data SourceModifyUnixFdMethodInfo
instance (signature ~ (Ptr () -> [GLib.Flags.IOCondition] -> m ()), MonadIO m) => O.OverloadedMethod SourceModifyUnixFdMethodInfo Source signature where
overloadedMethod = sourceModifyUnixFd
instance O.OverloadedMethodInfo SourceModifyUnixFdMethodInfo Source where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.Source.sourceModifyUnixFd",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-Source.html#v:sourceModifyUnixFd"
})
#endif
foreign import ccall "g_source_query_unix_fd" g_source_query_unix_fd ::
Ptr Source ->
Ptr () ->
IO CUInt
sourceQueryUnixFd ::
(B.CallStack.HasCallStack, MonadIO m) =>
Source
-> Ptr ()
-> m [GLib.Flags.IOCondition]
sourceQueryUnixFd :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> Ptr () -> m [IOCondition]
sourceQueryUnixFd Source
source Ptr ()
tag = IO [IOCondition] -> m [IOCondition]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [IOCondition] -> m [IOCondition])
-> IO [IOCondition] -> m [IOCondition]
forall a b. (a -> b) -> a -> b
$ do
Ptr Source
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
CUInt
result <- Ptr Source -> Ptr () -> IO CUInt
g_source_query_unix_fd Ptr Source
source' Ptr ()
tag
let result' :: [IOCondition]
result' = CUInt -> [IOCondition]
forall a b. (Storable a, Integral a, Bits a, IsGFlag b) => a -> [b]
wordToGFlags CUInt
result
Source -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Source
source
[IOCondition] -> IO [IOCondition]
forall (m :: * -> *) a. Monad m => a -> m a
return [IOCondition]
result'
#if defined(ENABLE_OVERLOADING)
data SourceQueryUnixFdMethodInfo
instance (signature ~ (Ptr () -> m [GLib.Flags.IOCondition]), MonadIO m) => O.OverloadedMethod SourceQueryUnixFdMethodInfo Source signature where
overloadedMethod = sourceQueryUnixFd
instance O.OverloadedMethodInfo SourceQueryUnixFdMethodInfo Source where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.Source.sourceQueryUnixFd",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-Source.html#v:sourceQueryUnixFd"
})
#endif
foreign import ccall "g_source_ref" g_source_ref ::
Ptr Source ->
IO (Ptr Source)
sourceRef ::
(B.CallStack.HasCallStack, MonadIO m) =>
Source
-> m Source
sourceRef :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> m Source
sourceRef Source
source = IO Source -> m Source
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Source -> m Source) -> IO Source -> m Source
forall a b. (a -> b) -> a -> b
$ do
Ptr Source
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
Ptr Source
result <- Ptr Source -> IO (Ptr Source)
g_source_ref Ptr Source
source'
Text -> Ptr Source -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"sourceRef" Ptr Source
result
Source
result' <- ((ManagedPtr Source -> Source) -> Ptr Source -> IO Source
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Source -> Source
Source) Ptr Source
result
Source -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Source
source
Source -> IO Source
forall (m :: * -> *) a. Monad m => a -> m a
return Source
result'
#if defined(ENABLE_OVERLOADING)
data SourceRefMethodInfo
instance (signature ~ (m Source), MonadIO m) => O.OverloadedMethod SourceRefMethodInfo Source signature where
overloadedMethod = sourceRef
instance O.OverloadedMethodInfo SourceRefMethodInfo Source where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.Source.sourceRef",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-Source.html#v:sourceRef"
})
#endif
foreign import ccall "g_source_remove_child_source" g_source_remove_child_source ::
Ptr Source ->
Ptr Source ->
IO ()
sourceRemoveChildSource ::
(B.CallStack.HasCallStack, MonadIO m) =>
Source
-> Source
-> m ()
sourceRemoveChildSource :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> Source -> m ()
sourceRemoveChildSource Source
source Source
childSource = 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 Source
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
Ptr Source
childSource' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
childSource
Ptr Source -> Ptr Source -> IO ()
g_source_remove_child_source Ptr Source
source' Ptr Source
childSource'
Source -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Source
source
Source -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Source
childSource
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data SourceRemoveChildSourceMethodInfo
instance (signature ~ (Source -> m ()), MonadIO m) => O.OverloadedMethod SourceRemoveChildSourceMethodInfo Source signature where
overloadedMethod = sourceRemoveChildSource
instance O.OverloadedMethodInfo SourceRemoveChildSourceMethodInfo Source where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.Source.sourceRemoveChildSource",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-Source.html#v:sourceRemoveChildSource"
})
#endif
foreign import ccall "g_source_remove_poll" g_source_remove_poll ::
Ptr Source ->
Ptr GLib.PollFD.PollFD ->
IO ()
sourceRemovePoll ::
(B.CallStack.HasCallStack, MonadIO m) =>
Source
-> GLib.PollFD.PollFD
-> m ()
sourceRemovePoll :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> PollFD -> m ()
sourceRemovePoll Source
source PollFD
fd = 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 Source
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
Ptr PollFD
fd' <- PollFD -> IO (Ptr PollFD)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr PollFD
fd
Ptr Source -> Ptr PollFD -> IO ()
g_source_remove_poll Ptr Source
source' Ptr PollFD
fd'
Source -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Source
source
PollFD -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr PollFD
fd
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data SourceRemovePollMethodInfo
instance (signature ~ (GLib.PollFD.PollFD -> m ()), MonadIO m) => O.OverloadedMethod SourceRemovePollMethodInfo Source signature where
overloadedMethod = sourceRemovePoll
instance O.OverloadedMethodInfo SourceRemovePollMethodInfo Source where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.Source.sourceRemovePoll",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-Source.html#v:sourceRemovePoll"
})
#endif
foreign import ccall "g_source_remove_unix_fd" g_source_remove_unix_fd ::
Ptr Source ->
Ptr () ->
IO ()
sourceRemoveUnixFd ::
(B.CallStack.HasCallStack, MonadIO m) =>
Source
-> Ptr ()
-> m ()
sourceRemoveUnixFd :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> Ptr () -> m ()
sourceRemoveUnixFd Source
source Ptr ()
tag = 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 Source
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
Ptr Source -> Ptr () -> IO ()
g_source_remove_unix_fd Ptr Source
source' Ptr ()
tag
Source -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Source
source
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data SourceRemoveUnixFdMethodInfo
instance (signature ~ (Ptr () -> m ()), MonadIO m) => O.OverloadedMethod SourceRemoveUnixFdMethodInfo Source signature where
overloadedMethod = sourceRemoveUnixFd
instance O.OverloadedMethodInfo SourceRemoveUnixFdMethodInfo Source where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.Source.sourceRemoveUnixFd",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-Source.html#v:sourceRemoveUnixFd"
})
#endif
foreign import ccall "g_source_set_callback" g_source_set_callback ::
Ptr Source ->
FunPtr GLib.Callbacks.C_SourceFunc ->
Ptr () ->
FunPtr GLib.Callbacks.C_DestroyNotify ->
IO ()
sourceSetCallback ::
(B.CallStack.HasCallStack, MonadIO m) =>
Source
-> GLib.Callbacks.SourceFunc
-> m ()
sourceSetCallback :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> IO Bool -> m ()
sourceSetCallback Source
source IO Bool
func = 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 Source
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
FunPtr C_SourceFunc
func' <- C_SourceFunc -> IO (FunPtr C_SourceFunc)
GLib.Callbacks.mk_SourceFunc (Maybe (Ptr (FunPtr C_SourceFunc))
-> SourceFunc_WithClosures -> C_SourceFunc
GLib.Callbacks.wrap_SourceFunc Maybe (Ptr (FunPtr C_SourceFunc))
forall a. Maybe a
Nothing (IO Bool -> SourceFunc_WithClosures
GLib.Callbacks.drop_closures_SourceFunc IO Bool
func))
let data_ :: Ptr ()
data_ = FunPtr C_SourceFunc -> Ptr ()
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr FunPtr C_SourceFunc
func'
let notify :: FunPtr (Ptr a -> IO ())
notify = FunPtr (Ptr a -> IO ())
forall a. FunPtr (Ptr a -> IO ())
SP.safeFreeFunPtrPtr
Ptr Source
-> FunPtr C_SourceFunc
-> Ptr ()
-> FunPtr (Ptr () -> IO ())
-> IO ()
g_source_set_callback Ptr Source
source' FunPtr C_SourceFunc
func' Ptr ()
data_ FunPtr (Ptr () -> IO ())
forall a. FunPtr (Ptr a -> IO ())
notify
Source -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Source
source
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data SourceSetCallbackMethodInfo
instance (signature ~ (GLib.Callbacks.SourceFunc -> m ()), MonadIO m) => O.OverloadedMethod SourceSetCallbackMethodInfo Source signature where
overloadedMethod = sourceSetCallback
instance O.OverloadedMethodInfo SourceSetCallbackMethodInfo Source where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.Source.sourceSetCallback",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-Source.html#v:sourceSetCallback"
})
#endif
foreign import ccall "g_source_set_callback_indirect" g_source_set_callback_indirect ::
Ptr Source ->
Ptr () ->
Ptr GLib.SourceCallbackFuncs.SourceCallbackFuncs ->
IO ()
sourceSetCallbackIndirect ::
(B.CallStack.HasCallStack, MonadIO m) =>
Source
-> Ptr ()
-> GLib.SourceCallbackFuncs.SourceCallbackFuncs
-> m ()
sourceSetCallbackIndirect :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> Ptr () -> SourceCallbackFuncs -> m ()
sourceSetCallbackIndirect Source
source Ptr ()
callbackData SourceCallbackFuncs
callbackFuncs = 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 Source
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
Ptr SourceCallbackFuncs
callbackFuncs' <- SourceCallbackFuncs -> IO (Ptr SourceCallbackFuncs)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SourceCallbackFuncs
callbackFuncs
Ptr Source -> Ptr () -> Ptr SourceCallbackFuncs -> IO ()
g_source_set_callback_indirect Ptr Source
source' Ptr ()
callbackData Ptr SourceCallbackFuncs
callbackFuncs'
Source -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Source
source
SourceCallbackFuncs -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr SourceCallbackFuncs
callbackFuncs
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data SourceSetCallbackIndirectMethodInfo
instance (signature ~ (Ptr () -> GLib.SourceCallbackFuncs.SourceCallbackFuncs -> m ()), MonadIO m) => O.OverloadedMethod SourceSetCallbackIndirectMethodInfo Source signature where
overloadedMethod = sourceSetCallbackIndirect
instance O.OverloadedMethodInfo SourceSetCallbackIndirectMethodInfo Source where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.Source.sourceSetCallbackIndirect",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-Source.html#v:sourceSetCallbackIndirect"
})
#endif
foreign import ccall "g_source_set_can_recurse" g_source_set_can_recurse ::
Ptr Source ->
CInt ->
IO ()
sourceSetCanRecurse ::
(B.CallStack.HasCallStack, MonadIO m) =>
Source
-> Bool
-> m ()
sourceSetCanRecurse :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> Bool -> m ()
sourceSetCanRecurse Source
source Bool
canRecurse = 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 Source
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
let canRecurse' :: CInt
canRecurse' = (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
canRecurse
Ptr Source -> CInt -> IO ()
g_source_set_can_recurse Ptr Source
source' CInt
canRecurse'
Source -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Source
source
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data SourceSetCanRecurseMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m) => O.OverloadedMethod SourceSetCanRecurseMethodInfo Source signature where
overloadedMethod = sourceSetCanRecurse
instance O.OverloadedMethodInfo SourceSetCanRecurseMethodInfo Source where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.Source.sourceSetCanRecurse",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-Source.html#v:sourceSetCanRecurse"
})
#endif
foreign import ccall "g_source_set_funcs" g_source_set_funcs ::
Ptr Source ->
Ptr GLib.SourceFuncs.SourceFuncs ->
IO ()
sourceSetFuncs ::
(B.CallStack.HasCallStack, MonadIO m) =>
Source
-> GLib.SourceFuncs.SourceFuncs
-> m ()
sourceSetFuncs :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> SourceFuncs -> m ()
sourceSetFuncs Source
source SourceFuncs
funcs = 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 Source
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
Ptr SourceFuncs
funcs' <- SourceFuncs -> IO (Ptr SourceFuncs)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SourceFuncs
funcs
Ptr Source -> Ptr SourceFuncs -> IO ()
g_source_set_funcs Ptr Source
source' Ptr SourceFuncs
funcs'
Source -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Source
source
SourceFuncs -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr SourceFuncs
funcs
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data SourceSetFuncsMethodInfo
instance (signature ~ (GLib.SourceFuncs.SourceFuncs -> m ()), MonadIO m) => O.OverloadedMethod SourceSetFuncsMethodInfo Source signature where
overloadedMethod = sourceSetFuncs
instance O.OverloadedMethodInfo SourceSetFuncsMethodInfo Source where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.Source.sourceSetFuncs",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-Source.html#v:sourceSetFuncs"
})
#endif
foreign import ccall "g_source_set_name" g_source_set_name ::
Ptr Source ->
CString ->
IO ()
sourceSetName ::
(B.CallStack.HasCallStack, MonadIO m) =>
Source
-> T.Text
-> m ()
sourceSetName :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> Text -> m ()
sourceSetName Source
source Text
name = 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 Source
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
CString
name' <- Text -> IO CString
textToCString Text
name
Ptr Source -> CString -> IO ()
g_source_set_name Ptr Source
source' CString
name'
Source -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Source
source
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
name'
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data SourceSetNameMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m) => O.OverloadedMethod SourceSetNameMethodInfo Source signature where
overloadedMethod = sourceSetName
instance O.OverloadedMethodInfo SourceSetNameMethodInfo Source where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.Source.sourceSetName",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-Source.html#v:sourceSetName"
})
#endif
foreign import ccall "g_source_set_priority" g_source_set_priority ::
Ptr Source ->
Int32 ->
IO ()
sourceSetPriority ::
(B.CallStack.HasCallStack, MonadIO m) =>
Source
-> Int32
-> m ()
sourceSetPriority :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> Int32 -> m ()
sourceSetPriority Source
source Int32
priority = 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 Source
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
Ptr Source -> Int32 -> IO ()
g_source_set_priority Ptr Source
source' Int32
priority
Source -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Source
source
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data SourceSetPriorityMethodInfo
instance (signature ~ (Int32 -> m ()), MonadIO m) => O.OverloadedMethod SourceSetPriorityMethodInfo Source signature where
overloadedMethod = sourceSetPriority
instance O.OverloadedMethodInfo SourceSetPriorityMethodInfo Source where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.Source.sourceSetPriority",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-Source.html#v:sourceSetPriority"
})
#endif
foreign import ccall "g_source_set_ready_time" g_source_set_ready_time ::
Ptr Source ->
Int64 ->
IO ()
sourceSetReadyTime ::
(B.CallStack.HasCallStack, MonadIO m) =>
Source
-> Int64
-> m ()
sourceSetReadyTime :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> Int64 -> m ()
sourceSetReadyTime Source
source Int64
readyTime = 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 Source
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
Ptr Source -> Int64 -> IO ()
g_source_set_ready_time Ptr Source
source' Int64
readyTime
Source -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Source
source
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data SourceSetReadyTimeMethodInfo
instance (signature ~ (Int64 -> m ()), MonadIO m) => O.OverloadedMethod SourceSetReadyTimeMethodInfo Source signature where
overloadedMethod = sourceSetReadyTime
instance O.OverloadedMethodInfo SourceSetReadyTimeMethodInfo Source where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.Source.sourceSetReadyTime",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-Source.html#v:sourceSetReadyTime"
})
#endif
foreign import ccall "g_source_set_static_name" g_source_set_static_name ::
Ptr Source ->
CString ->
IO ()
sourceSetStaticName ::
(B.CallStack.HasCallStack, MonadIO m) =>
Source
-> T.Text
-> m ()
sourceSetStaticName :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> Text -> m ()
sourceSetStaticName Source
source Text
name = 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 Source
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
CString
name' <- Text -> IO CString
textToCString Text
name
Ptr Source -> CString -> IO ()
g_source_set_static_name Ptr Source
source' CString
name'
Source -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Source
source
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
name'
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data SourceSetStaticNameMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m) => O.OverloadedMethod SourceSetStaticNameMethodInfo Source signature where
overloadedMethod = sourceSetStaticName
instance O.OverloadedMethodInfo SourceSetStaticNameMethodInfo Source where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.Source.sourceSetStaticName",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-Source.html#v:sourceSetStaticName"
})
#endif
foreign import ccall "g_source_unref" g_source_unref ::
Ptr Source ->
IO ()
sourceUnref ::
(B.CallStack.HasCallStack, MonadIO m) =>
Source
-> m ()
sourceUnref :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Source -> m ()
sourceUnref Source
source = 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 Source
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
Ptr Source -> IO ()
g_source_unref Ptr Source
source'
Source -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Source
source
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data SourceUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.OverloadedMethod SourceUnrefMethodInfo Source signature where
overloadedMethod = sourceUnref
instance O.OverloadedMethodInfo SourceUnrefMethodInfo Source where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.Source.sourceUnref",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-Source.html#v:sourceUnref"
})
#endif
foreign import ccall "g_source_remove" g_source_remove ::
Word32 ->
IO CInt
sourceRemove ::
(B.CallStack.HasCallStack, MonadIO m) =>
Word32
-> m Bool
sourceRemove :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Word32 -> m Bool
sourceRemove Word32
tag = 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
CInt
result <- Word32 -> IO CInt
g_source_remove Word32
tag
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_source_remove_by_funcs_user_data" g_source_remove_by_funcs_user_data ::
Ptr GLib.SourceFuncs.SourceFuncs ->
Ptr () ->
IO CInt
sourceRemoveByFuncsUserData ::
(B.CallStack.HasCallStack, MonadIO m) =>
GLib.SourceFuncs.SourceFuncs
-> Ptr ()
-> m Bool
sourceRemoveByFuncsUserData :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
SourceFuncs -> Ptr () -> m Bool
sourceRemoveByFuncsUserData SourceFuncs
funcs Ptr ()
userData = 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 SourceFuncs
funcs' <- SourceFuncs -> IO (Ptr SourceFuncs)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SourceFuncs
funcs
CInt
result <- Ptr SourceFuncs -> C_SourceFunc
g_source_remove_by_funcs_user_data Ptr SourceFuncs
funcs' Ptr ()
userData
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
SourceFuncs -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr SourceFuncs
funcs
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_source_remove_by_user_data" g_source_remove_by_user_data ::
Ptr () ->
IO CInt
sourceRemoveByUserData ::
(B.CallStack.HasCallStack, MonadIO m) =>
Ptr ()
-> m Bool
sourceRemoveByUserData :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Ptr () -> m Bool
sourceRemoveByUserData Ptr ()
userData = 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
CInt
result <- C_SourceFunc
g_source_remove_by_user_data Ptr ()
userData
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_source_set_name_by_id" g_source_set_name_by_id ::
Word32 ->
CString ->
IO ()
sourceSetNameById ::
(B.CallStack.HasCallStack, MonadIO m) =>
Word32
-> T.Text
-> m ()
sourceSetNameById :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Word32 -> Text -> m ()
sourceSetNameById Word32
tag Text
name = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
CString
name' <- Text -> IO CString
textToCString Text
name
Word32 -> CString -> IO ()
g_source_set_name_by_id Word32
tag CString
name'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
name'
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveSourceMethod (t :: Symbol) (o :: *) :: * where
ResolveSourceMethod "addChildSource" o = SourceAddChildSourceMethodInfo
ResolveSourceMethod "addPoll" o = SourceAddPollMethodInfo
ResolveSourceMethod "addUnixFd" o = SourceAddUnixFdMethodInfo
ResolveSourceMethod "attach" o = SourceAttachMethodInfo
ResolveSourceMethod "destroy" o = SourceDestroyMethodInfo
ResolveSourceMethod "isDestroyed" o = SourceIsDestroyedMethodInfo
ResolveSourceMethod "modifyUnixFd" o = SourceModifyUnixFdMethodInfo
ResolveSourceMethod "queryUnixFd" o = SourceQueryUnixFdMethodInfo
ResolveSourceMethod "ref" o = SourceRefMethodInfo
ResolveSourceMethod "removeChildSource" o = SourceRemoveChildSourceMethodInfo
ResolveSourceMethod "removePoll" o = SourceRemovePollMethodInfo
ResolveSourceMethod "removeUnixFd" o = SourceRemoveUnixFdMethodInfo
ResolveSourceMethod "unref" o = SourceUnrefMethodInfo
ResolveSourceMethod "getCanRecurse" o = SourceGetCanRecurseMethodInfo
ResolveSourceMethod "getContext" o = SourceGetContextMethodInfo
ResolveSourceMethod "getCurrentTime" o = SourceGetCurrentTimeMethodInfo
ResolveSourceMethod "getId" o = SourceGetIdMethodInfo
ResolveSourceMethod "getName" o = SourceGetNameMethodInfo
ResolveSourceMethod "getPriority" o = SourceGetPriorityMethodInfo
ResolveSourceMethod "getReadyTime" o = SourceGetReadyTimeMethodInfo
ResolveSourceMethod "getTime" o = SourceGetTimeMethodInfo
ResolveSourceMethod "setCallback" o = SourceSetCallbackMethodInfo
ResolveSourceMethod "setCallbackIndirect" o = SourceSetCallbackIndirectMethodInfo
ResolveSourceMethod "setCanRecurse" o = SourceSetCanRecurseMethodInfo
ResolveSourceMethod "setFuncs" o = SourceSetFuncsMethodInfo
ResolveSourceMethod "setName" o = SourceSetNameMethodInfo
ResolveSourceMethod "setPriority" o = SourceSetPriorityMethodInfo
ResolveSourceMethod "setReadyTime" o = SourceSetReadyTimeMethodInfo
ResolveSourceMethod "setStaticName" o = SourceSetStaticNameMethodInfo
ResolveSourceMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveSourceMethod t Source, O.OverloadedMethod info Source p) => OL.IsLabel t (Source -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveSourceMethod t Source, O.OverloadedMethod info Source p, R.HasField t Source p) => R.HasField t Source p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveSourceMethod t Source, O.OverloadedMethodInfo info Source) => OL.IsLabel t (O.MethodProxy info Source) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif