gi-gio-0.2.44.12: GI/Gio/Structs/IOSchedulerJob.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)
Opaque class for defining and scheduling IO jobs.
-}
module GI.Gio.Structs.IOSchedulerJob
(
-- * Exported types
IOSchedulerJob(..) ,
noIOSchedulerJob ,
-- * Methods
-- ** iOSchedulerJobSendToMainloop
iOSchedulerJobSendToMainloop ,
-- ** iOSchedulerJobSendToMainloopAsync
iOSchedulerJobSendToMainloopAsync ,
) 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.Gio.Types
import GI.Gio.Callbacks
import qualified GI.GLib as GLib
newtype IOSchedulerJob = IOSchedulerJob (ForeignPtr IOSchedulerJob)
noIOSchedulerJob :: Maybe IOSchedulerJob
noIOSchedulerJob = Nothing
-- method IOSchedulerJob::send_to_mainloop
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "IOSchedulerJob", 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 = "user_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 "Gio" "IOSchedulerJob", 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 TBoolean
-- throws : False
-- Skip return : False
foreign import ccall "g_io_scheduler_job_send_to_mainloop" g_io_scheduler_job_send_to_mainloop ::
Ptr IOSchedulerJob -> -- _obj : TInterface "Gio" "IOSchedulerJob"
FunPtr GLib.SourceFuncC -> -- func : TInterface "GLib" "SourceFunc"
Ptr () -> -- user_data : TBasicType TVoid
FunPtr GLib.DestroyNotifyC -> -- notify : TInterface "GLib" "DestroyNotify"
IO CInt
{-# DEPRECATED iOSchedulerJobSendToMainloop ["Use g_main_context_invoke()."]#-}
iOSchedulerJobSendToMainloop ::
(MonadIO m) =>
IOSchedulerJob -> -- _obj
GLib.SourceFunc -> -- func
m Bool
iOSchedulerJobSendToMainloop _obj func = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
func' <- GLib.mkSourceFunc (GLib.sourceFuncWrapper Nothing func)
let user_data = castFunPtrToPtr func'
let notify = safeFreeFunPtrPtr
result <- g_io_scheduler_job_send_to_mainloop _obj' func' user_data notify
let result' = (/= 0) result
touchManagedPtr _obj
return result'
-- method IOSchedulerJob::send_to_mainloop_async
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "IOSchedulerJob", 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 = "user_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 "Gio" "IOSchedulerJob", 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_io_scheduler_job_send_to_mainloop_async" g_io_scheduler_job_send_to_mainloop_async ::
Ptr IOSchedulerJob -> -- _obj : TInterface "Gio" "IOSchedulerJob"
FunPtr GLib.SourceFuncC -> -- func : TInterface "GLib" "SourceFunc"
Ptr () -> -- user_data : TBasicType TVoid
FunPtr GLib.DestroyNotifyC -> -- notify : TInterface "GLib" "DestroyNotify"
IO ()
{-# DEPRECATED iOSchedulerJobSendToMainloopAsync ["Use g_main_context_invoke()."]#-}
iOSchedulerJobSendToMainloopAsync ::
(MonadIO m) =>
IOSchedulerJob -> -- _obj
GLib.SourceFunc -> -- func
m ()
iOSchedulerJobSendToMainloopAsync _obj func = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
func' <- GLib.mkSourceFunc (GLib.sourceFuncWrapper Nothing func)
let user_data = castFunPtrToPtr func'
let notify = safeFreeFunPtrPtr
g_io_scheduler_job_send_to_mainloop_async _obj' func' user_data notify
touchManagedPtr _obj
return ()