gi-glib-0.2.46.12: GI/GLib/Structs/Source.hs
{- |
Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
The `GSource` struct is an opaque data type
representing an event source.
-}
module GI.GLib.Structs.Source
(
-- * Exported types
Source(..) ,
noSource ,
-- * Methods
-- ** sourceAddChildSource
sourceAddChildSource ,
-- ** sourceAddPoll
sourceAddPoll ,
-- ** sourceAttach
sourceAttach ,
-- ** sourceDestroy
sourceDestroy ,
-- ** sourceGetCanRecurse
sourceGetCanRecurse ,
-- ** sourceGetContext
sourceGetContext ,
-- ** sourceGetCurrentTime
sourceGetCurrentTime ,
-- ** sourceGetId
sourceGetId ,
-- ** sourceGetName
sourceGetName ,
-- ** sourceGetPriority
sourceGetPriority ,
-- ** sourceGetReadyTime
sourceGetReadyTime ,
-- ** sourceGetTime
sourceGetTime ,
-- ** sourceIsDestroyed
sourceIsDestroyed ,
-- ** sourceModifyUnixFd
sourceModifyUnixFd ,
-- ** sourceNew
sourceNew ,
-- ** sourceQueryUnixFd
sourceQueryUnixFd ,
-- ** sourceRef
sourceRef ,
-- ** sourceRemoveChildSource
sourceRemoveChildSource ,
-- ** sourceRemovePoll
sourceRemovePoll ,
-- ** sourceRemoveUnixFd
sourceRemoveUnixFd ,
-- ** sourceSetCallback
sourceSetCallback ,
-- ** sourceSetCallbackIndirect
sourceSetCallbackIndirect ,
-- ** sourceSetCanRecurse
sourceSetCanRecurse ,
-- ** sourceSetFuncs
sourceSetFuncs ,
-- ** sourceSetName
sourceSetName ,
-- ** sourceSetPriority
sourceSetPriority ,
-- ** sourceSetReadyTime
sourceSetReadyTime ,
-- ** sourceUnref
sourceUnref ,
) where
import Prelude ()
import Data.GI.Base.ShortPrelude
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import GI.GLib.Types
import GI.GLib.Callbacks
newtype Source = Source (ForeignPtr Source)
foreign import ccall "g_source_get_type" c_g_source_get_type ::
IO GType
instance BoxedObject Source where
boxedType _ = c_g_source_get_type
noSource :: Maybe Source
noSource = Nothing
-- method Source::new
-- method type : Constructor
-- Args : [Arg {argName = "source_funcs", argType = TInterface "GLib" "SourceFuncs", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "struct_size", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "source_funcs", argType = TInterface "GLib" "SourceFuncs", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "struct_size", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "GLib" "Source"
-- throws : False
-- Skip return : False
foreign import ccall "g_source_new" g_source_new ::
Ptr SourceFuncs -> -- source_funcs : TInterface "GLib" "SourceFuncs"
Word32 -> -- struct_size : TBasicType TUInt32
IO (Ptr Source)
sourceNew ::
(MonadIO m) =>
SourceFuncs -> -- source_funcs
Word32 -> -- struct_size
m Source
sourceNew source_funcs struct_size = liftIO $ do
let source_funcs' = unsafeManagedPtrGetPtr source_funcs
result <- g_source_new source_funcs' struct_size
checkUnexpectedReturnNULL "g_source_new" result
result' <- (wrapBoxed Source) result
touchManagedPtr source_funcs
return result'
-- method Source::add_child_source
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "child_source", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "child_source", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_source_add_child_source" g_source_add_child_source ::
Ptr Source -> -- _obj : TInterface "GLib" "Source"
Ptr Source -> -- child_source : TInterface "GLib" "Source"
IO ()
sourceAddChildSource ::
(MonadIO m) =>
Source -> -- _obj
Source -> -- child_source
m ()
sourceAddChildSource _obj child_source = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
let child_source' = unsafeManagedPtrGetPtr child_source
g_source_add_child_source _obj' child_source'
touchManagedPtr _obj
touchManagedPtr child_source
return ()
-- method Source::add_poll
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "fd", argType = TInterface "GLib" "PollFD", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "fd", argType = TInterface "GLib" "PollFD", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_source_add_poll" g_source_add_poll ::
Ptr Source -> -- _obj : TInterface "GLib" "Source"
Ptr PollFD -> -- fd : TInterface "GLib" "PollFD"
IO ()
sourceAddPoll ::
(MonadIO m) =>
Source -> -- _obj
PollFD -> -- fd
m ()
sourceAddPoll _obj fd = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
let fd' = unsafeManagedPtrGetPtr fd
g_source_add_poll _obj' fd'
touchManagedPtr _obj
touchManagedPtr fd
return ()
-- method Source::attach
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "context", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "context", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUInt32
-- throws : False
-- Skip return : False
foreign import ccall "g_source_attach" g_source_attach ::
Ptr Source -> -- _obj : TInterface "GLib" "Source"
Ptr MainContext -> -- context : TInterface "GLib" "MainContext"
IO Word32
sourceAttach ::
(MonadIO m) =>
Source -> -- _obj
Maybe (MainContext) -> -- context
m Word32
sourceAttach _obj context = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
maybeContext <- case context of
Nothing -> return nullPtr
Just jContext -> do
let jContext' = unsafeManagedPtrGetPtr jContext
return jContext'
result <- g_source_attach _obj' maybeContext
touchManagedPtr _obj
whenJust context touchManagedPtr
return result
-- method Source::destroy
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_source_destroy" g_source_destroy ::
Ptr Source -> -- _obj : TInterface "GLib" "Source"
IO ()
sourceDestroy ::
(MonadIO m) =>
Source -> -- _obj
m ()
sourceDestroy _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
g_source_destroy _obj'
touchManagedPtr _obj
return ()
-- method Source::get_can_recurse
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False
foreign import ccall "g_source_get_can_recurse" g_source_get_can_recurse ::
Ptr Source -> -- _obj : TInterface "GLib" "Source"
IO CInt
sourceGetCanRecurse ::
(MonadIO m) =>
Source -> -- _obj
m Bool
sourceGetCanRecurse _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
result <- g_source_get_can_recurse _obj'
let result' = (/= 0) result
touchManagedPtr _obj
return result'
-- method Source::get_context
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "GLib" "MainContext"
-- throws : False
-- Skip return : False
foreign import ccall "g_source_get_context" g_source_get_context ::
Ptr Source -> -- _obj : TInterface "GLib" "Source"
IO (Ptr MainContext)
sourceGetContext ::
(MonadIO m) =>
Source -> -- _obj
m MainContext
sourceGetContext _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
result <- g_source_get_context _obj'
checkUnexpectedReturnNULL "g_source_get_context" result
result' <- (newBoxed MainContext) result
touchManagedPtr _obj
return result'
-- method Source::get_current_time
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "timeval", argType = TInterface "GLib" "TimeVal", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "timeval", argType = TInterface "GLib" "TimeVal", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_source_get_current_time" g_source_get_current_time ::
Ptr Source -> -- _obj : TInterface "GLib" "Source"
Ptr TimeVal -> -- timeval : TInterface "GLib" "TimeVal"
IO ()
{-# DEPRECATED sourceGetCurrentTime ["(Since version 2.28)","use g_source_get_time() instead"]#-}
sourceGetCurrentTime ::
(MonadIO m) =>
Source -> -- _obj
TimeVal -> -- timeval
m ()
sourceGetCurrentTime _obj timeval = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
let timeval' = unsafeManagedPtrGetPtr timeval
g_source_get_current_time _obj' timeval'
touchManagedPtr _obj
touchManagedPtr timeval
return ()
-- method Source::get_id
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUInt32
-- throws : False
-- Skip return : False
foreign import ccall "g_source_get_id" g_source_get_id ::
Ptr Source -> -- _obj : TInterface "GLib" "Source"
IO Word32
sourceGetId ::
(MonadIO m) =>
Source -> -- _obj
m Word32
sourceGetId _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
result <- g_source_get_id _obj'
touchManagedPtr _obj
return result
-- method Source::get_name
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False
foreign import ccall "g_source_get_name" g_source_get_name ::
Ptr Source -> -- _obj : TInterface "GLib" "Source"
IO CString
sourceGetName ::
(MonadIO m) =>
Source -> -- _obj
m T.Text
sourceGetName _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
result <- g_source_get_name _obj'
checkUnexpectedReturnNULL "g_source_get_name" result
result' <- cstringToText result
touchManagedPtr _obj
return result'
-- method Source::get_priority
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TInt32
-- throws : False
-- Skip return : False
foreign import ccall "g_source_get_priority" g_source_get_priority ::
Ptr Source -> -- _obj : TInterface "GLib" "Source"
IO Int32
sourceGetPriority ::
(MonadIO m) =>
Source -> -- _obj
m Int32
sourceGetPriority _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
result <- g_source_get_priority _obj'
touchManagedPtr _obj
return result
-- method Source::get_ready_time
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TInt64
-- throws : False
-- Skip return : False
foreign import ccall "g_source_get_ready_time" g_source_get_ready_time ::
Ptr Source -> -- _obj : TInterface "GLib" "Source"
IO Int64
sourceGetReadyTime ::
(MonadIO m) =>
Source -> -- _obj
m Int64
sourceGetReadyTime _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
result <- g_source_get_ready_time _obj'
touchManagedPtr _obj
return result
-- method Source::get_time
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TInt64
-- throws : False
-- Skip return : False
foreign import ccall "g_source_get_time" g_source_get_time ::
Ptr Source -> -- _obj : TInterface "GLib" "Source"
IO Int64
sourceGetTime ::
(MonadIO m) =>
Source -> -- _obj
m Int64
sourceGetTime _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
result <- g_source_get_time _obj'
touchManagedPtr _obj
return result
-- method Source::is_destroyed
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False
foreign import ccall "g_source_is_destroyed" g_source_is_destroyed ::
Ptr Source -> -- _obj : TInterface "GLib" "Source"
IO CInt
sourceIsDestroyed ::
(MonadIO m) =>
Source -> -- _obj
m Bool
sourceIsDestroyed _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
result <- g_source_is_destroyed _obj'
let result' = (/= 0) result
touchManagedPtr _obj
return result'
-- method Source::modify_unix_fd
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "tag", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "new_events", argType = TInterface "GLib" "IOCondition", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "tag", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "new_events", argType = TInterface "GLib" "IOCondition", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_source_modify_unix_fd" g_source_modify_unix_fd ::
Ptr Source -> -- _obj : TInterface "GLib" "Source"
Ptr () -> -- tag : TBasicType TVoid
CUInt -> -- new_events : TInterface "GLib" "IOCondition"
IO ()
sourceModifyUnixFd ::
(MonadIO m) =>
Source -> -- _obj
Ptr () -> -- tag
[IOCondition] -> -- new_events
m ()
sourceModifyUnixFd _obj tag new_events = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
let new_events' = gflagsToWord new_events
g_source_modify_unix_fd _obj' tag new_events'
touchManagedPtr _obj
return ()
-- method Source::query_unix_fd
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "tag", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "tag", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "GLib" "IOCondition"
-- throws : False
-- Skip return : False
foreign import ccall "g_source_query_unix_fd" g_source_query_unix_fd ::
Ptr Source -> -- _obj : TInterface "GLib" "Source"
Ptr () -> -- tag : TBasicType TVoid
IO CUInt
sourceQueryUnixFd ::
(MonadIO m) =>
Source -> -- _obj
Ptr () -> -- tag
m [IOCondition]
sourceQueryUnixFd _obj tag = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
result <- g_source_query_unix_fd _obj' tag
let result' = wordToGFlags result
touchManagedPtr _obj
return result'
-- method Source::ref
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "GLib" "Source"
-- throws : False
-- Skip return : False
foreign import ccall "g_source_ref" g_source_ref ::
Ptr Source -> -- _obj : TInterface "GLib" "Source"
IO (Ptr Source)
sourceRef ::
(MonadIO m) =>
Source -> -- _obj
m Source
sourceRef _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
result <- g_source_ref _obj'
checkUnexpectedReturnNULL "g_source_ref" result
result' <- (wrapBoxed Source) result
touchManagedPtr _obj
return result'
-- method Source::remove_child_source
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "child_source", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "child_source", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_source_remove_child_source" g_source_remove_child_source ::
Ptr Source -> -- _obj : TInterface "GLib" "Source"
Ptr Source -> -- child_source : TInterface "GLib" "Source"
IO ()
sourceRemoveChildSource ::
(MonadIO m) =>
Source -> -- _obj
Source -> -- child_source
m ()
sourceRemoveChildSource _obj child_source = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
let child_source' = unsafeManagedPtrGetPtr child_source
g_source_remove_child_source _obj' child_source'
touchManagedPtr _obj
touchManagedPtr child_source
return ()
-- method Source::remove_poll
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "fd", argType = TInterface "GLib" "PollFD", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "fd", argType = TInterface "GLib" "PollFD", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_source_remove_poll" g_source_remove_poll ::
Ptr Source -> -- _obj : TInterface "GLib" "Source"
Ptr PollFD -> -- fd : TInterface "GLib" "PollFD"
IO ()
sourceRemovePoll ::
(MonadIO m) =>
Source -> -- _obj
PollFD -> -- fd
m ()
sourceRemovePoll _obj fd = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
let fd' = unsafeManagedPtrGetPtr fd
g_source_remove_poll _obj' fd'
touchManagedPtr _obj
touchManagedPtr fd
return ()
-- method Source::remove_unix_fd
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "tag", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "tag", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_source_remove_unix_fd" g_source_remove_unix_fd ::
Ptr Source -> -- _obj : TInterface "GLib" "Source"
Ptr () -> -- tag : TBasicType TVoid
IO ()
sourceRemoveUnixFd ::
(MonadIO m) =>
Source -> -- _obj
Ptr () -> -- tag
m ()
sourceRemoveUnixFd _obj tag = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
g_source_remove_unix_fd _obj' tag
touchManagedPtr _obj
return ()
-- method Source::set_callback
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "func", argType = TInterface "GLib" "SourceFunc", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeNotified, argClosure = 2, argDestroy = 3, transfer = TransferNothing},Arg {argName = "data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "notify", argType = TInterface "GLib" "DestroyNotify", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "func", argType = TInterface "GLib" "SourceFunc", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeNotified, argClosure = 2, argDestroy = 3, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_source_set_callback" g_source_set_callback ::
Ptr Source -> -- _obj : TInterface "GLib" "Source"
FunPtr SourceFuncC -> -- func : TInterface "GLib" "SourceFunc"
Ptr () -> -- data : TBasicType TVoid
FunPtr DestroyNotifyC -> -- notify : TInterface "GLib" "DestroyNotify"
IO ()
sourceSetCallback ::
(MonadIO m) =>
Source -> -- _obj
SourceFunc -> -- func
m ()
sourceSetCallback _obj func = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
func' <- mkSourceFunc (sourceFuncWrapper Nothing func)
let data_ = castFunPtrToPtr func'
let notify = safeFreeFunPtrPtr
g_source_set_callback _obj' func' data_ notify
touchManagedPtr _obj
return ()
-- method Source::set_callback_indirect
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback_funcs", argType = TInterface "GLib" "SourceCallbackFuncs", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback_funcs", argType = TInterface "GLib" "SourceCallbackFuncs", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_source_set_callback_indirect" g_source_set_callback_indirect ::
Ptr Source -> -- _obj : TInterface "GLib" "Source"
Ptr () -> -- callback_data : TBasicType TVoid
Ptr SourceCallbackFuncs -> -- callback_funcs : TInterface "GLib" "SourceCallbackFuncs"
IO ()
sourceSetCallbackIndirect ::
(MonadIO m) =>
Source -> -- _obj
Ptr () -> -- callback_data
SourceCallbackFuncs -> -- callback_funcs
m ()
sourceSetCallbackIndirect _obj callback_data callback_funcs = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
let callback_funcs' = unsafeManagedPtrGetPtr callback_funcs
g_source_set_callback_indirect _obj' callback_data callback_funcs'
touchManagedPtr _obj
touchManagedPtr callback_funcs
return ()
-- method Source::set_can_recurse
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "can_recurse", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "can_recurse", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_source_set_can_recurse" g_source_set_can_recurse ::
Ptr Source -> -- _obj : TInterface "GLib" "Source"
CInt -> -- can_recurse : TBasicType TBoolean
IO ()
sourceSetCanRecurse ::
(MonadIO m) =>
Source -> -- _obj
Bool -> -- can_recurse
m ()
sourceSetCanRecurse _obj can_recurse = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
let can_recurse' = (fromIntegral . fromEnum) can_recurse
g_source_set_can_recurse _obj' can_recurse'
touchManagedPtr _obj
return ()
-- method Source::set_funcs
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "funcs", argType = TInterface "GLib" "SourceFuncs", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "funcs", argType = TInterface "GLib" "SourceFuncs", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_source_set_funcs" g_source_set_funcs ::
Ptr Source -> -- _obj : TInterface "GLib" "Source"
Ptr SourceFuncs -> -- funcs : TInterface "GLib" "SourceFuncs"
IO ()
sourceSetFuncs ::
(MonadIO m) =>
Source -> -- _obj
SourceFuncs -> -- funcs
m ()
sourceSetFuncs _obj funcs = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
let funcs' = unsafeManagedPtrGetPtr funcs
g_source_set_funcs _obj' funcs'
touchManagedPtr _obj
touchManagedPtr funcs
return ()
-- method Source::set_name
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_source_set_name" g_source_set_name ::
Ptr Source -> -- _obj : TInterface "GLib" "Source"
CString -> -- name : TBasicType TUTF8
IO ()
sourceSetName ::
(MonadIO m) =>
Source -> -- _obj
T.Text -> -- name
m ()
sourceSetName _obj name = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
name' <- textToCString name
g_source_set_name _obj' name'
touchManagedPtr _obj
freeMem name'
return ()
-- method Source::set_priority
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "priority", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "priority", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_source_set_priority" g_source_set_priority ::
Ptr Source -> -- _obj : TInterface "GLib" "Source"
Int32 -> -- priority : TBasicType TInt32
IO ()
sourceSetPriority ::
(MonadIO m) =>
Source -> -- _obj
Int32 -> -- priority
m ()
sourceSetPriority _obj priority = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
g_source_set_priority _obj' priority
touchManagedPtr _obj
return ()
-- method Source::set_ready_time
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "ready_time", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "ready_time", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_source_set_ready_time" g_source_set_ready_time ::
Ptr Source -> -- _obj : TInterface "GLib" "Source"
Int64 -> -- ready_time : TBasicType TInt64
IO ()
sourceSetReadyTime ::
(MonadIO m) =>
Source -> -- _obj
Int64 -> -- ready_time
m ()
sourceSetReadyTime _obj ready_time = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
g_source_set_ready_time _obj' ready_time
touchManagedPtr _obj
return ()
-- method Source::unref
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "Source", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_source_unref" g_source_unref ::
Ptr Source -> -- _obj : TInterface "GLib" "Source"
IO ()
sourceUnref ::
(MonadIO m) =>
Source -> -- _obj
m ()
sourceUnref _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
g_source_unref _obj'
touchManagedPtr _obj
return ()