{-# 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)
SourceClearReadyTimeMethodInfo ,
#endif
sourceClearReadyTime ,
#if defined(ENABLE_OVERLOADING)
SourceDestroyMethodInfo ,
#endif
sourceDestroy ,
#if defined(ENABLE_OVERLOADING)
SourceDupContextMethodInfo ,
#endif
sourceDupContext ,
#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)
SourceGetTimeNsMethodInfo ,
#endif
sourceGetTimeNs ,
#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)
SourceSetReadyTimeNsMethodInfo ,
#endif
sourceSetReadyTimeNs ,
#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.GHashTable as B.GHT
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.Kind as DK
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 Data.Word as DW
import qualified Data.Int as DI
import qualified Data.Bits as DB
import qualified System.Posix.Types as SPT
import qualified Foreign.C.Types as FCT
#if MIN_VERSION_base(4,18,0)
import qualified GI.GLib.Callbacks as GLib.Callbacks
import {-# SOURCE #-} qualified GI.GLib.Flags as GLib.Flags
import {-# SOURCE #-} qualified GI.GLib.Structs.Cond as GLib.Cond
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
import {-# SOURCE #-} qualified GI.GLib.Unions.Mutex as GLib.Mutex
#else
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
#endif
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
$c== :: Source -> Source -> Bool
== :: Source -> Source -> Bool
$c/= :: Source -> Source -> Bool
/= :: 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 <- Ptr GValue -> IO (Ptr Source)
forall b. Ptr GValue -> IO (Ptr b)
B.GValue.get_boxed Ptr GValue
gv :: IO (Ptr Source)
if ptr /= FP.nullPtr
then P.Just <$> B.ManagedPtr.newBoxed Source ptr
else return P.Nothing
newZeroSource :: MonadIO m => m Source
newZeroSource :: forall (m :: * -> *). MonadIO m => m Source
newZeroSource = IO Source -> m Source
forall a. IO a -> m a
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 a b. IO a -> (a -> IO b) -> IO b
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
o <- m Source
forall (m :: * -> *). MonadIO m => m Source
newZeroSource
GI.Attributes.set o attrs
return o
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Source
type instance O.AttributeList Source = SourceAttributeList
type SourceAttributeList = ('[ ] :: [(Symbol, DK.Type)])
#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 a. IO a -> m a
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
sourceFuncs' <- SourceFuncs -> IO (Ptr SourceFuncs)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SourceFuncs
sourceFuncs
result <- g_source_new sourceFuncs' structSize
checkUnexpectedReturnNULL "sourceNew" result
result' <- (wrapBoxed Source) result
touchManagedPtr sourceFuncs
return 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 a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
childSource' <- unsafeManagedPtrGetPtr childSource
g_source_add_child_source source' childSource'
touchManagedPtr source
touchManagedPtr childSource
return ()
#if defined(ENABLE_OVERLOADING)
data SourceAddChildSourceMethodInfo
instance (signature ~ (Source -> m ()), MonadIO m) => O.OverloadedMethod SourceAddChildSourceMethodInfo Source signature where
overloadedMethod :: Source -> signature
overloadedMethod = Source -> signature
Source -> Source -> m ()
forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> Source -> m ()
sourceAddChildSource
instance O.OverloadedMethodInfo SourceAddChildSourceMethodInfo Source where
overloadedMethodInfo :: Maybe ResolvedSymbolInfo
overloadedMethodInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.GLib.Structs.Source.sourceAddChildSource",
resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-glib-2.0.31/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 a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
fd' <- unsafeManagedPtrGetPtr fd
g_source_add_poll source' fd'
touchManagedPtr source
touchManagedPtr fd
return ()
#if defined(ENABLE_OVERLOADING)
data SourceAddPollMethodInfo
instance (signature ~ (GLib.PollFD.PollFD -> m ()), MonadIO m) => O.OverloadedMethod SourceAddPollMethodInfo Source signature where
overloadedMethod :: Source -> signature
overloadedMethod = Source -> signature
Source -> PollFD -> m ()
forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> PollFD -> m ()
sourceAddPoll
instance O.OverloadedMethodInfo SourceAddPollMethodInfo Source where
overloadedMethodInfo :: Maybe ResolvedSymbolInfo
overloadedMethodInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.GLib.Structs.Source.sourceAddPoll",
resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-glib-2.0.31/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 a. IO a -> m a
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
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
let events' = [IOCondition] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [IOCondition]
events
result <- g_source_add_unix_fd source' fd events'
touchManagedPtr source
return result
#if defined(ENABLE_OVERLOADING)
data SourceAddUnixFdMethodInfo
instance (signature ~ (Int32 -> [GLib.Flags.IOCondition] -> m (Ptr ())), MonadIO m) => O.OverloadedMethod SourceAddUnixFdMethodInfo Source signature where
overloadedMethod :: Source -> signature
overloadedMethod = Source -> signature
Source -> Int32 -> [IOCondition] -> m (Ptr ())
forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> Int32 -> [IOCondition] -> m (Ptr ())
sourceAddUnixFd
instance O.OverloadedMethodInfo SourceAddUnixFdMethodInfo Source where
overloadedMethodInfo :: Maybe ResolvedSymbolInfo
overloadedMethodInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.GLib.Structs.Source.sourceAddUnixFd",
resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-glib-2.0.31/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 a. IO a -> m a
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
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
maybeContext <- case context of
Maybe MainContext
Nothing -> Ptr MainContext -> IO (Ptr MainContext)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr MainContext
forall a. Ptr a
FP.nullPtr
Just MainContext
jContext -> do
jContext' <- MainContext -> IO (Ptr MainContext)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr MainContext
jContext
return jContext'
result <- g_source_attach source' maybeContext
touchManagedPtr source
whenJust context touchManagedPtr
return result
#if defined(ENABLE_OVERLOADING)
data SourceAttachMethodInfo
instance (signature ~ (Maybe (GLib.MainContext.MainContext) -> m Word32), MonadIO m) => O.OverloadedMethod SourceAttachMethodInfo Source signature where
overloadedMethod :: Source -> signature
overloadedMethod = Source -> signature
Source -> Maybe MainContext -> m Word32
forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> Maybe MainContext -> m Word32
sourceAttach
instance O.OverloadedMethodInfo SourceAttachMethodInfo Source where
overloadedMethodInfo :: Maybe ResolvedSymbolInfo
overloadedMethodInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.GLib.Structs.Source.sourceAttach",
resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-glib-2.0.31/docs/GI-GLib-Structs-Source.html#v:sourceAttach"
})
#endif
foreign import ccall "g_source_clear_ready_time" g_source_clear_ready_time ::
Ptr Source ->
IO ()
sourceClearReadyTime ::
(B.CallStack.HasCallStack, MonadIO m) =>
Source
-> m ()
sourceClearReadyTime :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Source -> m ()
sourceClearReadyTime Source
source = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
g_source_clear_ready_time source'
touchManagedPtr source
return ()
#if defined(ENABLE_OVERLOADING)
data SourceClearReadyTimeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.OverloadedMethod SourceClearReadyTimeMethodInfo Source signature where
overloadedMethod :: Source -> signature
overloadedMethod = Source -> signature
Source -> m ()
forall (m :: * -> *). (HasCallStack, MonadIO m) => Source -> m ()
sourceClearReadyTime
instance O.OverloadedMethodInfo SourceClearReadyTimeMethodInfo Source where
overloadedMethodInfo :: Maybe ResolvedSymbolInfo
overloadedMethodInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.GLib.Structs.Source.sourceClearReadyTime",
resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-glib-2.0.31/docs/GI-GLib-Structs-Source.html#v:sourceClearReadyTime"
})
#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 a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
g_source_destroy source'
touchManagedPtr source
return ()
#if defined(ENABLE_OVERLOADING)
data SourceDestroyMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.OverloadedMethod SourceDestroyMethodInfo Source signature where
overloadedMethod :: Source -> signature
overloadedMethod = Source -> signature
Source -> m ()
forall (m :: * -> *). (HasCallStack, MonadIO m) => Source -> m ()
sourceDestroy
instance O.OverloadedMethodInfo SourceDestroyMethodInfo Source where
overloadedMethodInfo :: Maybe ResolvedSymbolInfo
overloadedMethodInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.GLib.Structs.Source.sourceDestroy",
resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-glib-2.0.31/docs/GI-GLib-Structs-Source.html#v:sourceDestroy"
})
#endif
foreign import ccall "g_source_dup_context" g_source_dup_context ::
Ptr Source ->
IO (Ptr GLib.MainContext.MainContext)
sourceDupContext ::
(B.CallStack.HasCallStack, MonadIO m) =>
Source
-> m (Maybe GLib.MainContext.MainContext)
sourceDupContext :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> m (Maybe MainContext)
sourceDupContext Source
source = IO (Maybe MainContext) -> m (Maybe MainContext)
forall a. IO a -> m a
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
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
result <- g_source_dup_context source'
maybeResult <- convertIfNonNull result $ \Ptr MainContext
result' -> do
result'' <- ((ManagedPtr MainContext -> MainContext)
-> Ptr MainContext -> IO MainContext
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr MainContext -> MainContext
GLib.MainContext.MainContext) Ptr MainContext
result'
return result''
touchManagedPtr source
return maybeResult
#if defined(ENABLE_OVERLOADING)
data SourceDupContextMethodInfo
instance (signature ~ (m (Maybe GLib.MainContext.MainContext)), MonadIO m) => O.OverloadedMethod SourceDupContextMethodInfo Source signature where
overloadedMethod :: Source -> signature
overloadedMethod = Source -> signature
Source -> m (Maybe MainContext)
forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> m (Maybe MainContext)
sourceDupContext
instance O.OverloadedMethodInfo SourceDupContextMethodInfo Source where
overloadedMethodInfo :: Maybe ResolvedSymbolInfo
overloadedMethodInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.GLib.Structs.Source.sourceDupContext",
resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-glib-2.0.31/docs/GI-GLib-Structs-Source.html#v:sourceDupContext"
})
#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 a. IO a -> m a
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
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
result <- g_source_get_can_recurse source'
let result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
touchManagedPtr source
return result'
#if defined(ENABLE_OVERLOADING)
data SourceGetCanRecurseMethodInfo
instance (signature ~ (m Bool), MonadIO m) => O.OverloadedMethod SourceGetCanRecurseMethodInfo Source signature where
overloadedMethod :: Source -> signature
overloadedMethod = Source -> signature
Source -> m Bool
forall (m :: * -> *). (HasCallStack, MonadIO m) => Source -> m Bool
sourceGetCanRecurse
instance O.OverloadedMethodInfo SourceGetCanRecurseMethodInfo Source where
overloadedMethodInfo :: Maybe ResolvedSymbolInfo
overloadedMethodInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.GLib.Structs.Source.sourceGetCanRecurse",
resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-glib-2.0.31/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 a. IO a -> m a
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
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
result <- g_source_get_context source'
maybeResult <- convertIfNonNull result $ \Ptr MainContext
result' -> do
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'
return result''
touchManagedPtr source
return maybeResult
#if defined(ENABLE_OVERLOADING)
data SourceGetContextMethodInfo
instance (signature ~ (m (Maybe GLib.MainContext.MainContext)), MonadIO m) => O.OverloadedMethod SourceGetContextMethodInfo Source signature where
overloadedMethod :: Source -> signature
overloadedMethod = Source -> signature
Source -> m (Maybe MainContext)
forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> m (Maybe MainContext)
sourceGetContext
instance O.OverloadedMethodInfo SourceGetContextMethodInfo Source where
overloadedMethodInfo :: Maybe ResolvedSymbolInfo
overloadedMethodInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.GLib.Structs.Source.sourceGetContext",
resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-glib-2.0.31/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 a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
timeval' <- unsafeManagedPtrGetPtr timeval
g_source_get_current_time source' timeval'
touchManagedPtr source
touchManagedPtr timeval
return ()
#if defined(ENABLE_OVERLOADING)
data SourceGetCurrentTimeMethodInfo
instance (signature ~ (GLib.TimeVal.TimeVal -> m ()), MonadIO m) => O.OverloadedMethod SourceGetCurrentTimeMethodInfo Source signature where
overloadedMethod :: Source -> signature
overloadedMethod = Source -> signature
Source -> TimeVal -> m ()
forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> TimeVal -> m ()
sourceGetCurrentTime
instance O.OverloadedMethodInfo SourceGetCurrentTimeMethodInfo Source where
overloadedMethodInfo :: Maybe ResolvedSymbolInfo
overloadedMethodInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.GLib.Structs.Source.sourceGetCurrentTime",
resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-glib-2.0.31/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 a. IO a -> m a
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
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
result <- g_source_get_id source'
touchManagedPtr source
return result
#if defined(ENABLE_OVERLOADING)
data SourceGetIdMethodInfo
instance (signature ~ (m Word32), MonadIO m) => O.OverloadedMethod SourceGetIdMethodInfo Source signature where
overloadedMethod :: Source -> signature
overloadedMethod = Source -> signature
Source -> m Word32
forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> m Word32
sourceGetId
instance O.OverloadedMethodInfo SourceGetIdMethodInfo Source where
overloadedMethodInfo :: Maybe ResolvedSymbolInfo
overloadedMethodInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.GLib.Structs.Source.sourceGetId",
resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-glib-2.0.31/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 a. IO a -> m a
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
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
result <- g_source_get_name source'
maybeResult <- convertIfNonNull result $ \CString
result' -> do
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
return result''
touchManagedPtr source
return maybeResult
#if defined(ENABLE_OVERLOADING)
data SourceGetNameMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m) => O.OverloadedMethod SourceGetNameMethodInfo Source signature where
overloadedMethod :: Source -> signature
overloadedMethod = Source -> signature
Source -> m (Maybe Text)
forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> m (Maybe Text)
sourceGetName
instance O.OverloadedMethodInfo SourceGetNameMethodInfo Source where
overloadedMethodInfo :: Maybe ResolvedSymbolInfo
overloadedMethodInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.GLib.Structs.Source.sourceGetName",
resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-glib-2.0.31/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 a. IO a -> m a
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
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
result <- g_source_get_priority source'
touchManagedPtr source
return result
#if defined(ENABLE_OVERLOADING)
data SourceGetPriorityMethodInfo
instance (signature ~ (m Int32), MonadIO m) => O.OverloadedMethod SourceGetPriorityMethodInfo Source signature where
overloadedMethod :: Source -> signature
overloadedMethod = Source -> signature
Source -> m Int32
forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> m Int32
sourceGetPriority
instance O.OverloadedMethodInfo SourceGetPriorityMethodInfo Source where
overloadedMethodInfo :: Maybe ResolvedSymbolInfo
overloadedMethodInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.GLib.Structs.Source.sourceGetPriority",
resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-glib-2.0.31/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 a. IO a -> m a
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
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
result <- g_source_get_ready_time source'
touchManagedPtr source
return result
#if defined(ENABLE_OVERLOADING)
data SourceGetReadyTimeMethodInfo
instance (signature ~ (m Int64), MonadIO m) => O.OverloadedMethod SourceGetReadyTimeMethodInfo Source signature where
overloadedMethod :: Source -> signature
overloadedMethod = Source -> signature
Source -> m Int64
forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> m Int64
sourceGetReadyTime
instance O.OverloadedMethodInfo SourceGetReadyTimeMethodInfo Source where
overloadedMethodInfo :: Maybe ResolvedSymbolInfo
overloadedMethodInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.GLib.Structs.Source.sourceGetReadyTime",
resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-glib-2.0.31/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 a. IO a -> m a
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
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
result <- g_source_get_time source'
touchManagedPtr source
return result
#if defined(ENABLE_OVERLOADING)
data SourceGetTimeMethodInfo
instance (signature ~ (m Int64), MonadIO m) => O.OverloadedMethod SourceGetTimeMethodInfo Source signature where
overloadedMethod :: Source -> signature
overloadedMethod = Source -> signature
Source -> m Int64
forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> m Int64
sourceGetTime
instance O.OverloadedMethodInfo SourceGetTimeMethodInfo Source where
overloadedMethodInfo :: Maybe ResolvedSymbolInfo
overloadedMethodInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.GLib.Structs.Source.sourceGetTime",
resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-glib-2.0.31/docs/GI-GLib-Structs-Source.html#v:sourceGetTime"
})
#endif
foreign import ccall "g_source_get_time_ns" g_source_get_time_ns ::
Ptr Source ->
IO Word64
sourceGetTimeNs ::
(B.CallStack.HasCallStack, MonadIO m) =>
Source
-> m Word64
sourceGetTimeNs :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> m Word64
sourceGetTimeNs Source
source = IO Word64 -> m Word64
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word64 -> m Word64) -> IO Word64 -> m Word64
forall a b. (a -> b) -> a -> b
$ do
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
result <- g_source_get_time_ns source'
touchManagedPtr source
return result
#if defined(ENABLE_OVERLOADING)
data SourceGetTimeNsMethodInfo
instance (signature ~ (m Word64), MonadIO m) => O.OverloadedMethod SourceGetTimeNsMethodInfo Source signature where
overloadedMethod :: Source -> signature
overloadedMethod = Source -> signature
Source -> m Word64
forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> m Word64
sourceGetTimeNs
instance O.OverloadedMethodInfo SourceGetTimeNsMethodInfo Source where
overloadedMethodInfo :: Maybe ResolvedSymbolInfo
overloadedMethodInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.GLib.Structs.Source.sourceGetTimeNs",
resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-glib-2.0.31/docs/GI-GLib-Structs-Source.html#v:sourceGetTimeNs"
})
#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 a. IO a -> m a
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
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
result <- g_source_is_destroyed source'
let result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
touchManagedPtr source
return result'
#if defined(ENABLE_OVERLOADING)
data SourceIsDestroyedMethodInfo
instance (signature ~ (m Bool), MonadIO m) => O.OverloadedMethod SourceIsDestroyedMethodInfo Source signature where
overloadedMethod :: Source -> signature
overloadedMethod = Source -> signature
Source -> m Bool
forall (m :: * -> *). (HasCallStack, MonadIO m) => Source -> m Bool
sourceIsDestroyed
instance O.OverloadedMethodInfo SourceIsDestroyedMethodInfo Source where
overloadedMethodInfo :: Maybe ResolvedSymbolInfo
overloadedMethodInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.GLib.Structs.Source.sourceIsDestroyed",
resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-glib-2.0.31/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 a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
let newEvents' = [IOCondition] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [IOCondition]
newEvents
g_source_modify_unix_fd source' tag newEvents'
touchManagedPtr source
return ()
#if defined(ENABLE_OVERLOADING)
data SourceModifyUnixFdMethodInfo
instance (signature ~ (Ptr () -> [GLib.Flags.IOCondition] -> m ()), MonadIO m) => O.OverloadedMethod SourceModifyUnixFdMethodInfo Source signature where
overloadedMethod :: Source -> signature
overloadedMethod = Source -> signature
Source -> Ptr () -> [IOCondition] -> m ()
forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> Ptr () -> [IOCondition] -> m ()
sourceModifyUnixFd
instance O.OverloadedMethodInfo SourceModifyUnixFdMethodInfo Source where
overloadedMethodInfo :: Maybe ResolvedSymbolInfo
overloadedMethodInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.GLib.Structs.Source.sourceModifyUnixFd",
resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-glib-2.0.31/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 a. IO a -> m a
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
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
result <- g_source_query_unix_fd source' tag
let result' = CUInt -> [IOCondition]
forall a b. (Storable a, Integral a, Bits a, IsGFlag b) => a -> [b]
wordToGFlags CUInt
result
touchManagedPtr source
return result'
#if defined(ENABLE_OVERLOADING)
data SourceQueryUnixFdMethodInfo
instance (signature ~ (Ptr () -> m [GLib.Flags.IOCondition]), MonadIO m) => O.OverloadedMethod SourceQueryUnixFdMethodInfo Source signature where
overloadedMethod :: Source -> signature
overloadedMethod = Source -> signature
Source -> Ptr () -> m [IOCondition]
forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> Ptr () -> m [IOCondition]
sourceQueryUnixFd
instance O.OverloadedMethodInfo SourceQueryUnixFdMethodInfo Source where
overloadedMethodInfo :: Maybe ResolvedSymbolInfo
overloadedMethodInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.GLib.Structs.Source.sourceQueryUnixFd",
resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-glib-2.0.31/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 a. IO a -> m a
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
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
result <- g_source_ref source'
checkUnexpectedReturnNULL "sourceRef" result
result' <- (wrapBoxed Source) result
touchManagedPtr source
return result'
#if defined(ENABLE_OVERLOADING)
data SourceRefMethodInfo
instance (signature ~ (m Source), MonadIO m) => O.OverloadedMethod SourceRefMethodInfo Source signature where
overloadedMethod :: Source -> signature
overloadedMethod = Source -> signature
Source -> m Source
forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> m Source
sourceRef
instance O.OverloadedMethodInfo SourceRefMethodInfo Source where
overloadedMethodInfo :: Maybe ResolvedSymbolInfo
overloadedMethodInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.GLib.Structs.Source.sourceRef",
resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-glib-2.0.31/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 a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
childSource' <- unsafeManagedPtrGetPtr childSource
g_source_remove_child_source source' childSource'
touchManagedPtr source
touchManagedPtr childSource
return ()
#if defined(ENABLE_OVERLOADING)
data SourceRemoveChildSourceMethodInfo
instance (signature ~ (Source -> m ()), MonadIO m) => O.OverloadedMethod SourceRemoveChildSourceMethodInfo Source signature where
overloadedMethod :: Source -> signature
overloadedMethod = Source -> signature
Source -> Source -> m ()
forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> Source -> m ()
sourceRemoveChildSource
instance O.OverloadedMethodInfo SourceRemoveChildSourceMethodInfo Source where
overloadedMethodInfo :: Maybe ResolvedSymbolInfo
overloadedMethodInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.GLib.Structs.Source.sourceRemoveChildSource",
resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-glib-2.0.31/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 a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
fd' <- unsafeManagedPtrGetPtr fd
g_source_remove_poll source' fd'
touchManagedPtr source
touchManagedPtr fd
return ()
#if defined(ENABLE_OVERLOADING)
data SourceRemovePollMethodInfo
instance (signature ~ (GLib.PollFD.PollFD -> m ()), MonadIO m) => O.OverloadedMethod SourceRemovePollMethodInfo Source signature where
overloadedMethod :: Source -> signature
overloadedMethod = Source -> signature
Source -> PollFD -> m ()
forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> PollFD -> m ()
sourceRemovePoll
instance O.OverloadedMethodInfo SourceRemovePollMethodInfo Source where
overloadedMethodInfo :: Maybe ResolvedSymbolInfo
overloadedMethodInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.GLib.Structs.Source.sourceRemovePoll",
resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-glib-2.0.31/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 a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
g_source_remove_unix_fd source' tag
touchManagedPtr source
return ()
#if defined(ENABLE_OVERLOADING)
data SourceRemoveUnixFdMethodInfo
instance (signature ~ (Ptr () -> m ()), MonadIO m) => O.OverloadedMethod SourceRemoveUnixFdMethodInfo Source signature where
overloadedMethod :: Source -> signature
overloadedMethod = Source -> signature
Source -> Ptr () -> m ()
forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> Ptr () -> m ()
sourceRemoveUnixFd
instance O.OverloadedMethodInfo SourceRemoveUnixFdMethodInfo Source where
overloadedMethodInfo :: Maybe ResolvedSymbolInfo
overloadedMethodInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.GLib.Structs.Source.sourceRemoveUnixFd",
resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-glib-2.0.31/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 a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
func' <- GLib.Callbacks.mk_SourceFunc (GLib.Callbacks.wrap_SourceFunc Nothing (GLib.Callbacks.drop_closures_SourceFunc func))
let data_ = FunPtr C_SourceFunc -> Ptr ()
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr FunPtr C_SourceFunc
func'
let notify = FunPtr (Ptr a -> IO ())
forall a. FunPtr (Ptr a -> IO ())
SP.safeFreeFunPtrPtr
g_source_set_callback source' func' data_ notify
touchManagedPtr source
return ()
#if defined(ENABLE_OVERLOADING)
data SourceSetCallbackMethodInfo
instance (signature ~ (GLib.Callbacks.SourceFunc -> m ()), MonadIO m) => O.OverloadedMethod SourceSetCallbackMethodInfo Source signature where
overloadedMethod :: Source -> signature
overloadedMethod = Source -> signature
Source -> IO Bool -> m ()
forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> IO Bool -> m ()
sourceSetCallback
instance O.OverloadedMethodInfo SourceSetCallbackMethodInfo Source where
overloadedMethodInfo :: Maybe ResolvedSymbolInfo
overloadedMethodInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.GLib.Structs.Source.sourceSetCallback",
resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-glib-2.0.31/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 a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
callbackFuncs' <- unsafeManagedPtrGetPtr callbackFuncs
g_source_set_callback_indirect source' callbackData callbackFuncs'
touchManagedPtr source
touchManagedPtr callbackFuncs
return ()
#if defined(ENABLE_OVERLOADING)
data SourceSetCallbackIndirectMethodInfo
instance (signature ~ (Ptr () -> GLib.SourceCallbackFuncs.SourceCallbackFuncs -> m ()), MonadIO m) => O.OverloadedMethod SourceSetCallbackIndirectMethodInfo Source signature where
overloadedMethod :: Source -> signature
overloadedMethod = Source -> signature
Source -> Ptr () -> SourceCallbackFuncs -> m ()
forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> Ptr () -> SourceCallbackFuncs -> m ()
sourceSetCallbackIndirect
instance O.OverloadedMethodInfo SourceSetCallbackIndirectMethodInfo Source where
overloadedMethodInfo :: Maybe ResolvedSymbolInfo
overloadedMethodInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.GLib.Structs.Source.sourceSetCallbackIndirect",
resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-glib-2.0.31/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 a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
let canRecurse' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
P.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
P.fromEnum) Bool
canRecurse
g_source_set_can_recurse source' canRecurse'
touchManagedPtr source
return ()
#if defined(ENABLE_OVERLOADING)
data SourceSetCanRecurseMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m) => O.OverloadedMethod SourceSetCanRecurseMethodInfo Source signature where
overloadedMethod :: Source -> signature
overloadedMethod = Source -> signature
Source -> Bool -> m ()
forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> Bool -> m ()
sourceSetCanRecurse
instance O.OverloadedMethodInfo SourceSetCanRecurseMethodInfo Source where
overloadedMethodInfo :: Maybe ResolvedSymbolInfo
overloadedMethodInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.GLib.Structs.Source.sourceSetCanRecurse",
resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-glib-2.0.31/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 a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
funcs' <- unsafeManagedPtrGetPtr funcs
g_source_set_funcs source' funcs'
touchManagedPtr source
touchManagedPtr funcs
return ()
#if defined(ENABLE_OVERLOADING)
data SourceSetFuncsMethodInfo
instance (signature ~ (GLib.SourceFuncs.SourceFuncs -> m ()), MonadIO m) => O.OverloadedMethod SourceSetFuncsMethodInfo Source signature where
overloadedMethod :: Source -> signature
overloadedMethod = Source -> signature
Source -> SourceFuncs -> m ()
forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> SourceFuncs -> m ()
sourceSetFuncs
instance O.OverloadedMethodInfo SourceSetFuncsMethodInfo Source where
overloadedMethodInfo :: Maybe ResolvedSymbolInfo
overloadedMethodInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.GLib.Structs.Source.sourceSetFuncs",
resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-glib-2.0.31/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 a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
name' <- textToCString name
g_source_set_name source' name'
touchManagedPtr source
freeMem name'
return ()
#if defined(ENABLE_OVERLOADING)
data SourceSetNameMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m) => O.OverloadedMethod SourceSetNameMethodInfo Source signature where
overloadedMethod :: Source -> signature
overloadedMethod = Source -> signature
Source -> Text -> m ()
forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> Text -> m ()
sourceSetName
instance O.OverloadedMethodInfo SourceSetNameMethodInfo Source where
overloadedMethodInfo :: Maybe ResolvedSymbolInfo
overloadedMethodInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.GLib.Structs.Source.sourceSetName",
resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-glib-2.0.31/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 a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
g_source_set_priority source' priority
touchManagedPtr source
return ()
#if defined(ENABLE_OVERLOADING)
data SourceSetPriorityMethodInfo
instance (signature ~ (Int32 -> m ()), MonadIO m) => O.OverloadedMethod SourceSetPriorityMethodInfo Source signature where
overloadedMethod :: Source -> signature
overloadedMethod = Source -> signature
Source -> Int32 -> m ()
forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> Int32 -> m ()
sourceSetPriority
instance O.OverloadedMethodInfo SourceSetPriorityMethodInfo Source where
overloadedMethodInfo :: Maybe ResolvedSymbolInfo
overloadedMethodInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.GLib.Structs.Source.sourceSetPriority",
resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-glib-2.0.31/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 a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
g_source_set_ready_time source' readyTime
touchManagedPtr source
return ()
#if defined(ENABLE_OVERLOADING)
data SourceSetReadyTimeMethodInfo
instance (signature ~ (Int64 -> m ()), MonadIO m) => O.OverloadedMethod SourceSetReadyTimeMethodInfo Source signature where
overloadedMethod :: Source -> signature
overloadedMethod = Source -> signature
Source -> Int64 -> m ()
forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> Int64 -> m ()
sourceSetReadyTime
instance O.OverloadedMethodInfo SourceSetReadyTimeMethodInfo Source where
overloadedMethodInfo :: Maybe ResolvedSymbolInfo
overloadedMethodInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.GLib.Structs.Source.sourceSetReadyTime",
resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-glib-2.0.31/docs/GI-GLib-Structs-Source.html#v:sourceSetReadyTime"
})
#endif
foreign import ccall "g_source_set_ready_time_ns" g_source_set_ready_time_ns ::
Ptr Source ->
Word64 ->
IO ()
sourceSetReadyTimeNs ::
(B.CallStack.HasCallStack, MonadIO m) =>
Source
-> Word64
-> m ()
sourceSetReadyTimeNs :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> Word64 -> m ()
sourceSetReadyTimeNs Source
source Word64
readyTime = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
g_source_set_ready_time_ns source' readyTime
touchManagedPtr source
return ()
#if defined(ENABLE_OVERLOADING)
data SourceSetReadyTimeNsMethodInfo
instance (signature ~ (Word64 -> m ()), MonadIO m) => O.OverloadedMethod SourceSetReadyTimeNsMethodInfo Source signature where
overloadedMethod :: Source -> signature
overloadedMethod = Source -> signature
Source -> Word64 -> m ()
forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> Word64 -> m ()
sourceSetReadyTimeNs
instance O.OverloadedMethodInfo SourceSetReadyTimeNsMethodInfo Source where
overloadedMethodInfo :: Maybe ResolvedSymbolInfo
overloadedMethodInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.GLib.Structs.Source.sourceSetReadyTimeNs",
resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-glib-2.0.31/docs/GI-GLib-Structs-Source.html#v:sourceSetReadyTimeNs"
})
#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 a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
name' <- textToCString name
g_source_set_static_name source' name'
touchManagedPtr source
freeMem name'
return ()
#if defined(ENABLE_OVERLOADING)
data SourceSetStaticNameMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m) => O.OverloadedMethod SourceSetStaticNameMethodInfo Source signature where
overloadedMethod :: Source -> signature
overloadedMethod = Source -> signature
Source -> Text -> m ()
forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Source -> Text -> m ()
sourceSetStaticName
instance O.OverloadedMethodInfo SourceSetStaticNameMethodInfo Source where
overloadedMethodInfo :: Maybe ResolvedSymbolInfo
overloadedMethodInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.GLib.Structs.Source.sourceSetStaticName",
resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-glib-2.0.31/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 a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
source' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
source
g_source_unref source'
touchManagedPtr source
return ()
#if defined(ENABLE_OVERLOADING)
data SourceUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.OverloadedMethod SourceUnrefMethodInfo Source signature where
overloadedMethod :: Source -> signature
overloadedMethod = Source -> signature
Source -> m ()
forall (m :: * -> *). (HasCallStack, MonadIO m) => Source -> m ()
sourceUnref
instance O.OverloadedMethodInfo SourceUnrefMethodInfo Source where
overloadedMethodInfo :: Maybe ResolvedSymbolInfo
overloadedMethodInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.GLib.Structs.Source.sourceUnref",
resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-glib-2.0.31/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 a. IO a -> m a
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
result <- Word32 -> IO CInt
g_source_remove Word32
tag
let result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
return 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 a. IO a -> m a
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
funcs' <- SourceFuncs -> IO (Ptr SourceFuncs)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SourceFuncs
funcs
result <- g_source_remove_by_funcs_user_data funcs' userData
let result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
touchManagedPtr funcs
return 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 a. IO a -> m a
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
result <- C_SourceFunc
g_source_remove_by_user_data Ptr ()
userData
let result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
return 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 a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
name' <- Text -> IO CString
textToCString Text
name
g_source_set_name_by_id tag name'
freeMem name'
return ()
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveSourceMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
ResolveSourceMethod "addChildSource" o = SourceAddChildSourceMethodInfo
ResolveSourceMethod "addPoll" o = SourceAddPollMethodInfo
ResolveSourceMethod "addUnixFd" o = SourceAddUnixFdMethodInfo
ResolveSourceMethod "attach" o = SourceAttachMethodInfo
ResolveSourceMethod "clearReadyTime" o = SourceClearReadyTimeMethodInfo
ResolveSourceMethod "destroy" o = SourceDestroyMethodInfo
ResolveSourceMethod "dupContext" o = SourceDupContextMethodInfo
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 "getTimeNs" o = SourceGetTimeNsMethodInfo
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 "setReadyTimeNs" o = SourceSetReadyTimeNsMethodInfo
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 :: Source -> p
fromLabel = forall {k} (i :: k) o s. OverloadedMethod i o s => o -> s
forall i o s. OverloadedMethod i o s => o -> s
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 :: Source -> p
getField = forall {k} (i :: k) o s. OverloadedMethod i o s => o -> s
forall i o s. OverloadedMethod i o s => o -> s
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 :: MethodProxy info Source
fromLabel = MethodProxy info Source
forall info obj. MethodProxy info obj
O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif