{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gio.Structs.IOSchedulerJob
(
IOSchedulerJob(..) ,
#if defined(ENABLE_OVERLOADING)
ResolveIOSchedulerJobMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
IOSchedulerJobSendToMainloopMethodInfo ,
#endif
iOSchedulerJobSendToMainloop ,
#if defined(ENABLE_OVERLOADING)
IOSchedulerJobSendToMainloopAsyncMethodInfo,
#endif
iOSchedulerJobSendToMainloopAsync ,
) 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.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GI.GLib.Callbacks as GLib.Callbacks
newtype IOSchedulerJob = IOSchedulerJob (SP.ManagedPtr IOSchedulerJob)
deriving (IOSchedulerJob -> IOSchedulerJob -> Bool
(IOSchedulerJob -> IOSchedulerJob -> Bool)
-> (IOSchedulerJob -> IOSchedulerJob -> Bool) -> Eq IOSchedulerJob
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IOSchedulerJob -> IOSchedulerJob -> Bool
$c/= :: IOSchedulerJob -> IOSchedulerJob -> Bool
== :: IOSchedulerJob -> IOSchedulerJob -> Bool
$c== :: IOSchedulerJob -> IOSchedulerJob -> Bool
Eq)
instance SP.ManagedPtrNewtype IOSchedulerJob where
toManagedPtr :: IOSchedulerJob -> ManagedPtr IOSchedulerJob
toManagedPtr (IOSchedulerJob ManagedPtr IOSchedulerJob
p) = ManagedPtr IOSchedulerJob
p
instance BoxedPtr IOSchedulerJob where
boxedPtrCopy :: IOSchedulerJob -> IO IOSchedulerJob
boxedPtrCopy = IOSchedulerJob -> IO IOSchedulerJob
forall (m :: * -> *) a. Monad m => a -> m a
return
boxedPtrFree :: IOSchedulerJob -> IO ()
boxedPtrFree = \IOSchedulerJob
_x -> () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList IOSchedulerJob
type instance O.AttributeList IOSchedulerJob = IOSchedulerJobAttributeList
type IOSchedulerJobAttributeList = ('[ ] :: [(Symbol, *)])
#endif
foreign import ccall "g_io_scheduler_job_send_to_mainloop" g_io_scheduler_job_send_to_mainloop ::
Ptr IOSchedulerJob ->
FunPtr GLib.Callbacks.C_SourceFunc ->
Ptr () ->
FunPtr GLib.Callbacks.C_DestroyNotify ->
IO CInt
{-# DEPRECATED iOSchedulerJobSendToMainloop ["Use @/g_main_context_invoke()/@."] #-}
iOSchedulerJobSendToMainloop ::
(B.CallStack.HasCallStack, MonadIO m) =>
IOSchedulerJob
-> GLib.Callbacks.SourceFunc
-> m Bool
iOSchedulerJobSendToMainloop :: IOSchedulerJob -> SourceFunc -> m Bool
iOSchedulerJobSendToMainloop IOSchedulerJob
job SourceFunc
func = SourceFunc -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (SourceFunc -> m Bool) -> SourceFunc -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr IOSchedulerJob
job' <- IOSchedulerJob -> IO (Ptr IOSchedulerJob)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr IOSchedulerJob
job
FunPtr C_SourceFunc
func' <- C_SourceFunc -> IO (FunPtr C_SourceFunc)
GLib.Callbacks.mk_SourceFunc (Maybe (Ptr (FunPtr C_SourceFunc))
-> SourceFunc_WithClosures -> C_SourceFunc
GLib.Callbacks.wrap_SourceFunc Maybe (Ptr (FunPtr C_SourceFunc))
forall a. Maybe a
Nothing (SourceFunc -> SourceFunc_WithClosures
GLib.Callbacks.drop_closures_SourceFunc SourceFunc
func))
let userData :: Ptr ()
userData = FunPtr C_SourceFunc -> Ptr ()
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr FunPtr C_SourceFunc
func'
let notify :: FunPtr (Ptr a -> IO ())
notify = FunPtr (Ptr a -> IO ())
forall a. FunPtr (Ptr a -> IO ())
safeFreeFunPtrPtr
CInt
result <- Ptr IOSchedulerJob
-> FunPtr C_SourceFunc
-> Ptr ()
-> FunPtr C_DestroyNotify
-> IO CInt
g_io_scheduler_job_send_to_mainloop Ptr IOSchedulerJob
job' FunPtr C_SourceFunc
func' Ptr ()
userData FunPtr C_DestroyNotify
forall a. FunPtr (Ptr a -> IO ())
notify
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
IOSchedulerJob -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr IOSchedulerJob
job
Bool -> SourceFunc
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data IOSchedulerJobSendToMainloopMethodInfo
instance (signature ~ (GLib.Callbacks.SourceFunc -> m Bool), MonadIO m) => O.MethodInfo IOSchedulerJobSendToMainloopMethodInfo IOSchedulerJob signature where
overloadedMethod = iOSchedulerJobSendToMainloop
#endif
foreign import ccall "g_io_scheduler_job_send_to_mainloop_async" g_io_scheduler_job_send_to_mainloop_async ::
Ptr IOSchedulerJob ->
FunPtr GLib.Callbacks.C_SourceFunc ->
Ptr () ->
FunPtr GLib.Callbacks.C_DestroyNotify ->
IO ()
{-# DEPRECATED iOSchedulerJobSendToMainloopAsync ["Use @/g_main_context_invoke()/@."] #-}
iOSchedulerJobSendToMainloopAsync ::
(B.CallStack.HasCallStack, MonadIO m) =>
IOSchedulerJob
-> GLib.Callbacks.SourceFunc
-> m ()
iOSchedulerJobSendToMainloopAsync :: IOSchedulerJob -> SourceFunc -> m ()
iOSchedulerJobSendToMainloopAsync IOSchedulerJob
job SourceFunc
func = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr IOSchedulerJob
job' <- IOSchedulerJob -> IO (Ptr IOSchedulerJob)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr IOSchedulerJob
job
FunPtr C_SourceFunc
func' <- C_SourceFunc -> IO (FunPtr C_SourceFunc)
GLib.Callbacks.mk_SourceFunc (Maybe (Ptr (FunPtr C_SourceFunc))
-> SourceFunc_WithClosures -> C_SourceFunc
GLib.Callbacks.wrap_SourceFunc Maybe (Ptr (FunPtr C_SourceFunc))
forall a. Maybe a
Nothing (SourceFunc -> SourceFunc_WithClosures
GLib.Callbacks.drop_closures_SourceFunc SourceFunc
func))
let userData :: Ptr ()
userData = FunPtr C_SourceFunc -> Ptr ()
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr FunPtr C_SourceFunc
func'
let notify :: FunPtr (Ptr a -> IO ())
notify = FunPtr (Ptr a -> IO ())
forall a. FunPtr (Ptr a -> IO ())
safeFreeFunPtrPtr
Ptr IOSchedulerJob
-> FunPtr C_SourceFunc -> Ptr () -> FunPtr C_DestroyNotify -> IO ()
g_io_scheduler_job_send_to_mainloop_async Ptr IOSchedulerJob
job' FunPtr C_SourceFunc
func' Ptr ()
userData FunPtr C_DestroyNotify
forall a. FunPtr (Ptr a -> IO ())
notify
IOSchedulerJob -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr IOSchedulerJob
job
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data IOSchedulerJobSendToMainloopAsyncMethodInfo
instance (signature ~ (GLib.Callbacks.SourceFunc -> m ()), MonadIO m) => O.MethodInfo IOSchedulerJobSendToMainloopAsyncMethodInfo IOSchedulerJob signature where
overloadedMethod = iOSchedulerJobSendToMainloopAsync
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveIOSchedulerJobMethod (t :: Symbol) (o :: *) :: * where
ResolveIOSchedulerJobMethod "sendToMainloop" o = IOSchedulerJobSendToMainloopMethodInfo
ResolveIOSchedulerJobMethod "sendToMainloopAsync" o = IOSchedulerJobSendToMainloopAsyncMethodInfo
ResolveIOSchedulerJobMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveIOSchedulerJobMethod t IOSchedulerJob, O.MethodInfo info IOSchedulerJob p) => OL.IsLabel t (IOSchedulerJob -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif