{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gio.Objects.SocketListener
(
SocketListener(..) ,
IsSocketListener ,
toSocketListener ,
noSocketListener ,
#if defined(ENABLE_OVERLOADING)
ResolveSocketListenerMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
SocketListenerAcceptMethodInfo ,
#endif
socketListenerAccept ,
#if defined(ENABLE_OVERLOADING)
SocketListenerAcceptAsyncMethodInfo ,
#endif
socketListenerAcceptAsync ,
#if defined(ENABLE_OVERLOADING)
SocketListenerAcceptFinishMethodInfo ,
#endif
socketListenerAcceptFinish ,
#if defined(ENABLE_OVERLOADING)
SocketListenerAcceptSocketMethodInfo ,
#endif
socketListenerAcceptSocket ,
#if defined(ENABLE_OVERLOADING)
SocketListenerAcceptSocketAsyncMethodInfo,
#endif
socketListenerAcceptSocketAsync ,
#if defined(ENABLE_OVERLOADING)
SocketListenerAcceptSocketFinishMethodInfo,
#endif
socketListenerAcceptSocketFinish ,
#if defined(ENABLE_OVERLOADING)
SocketListenerAddAddressMethodInfo ,
#endif
socketListenerAddAddress ,
#if defined(ENABLE_OVERLOADING)
SocketListenerAddAnyInetPortMethodInfo ,
#endif
socketListenerAddAnyInetPort ,
#if defined(ENABLE_OVERLOADING)
SocketListenerAddInetPortMethodInfo ,
#endif
socketListenerAddInetPort ,
#if defined(ENABLE_OVERLOADING)
SocketListenerAddSocketMethodInfo ,
#endif
socketListenerAddSocket ,
#if defined(ENABLE_OVERLOADING)
SocketListenerCloseMethodInfo ,
#endif
socketListenerClose ,
socketListenerNew ,
#if defined(ENABLE_OVERLOADING)
SocketListenerSetBacklogMethodInfo ,
#endif
socketListenerSetBacklog ,
#if defined(ENABLE_OVERLOADING)
SocketListenerListenBacklogPropertyInfo ,
#endif
constructSocketListenerListenBacklog ,
getSocketListenerListenBacklog ,
setSocketListenerListenBacklog ,
#if defined(ENABLE_OVERLOADING)
socketListenerListenBacklog ,
#endif
C_SocketListenerEventCallback ,
SocketListenerEventCallback ,
#if defined(ENABLE_OVERLOADING)
SocketListenerEventSignalInfo ,
#endif
afterSocketListenerEvent ,
genClosure_SocketListenerEvent ,
mk_SocketListenerEventCallback ,
noSocketListenerEventCallback ,
onSocketListenerEvent ,
wrap_SocketListenerEventCallback ,
) 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.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 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.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Callbacks as Gio.Callbacks
import {-# SOURCE #-} qualified GI.Gio.Enums as Gio.Enums
import {-# SOURCE #-} qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import {-# SOURCE #-} qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import {-# SOURCE #-} qualified GI.Gio.Objects.Socket as Gio.Socket
import {-# SOURCE #-} qualified GI.Gio.Objects.SocketAddress as Gio.SocketAddress
import {-# SOURCE #-} qualified GI.Gio.Objects.SocketConnection as Gio.SocketConnection
newtype SocketListener = SocketListener (ManagedPtr SocketListener)
deriving (SocketListener -> SocketListener -> Bool
(SocketListener -> SocketListener -> Bool)
-> (SocketListener -> SocketListener -> Bool) -> Eq SocketListener
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SocketListener -> SocketListener -> Bool
$c/= :: SocketListener -> SocketListener -> Bool
== :: SocketListener -> SocketListener -> Bool
$c== :: SocketListener -> SocketListener -> Bool
Eq)
foreign import ccall "g_socket_listener_get_type"
c_g_socket_listener_get_type :: IO GType
instance GObject SocketListener where
gobjectType :: IO GType
gobjectType = IO GType
c_g_socket_listener_get_type
instance B.GValue.IsGValue SocketListener where
toGValue :: SocketListener -> IO GValue
toGValue o :: SocketListener
o = do
GType
gtype <- IO GType
c_g_socket_listener_get_type
SocketListener -> (Ptr SocketListener -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr SocketListener
o (GType
-> (GValue -> Ptr SocketListener -> IO ())
-> Ptr SocketListener
-> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr SocketListener -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
fromGValue :: GValue -> IO SocketListener
fromGValue gv :: GValue
gv = do
Ptr SocketListener
ptr <- GValue -> IO (Ptr SocketListener)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr SocketListener)
(ManagedPtr SocketListener -> SocketListener)
-> Ptr SocketListener -> IO SocketListener
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr SocketListener -> SocketListener
SocketListener Ptr SocketListener
ptr
class (GObject o, O.IsDescendantOf SocketListener o) => IsSocketListener o
instance (GObject o, O.IsDescendantOf SocketListener o) => IsSocketListener o
instance O.HasParentTypes SocketListener
type instance O.ParentTypes SocketListener = '[GObject.Object.Object]
toSocketListener :: (MonadIO m, IsSocketListener o) => o -> m SocketListener
toSocketListener :: o -> m SocketListener
toSocketListener = IO SocketListener -> m SocketListener
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SocketListener -> m SocketListener)
-> (o -> IO SocketListener) -> o -> m SocketListener
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr SocketListener -> SocketListener)
-> o -> IO SocketListener
forall o o'.
(HasCallStack, GObject o, GObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr SocketListener -> SocketListener
SocketListener
noSocketListener :: Maybe SocketListener
noSocketListener :: Maybe SocketListener
noSocketListener = Maybe SocketListener
forall a. Maybe a
Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveSocketListenerMethod (t :: Symbol) (o :: *) :: * where
ResolveSocketListenerMethod "accept" o = SocketListenerAcceptMethodInfo
ResolveSocketListenerMethod "acceptAsync" o = SocketListenerAcceptAsyncMethodInfo
ResolveSocketListenerMethod "acceptFinish" o = SocketListenerAcceptFinishMethodInfo
ResolveSocketListenerMethod "acceptSocket" o = SocketListenerAcceptSocketMethodInfo
ResolveSocketListenerMethod "acceptSocketAsync" o = SocketListenerAcceptSocketAsyncMethodInfo
ResolveSocketListenerMethod "acceptSocketFinish" o = SocketListenerAcceptSocketFinishMethodInfo
ResolveSocketListenerMethod "addAddress" o = SocketListenerAddAddressMethodInfo
ResolveSocketListenerMethod "addAnyInetPort" o = SocketListenerAddAnyInetPortMethodInfo
ResolveSocketListenerMethod "addInetPort" o = SocketListenerAddInetPortMethodInfo
ResolveSocketListenerMethod "addSocket" o = SocketListenerAddSocketMethodInfo
ResolveSocketListenerMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveSocketListenerMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveSocketListenerMethod "close" o = SocketListenerCloseMethodInfo
ResolveSocketListenerMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveSocketListenerMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveSocketListenerMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveSocketListenerMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveSocketListenerMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveSocketListenerMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveSocketListenerMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveSocketListenerMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveSocketListenerMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveSocketListenerMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveSocketListenerMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveSocketListenerMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveSocketListenerMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveSocketListenerMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveSocketListenerMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveSocketListenerMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveSocketListenerMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveSocketListenerMethod "setBacklog" o = SocketListenerSetBacklogMethodInfo
ResolveSocketListenerMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveSocketListenerMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveSocketListenerMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveSocketListenerMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveSocketListenerMethod t SocketListener, O.MethodInfo info SocketListener p) => OL.IsLabel t (SocketListener -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif
type SocketListenerEventCallback =
Gio.Enums.SocketListenerEvent
-> Gio.Socket.Socket
-> IO ()
noSocketListenerEventCallback :: Maybe SocketListenerEventCallback
noSocketListenerEventCallback :: Maybe SocketListenerEventCallback
noSocketListenerEventCallback = Maybe SocketListenerEventCallback
forall a. Maybe a
Nothing
type C_SocketListenerEventCallback =
Ptr () ->
CUInt ->
Ptr Gio.Socket.Socket ->
Ptr () ->
IO ()
foreign import ccall "wrapper"
mk_SocketListenerEventCallback :: C_SocketListenerEventCallback -> IO (FunPtr C_SocketListenerEventCallback)
genClosure_SocketListenerEvent :: MonadIO m => SocketListenerEventCallback -> m (GClosure C_SocketListenerEventCallback)
genClosure_SocketListenerEvent :: SocketListenerEventCallback
-> m (GClosure C_SocketListenerEventCallback)
genClosure_SocketListenerEvent cb :: SocketListenerEventCallback
cb = IO (GClosure C_SocketListenerEventCallback)
-> m (GClosure C_SocketListenerEventCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_SocketListenerEventCallback)
-> m (GClosure C_SocketListenerEventCallback))
-> IO (GClosure C_SocketListenerEventCallback)
-> m (GClosure C_SocketListenerEventCallback)
forall a b. (a -> b) -> a -> b
$ do
let cb' :: C_SocketListenerEventCallback
cb' = SocketListenerEventCallback -> C_SocketListenerEventCallback
wrap_SocketListenerEventCallback SocketListenerEventCallback
cb
C_SocketListenerEventCallback
-> IO (FunPtr C_SocketListenerEventCallback)
mk_SocketListenerEventCallback C_SocketListenerEventCallback
cb' IO (FunPtr C_SocketListenerEventCallback)
-> (FunPtr C_SocketListenerEventCallback
-> IO (GClosure C_SocketListenerEventCallback))
-> IO (GClosure C_SocketListenerEventCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_SocketListenerEventCallback
-> IO (GClosure C_SocketListenerEventCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure
wrap_SocketListenerEventCallback ::
SocketListenerEventCallback ->
C_SocketListenerEventCallback
wrap_SocketListenerEventCallback :: SocketListenerEventCallback -> C_SocketListenerEventCallback
wrap_SocketListenerEventCallback _cb :: SocketListenerEventCallback
_cb _ event :: CUInt
event socket :: Ptr Socket
socket _ = do
let event' :: SocketListenerEvent
event' = (Int -> SocketListenerEvent
forall a. Enum a => Int -> a
toEnum (Int -> SocketListenerEvent)
-> (CUInt -> Int) -> CUInt -> SocketListenerEvent
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
event
Socket
socket' <- ((ManagedPtr Socket -> Socket) -> Ptr Socket -> IO Socket
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Socket -> Socket
Gio.Socket.Socket) Ptr Socket
socket
SocketListenerEventCallback
_cb SocketListenerEvent
event' Socket
socket'
onSocketListenerEvent :: (IsSocketListener a, MonadIO m) => a -> SocketListenerEventCallback -> m SignalHandlerId
onSocketListenerEvent :: a -> SocketListenerEventCallback -> m SignalHandlerId
onSocketListenerEvent obj :: a
obj cb :: SocketListenerEventCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
let cb' :: C_SocketListenerEventCallback
cb' = SocketListenerEventCallback -> C_SocketListenerEventCallback
wrap_SocketListenerEventCallback SocketListenerEventCallback
cb
FunPtr C_SocketListenerEventCallback
cb'' <- C_SocketListenerEventCallback
-> IO (FunPtr C_SocketListenerEventCallback)
mk_SocketListenerEventCallback C_SocketListenerEventCallback
cb'
a
-> Text
-> FunPtr C_SocketListenerEventCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj "event" FunPtr C_SocketListenerEventCallback
cb'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing
afterSocketListenerEvent :: (IsSocketListener a, MonadIO m) => a -> SocketListenerEventCallback -> m SignalHandlerId
afterSocketListenerEvent :: a -> SocketListenerEventCallback -> m SignalHandlerId
afterSocketListenerEvent obj :: a
obj cb :: SocketListenerEventCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
let cb' :: C_SocketListenerEventCallback
cb' = SocketListenerEventCallback -> C_SocketListenerEventCallback
wrap_SocketListenerEventCallback SocketListenerEventCallback
cb
FunPtr C_SocketListenerEventCallback
cb'' <- C_SocketListenerEventCallback
-> IO (FunPtr C_SocketListenerEventCallback)
mk_SocketListenerEventCallback C_SocketListenerEventCallback
cb'
a
-> Text
-> FunPtr C_SocketListenerEventCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj "event" FunPtr C_SocketListenerEventCallback
cb'' SignalConnectMode
SignalConnectAfter Maybe Text
forall a. Maybe a
Nothing
#if defined(ENABLE_OVERLOADING)
data SocketListenerEventSignalInfo
instance SignalInfo SocketListenerEventSignalInfo where
type HaskellCallbackType SocketListenerEventSignalInfo = SocketListenerEventCallback
connectSignal obj cb connectMode detail = do
let cb' = wrap_SocketListenerEventCallback cb
cb'' <- mk_SocketListenerEventCallback cb'
connectSignalFunPtr obj "event" cb'' connectMode detail
#endif
getSocketListenerListenBacklog :: (MonadIO m, IsSocketListener o) => o -> m Int32
getSocketListenerListenBacklog :: o -> m Int32
getSocketListenerListenBacklog obj :: o
obj = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ o -> String -> IO Int32
forall a. GObject a => a -> String -> IO Int32
B.Properties.getObjectPropertyInt32 o
obj "listen-backlog"
setSocketListenerListenBacklog :: (MonadIO m, IsSocketListener o) => o -> Int32 -> m ()
setSocketListenerListenBacklog :: o -> Int32 -> m ()
setSocketListenerListenBacklog obj :: o
obj val :: Int32
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ o -> String -> Int32 -> IO ()
forall a. GObject a => a -> String -> Int32 -> IO ()
B.Properties.setObjectPropertyInt32 o
obj "listen-backlog" Int32
val
constructSocketListenerListenBacklog :: (IsSocketListener o) => Int32 -> IO (GValueConstruct o)
constructSocketListenerListenBacklog :: Int32 -> IO (GValueConstruct o)
constructSocketListenerListenBacklog val :: Int32
val = String -> Int32 -> IO (GValueConstruct o)
forall o. String -> Int32 -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyInt32 "listen-backlog" Int32
val
#if defined(ENABLE_OVERLOADING)
data SocketListenerListenBacklogPropertyInfo
instance AttrInfo SocketListenerListenBacklogPropertyInfo where
type AttrAllowedOps SocketListenerListenBacklogPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
type AttrBaseTypeConstraint SocketListenerListenBacklogPropertyInfo = IsSocketListener
type AttrSetTypeConstraint SocketListenerListenBacklogPropertyInfo = (~) Int32
type AttrTransferTypeConstraint SocketListenerListenBacklogPropertyInfo = (~) Int32
type AttrTransferType SocketListenerListenBacklogPropertyInfo = Int32
type AttrGetType SocketListenerListenBacklogPropertyInfo = Int32
type AttrLabel SocketListenerListenBacklogPropertyInfo = "listen-backlog"
type AttrOrigin SocketListenerListenBacklogPropertyInfo = SocketListener
attrGet = getSocketListenerListenBacklog
attrSet = setSocketListenerListenBacklog
attrTransfer _ v = do
return v
attrConstruct = constructSocketListenerListenBacklog
attrClear = undefined
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList SocketListener
type instance O.AttributeList SocketListener = SocketListenerAttributeList
type SocketListenerAttributeList = ('[ '("listenBacklog", SocketListenerListenBacklogPropertyInfo)] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
socketListenerListenBacklog :: AttrLabelProxy "listenBacklog"
socketListenerListenBacklog = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList SocketListener = SocketListenerSignalList
type SocketListenerSignalList = ('[ '("event", SocketListenerEventSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "g_socket_listener_new" g_socket_listener_new ::
IO (Ptr SocketListener)
socketListenerNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
m SocketListener
socketListenerNew :: m SocketListener
socketListenerNew = IO SocketListener -> m SocketListener
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SocketListener -> m SocketListener)
-> IO SocketListener -> m SocketListener
forall a b. (a -> b) -> a -> b
$ do
Ptr SocketListener
result <- IO (Ptr SocketListener)
g_socket_listener_new
Text -> Ptr SocketListener -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "socketListenerNew" Ptr SocketListener
result
SocketListener
result' <- ((ManagedPtr SocketListener -> SocketListener)
-> Ptr SocketListener -> IO SocketListener
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr SocketListener -> SocketListener
SocketListener) Ptr SocketListener
result
SocketListener -> IO SocketListener
forall (m :: * -> *) a. Monad m => a -> m a
return SocketListener
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_socket_listener_accept" g_socket_listener_accept ::
Ptr SocketListener ->
Ptr (Ptr GObject.Object.Object) ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr Gio.SocketConnection.SocketConnection)
socketListenerAccept ::
(B.CallStack.HasCallStack, MonadIO m, IsSocketListener a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (b)
-> m ((Gio.SocketConnection.SocketConnection, Maybe GObject.Object.Object))
socketListenerAccept :: a -> Maybe b -> m (SocketConnection, Maybe Object)
socketListenerAccept listener :: a
listener cancellable :: Maybe b
cancellable = IO (SocketConnection, Maybe Object)
-> m (SocketConnection, Maybe Object)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (SocketConnection, Maybe Object)
-> m (SocketConnection, Maybe Object))
-> IO (SocketConnection, Maybe Object)
-> m (SocketConnection, Maybe Object)
forall a b. (a -> b) -> a -> b
$ do
Ptr SocketListener
listener' <- a -> IO (Ptr SocketListener)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
listener
Ptr (Ptr Object)
sourceObject <- IO (Ptr (Ptr Object))
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr (Ptr GObject.Object.Object))
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO (SocketConnection, Maybe Object)
-> IO () -> IO (SocketConnection, Maybe Object)
forall a b. IO a -> IO b -> IO a
onException (do
Ptr SocketConnection
result <- (Ptr (Ptr GError) -> IO (Ptr SocketConnection))
-> IO (Ptr SocketConnection)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr SocketConnection))
-> IO (Ptr SocketConnection))
-> (Ptr (Ptr GError) -> IO (Ptr SocketConnection))
-> IO (Ptr SocketConnection)
forall a b. (a -> b) -> a -> b
$ Ptr SocketListener
-> Ptr (Ptr Object)
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO (Ptr SocketConnection)
g_socket_listener_accept Ptr SocketListener
listener' Ptr (Ptr Object)
sourceObject Ptr Cancellable
maybeCancellable
Text -> Ptr SocketConnection -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "socketListenerAccept" Ptr SocketConnection
result
SocketConnection
result' <- ((ManagedPtr SocketConnection -> SocketConnection)
-> Ptr SocketConnection -> IO SocketConnection
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr SocketConnection -> SocketConnection
Gio.SocketConnection.SocketConnection) Ptr SocketConnection
result
Ptr Object
sourceObject' <- Ptr (Ptr Object) -> IO (Ptr Object)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr Object)
sourceObject
Maybe Object
maybeSourceObject' <- Ptr Object -> (Ptr Object -> IO Object) -> IO (Maybe Object)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Object
sourceObject' ((Ptr Object -> IO Object) -> IO (Maybe Object))
-> (Ptr Object -> IO Object) -> IO (Maybe Object)
forall a b. (a -> b) -> a -> b
$ \sourceObject'' :: Ptr Object
sourceObject'' -> do
Object
sourceObject''' <- ((ManagedPtr Object -> Object) -> Ptr Object -> IO Object
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Object -> Object
GObject.Object.Object) Ptr Object
sourceObject''
Object -> IO Object
forall (m :: * -> *) a. Monad m => a -> m a
return Object
sourceObject'''
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
listener
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Ptr (Ptr Object) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr Object)
sourceObject
(SocketConnection, Maybe Object)
-> IO (SocketConnection, Maybe Object)
forall (m :: * -> *) a. Monad m => a -> m a
return (SocketConnection
result', Maybe Object
maybeSourceObject')
) (do
Ptr (Ptr Object) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr Object)
sourceObject
)
#if defined(ENABLE_OVERLOADING)
data SocketListenerAcceptMethodInfo
instance (signature ~ (Maybe (b) -> m ((Gio.SocketConnection.SocketConnection, Maybe GObject.Object.Object))), MonadIO m, IsSocketListener a, Gio.Cancellable.IsCancellable b) => O.MethodInfo SocketListenerAcceptMethodInfo a signature where
overloadedMethod = socketListenerAccept
#endif
foreign import ccall "g_socket_listener_accept_async" g_socket_listener_accept_async ::
Ptr SocketListener ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
socketListenerAcceptAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsSocketListener a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
socketListenerAcceptAsync :: a -> Maybe b -> Maybe AsyncReadyCallback -> m ()
socketListenerAcceptAsync listener :: a
listener cancellable :: Maybe b
cancellable callback :: Maybe AsyncReadyCallback
callback = 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 SocketListener
listener' <- a -> IO (Ptr SocketListener)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
listener
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just jCallback :: AsyncReadyCallback
jCallback -> do
Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr SocketListener
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_socket_listener_accept_async Ptr SocketListener
listener' Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
listener
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data SocketListenerAcceptAsyncMethodInfo
instance (signature ~ (Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsSocketListener a, Gio.Cancellable.IsCancellable b) => O.MethodInfo SocketListenerAcceptAsyncMethodInfo a signature where
overloadedMethod = socketListenerAcceptAsync
#endif
foreign import ccall "g_socket_listener_accept_finish" g_socket_listener_accept_finish ::
Ptr SocketListener ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GObject.Object.Object) ->
Ptr (Ptr GError) ->
IO (Ptr Gio.SocketConnection.SocketConnection)
socketListenerAcceptFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsSocketListener a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m ((Gio.SocketConnection.SocketConnection, Maybe GObject.Object.Object))
socketListenerAcceptFinish :: a -> b -> m (SocketConnection, Maybe Object)
socketListenerAcceptFinish listener :: a
listener result_ :: b
result_ = IO (SocketConnection, Maybe Object)
-> m (SocketConnection, Maybe Object)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (SocketConnection, Maybe Object)
-> m (SocketConnection, Maybe Object))
-> IO (SocketConnection, Maybe Object)
-> m (SocketConnection, Maybe Object)
forall a b. (a -> b) -> a -> b
$ do
Ptr SocketListener
listener' <- a -> IO (Ptr SocketListener)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
listener
Ptr AsyncResult
result_' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
Ptr (Ptr Object)
sourceObject <- IO (Ptr (Ptr Object))
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr (Ptr GObject.Object.Object))
IO (SocketConnection, Maybe Object)
-> IO () -> IO (SocketConnection, Maybe Object)
forall a b. IO a -> IO b -> IO a
onException (do
Ptr SocketConnection
result <- (Ptr (Ptr GError) -> IO (Ptr SocketConnection))
-> IO (Ptr SocketConnection)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr SocketConnection))
-> IO (Ptr SocketConnection))
-> (Ptr (Ptr GError) -> IO (Ptr SocketConnection))
-> IO (Ptr SocketConnection)
forall a b. (a -> b) -> a -> b
$ Ptr SocketListener
-> Ptr AsyncResult
-> Ptr (Ptr Object)
-> Ptr (Ptr GError)
-> IO (Ptr SocketConnection)
g_socket_listener_accept_finish Ptr SocketListener
listener' Ptr AsyncResult
result_' Ptr (Ptr Object)
sourceObject
Text -> Ptr SocketConnection -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "socketListenerAcceptFinish" Ptr SocketConnection
result
SocketConnection
result' <- ((ManagedPtr SocketConnection -> SocketConnection)
-> Ptr SocketConnection -> IO SocketConnection
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr SocketConnection -> SocketConnection
Gio.SocketConnection.SocketConnection) Ptr SocketConnection
result
Ptr Object
sourceObject' <- Ptr (Ptr Object) -> IO (Ptr Object)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr Object)
sourceObject
Maybe Object
maybeSourceObject' <- Ptr Object -> (Ptr Object -> IO Object) -> IO (Maybe Object)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Object
sourceObject' ((Ptr Object -> IO Object) -> IO (Maybe Object))
-> (Ptr Object -> IO Object) -> IO (Maybe Object)
forall a b. (a -> b) -> a -> b
$ \sourceObject'' :: Ptr Object
sourceObject'' -> do
Object
sourceObject''' <- ((ManagedPtr Object -> Object) -> Ptr Object -> IO Object
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Object -> Object
GObject.Object.Object) Ptr Object
sourceObject''
Object -> IO Object
forall (m :: * -> *) a. Monad m => a -> m a
return Object
sourceObject'''
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
listener
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
Ptr (Ptr Object) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr Object)
sourceObject
(SocketConnection, Maybe Object)
-> IO (SocketConnection, Maybe Object)
forall (m :: * -> *) a. Monad m => a -> m a
return (SocketConnection
result', Maybe Object
maybeSourceObject')
) (do
Ptr (Ptr Object) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr Object)
sourceObject
)
#if defined(ENABLE_OVERLOADING)
data SocketListenerAcceptFinishMethodInfo
instance (signature ~ (b -> m ((Gio.SocketConnection.SocketConnection, Maybe GObject.Object.Object))), MonadIO m, IsSocketListener a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo SocketListenerAcceptFinishMethodInfo a signature where
overloadedMethod = socketListenerAcceptFinish
#endif
foreign import ccall "g_socket_listener_accept_socket" g_socket_listener_accept_socket ::
Ptr SocketListener ->
Ptr (Ptr GObject.Object.Object) ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr Gio.Socket.Socket)
socketListenerAcceptSocket ::
(B.CallStack.HasCallStack, MonadIO m, IsSocketListener a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (b)
-> m ((Gio.Socket.Socket, Maybe GObject.Object.Object))
socketListenerAcceptSocket :: a -> Maybe b -> m (Socket, Maybe Object)
socketListenerAcceptSocket listener :: a
listener cancellable :: Maybe b
cancellable = IO (Socket, Maybe Object) -> m (Socket, Maybe Object)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Socket, Maybe Object) -> m (Socket, Maybe Object))
-> IO (Socket, Maybe Object) -> m (Socket, Maybe Object)
forall a b. (a -> b) -> a -> b
$ do
Ptr SocketListener
listener' <- a -> IO (Ptr SocketListener)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
listener
Ptr (Ptr Object)
sourceObject <- IO (Ptr (Ptr Object))
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr (Ptr GObject.Object.Object))
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO (Socket, Maybe Object) -> IO () -> IO (Socket, Maybe Object)
forall a b. IO a -> IO b -> IO a
onException (do
Ptr Socket
result <- (Ptr (Ptr GError) -> IO (Ptr Socket)) -> IO (Ptr Socket)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr Socket)) -> IO (Ptr Socket))
-> (Ptr (Ptr GError) -> IO (Ptr Socket)) -> IO (Ptr Socket)
forall a b. (a -> b) -> a -> b
$ Ptr SocketListener
-> Ptr (Ptr Object)
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO (Ptr Socket)
g_socket_listener_accept_socket Ptr SocketListener
listener' Ptr (Ptr Object)
sourceObject Ptr Cancellable
maybeCancellable
Text -> Ptr Socket -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "socketListenerAcceptSocket" Ptr Socket
result
Socket
result' <- ((ManagedPtr Socket -> Socket) -> Ptr Socket -> IO Socket
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Socket -> Socket
Gio.Socket.Socket) Ptr Socket
result
Ptr Object
sourceObject' <- Ptr (Ptr Object) -> IO (Ptr Object)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr Object)
sourceObject
Maybe Object
maybeSourceObject' <- Ptr Object -> (Ptr Object -> IO Object) -> IO (Maybe Object)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Object
sourceObject' ((Ptr Object -> IO Object) -> IO (Maybe Object))
-> (Ptr Object -> IO Object) -> IO (Maybe Object)
forall a b. (a -> b) -> a -> b
$ \sourceObject'' :: Ptr Object
sourceObject'' -> do
Object
sourceObject''' <- ((ManagedPtr Object -> Object) -> Ptr Object -> IO Object
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Object -> Object
GObject.Object.Object) Ptr Object
sourceObject''
Object -> IO Object
forall (m :: * -> *) a. Monad m => a -> m a
return Object
sourceObject'''
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
listener
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Ptr (Ptr Object) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr Object)
sourceObject
(Socket, Maybe Object) -> IO (Socket, Maybe Object)
forall (m :: * -> *) a. Monad m => a -> m a
return (Socket
result', Maybe Object
maybeSourceObject')
) (do
Ptr (Ptr Object) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr Object)
sourceObject
)
#if defined(ENABLE_OVERLOADING)
data SocketListenerAcceptSocketMethodInfo
instance (signature ~ (Maybe (b) -> m ((Gio.Socket.Socket, Maybe GObject.Object.Object))), MonadIO m, IsSocketListener a, Gio.Cancellable.IsCancellable b) => O.MethodInfo SocketListenerAcceptSocketMethodInfo a signature where
overloadedMethod = socketListenerAcceptSocket
#endif
foreign import ccall "g_socket_listener_accept_socket_async" g_socket_listener_accept_socket_async ::
Ptr SocketListener ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
socketListenerAcceptSocketAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsSocketListener a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
socketListenerAcceptSocketAsync :: a -> Maybe b -> Maybe AsyncReadyCallback -> m ()
socketListenerAcceptSocketAsync listener :: a
listener cancellable :: Maybe b
cancellable callback :: Maybe AsyncReadyCallback
callback = 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 SocketListener
listener' <- a -> IO (Ptr SocketListener)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
listener
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just jCallback :: AsyncReadyCallback
jCallback -> do
Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr SocketListener
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_socket_listener_accept_socket_async Ptr SocketListener
listener' Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
listener
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data SocketListenerAcceptSocketAsyncMethodInfo
instance (signature ~ (Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsSocketListener a, Gio.Cancellable.IsCancellable b) => O.MethodInfo SocketListenerAcceptSocketAsyncMethodInfo a signature where
overloadedMethod = socketListenerAcceptSocketAsync
#endif
foreign import ccall "g_socket_listener_accept_socket_finish" g_socket_listener_accept_socket_finish ::
Ptr SocketListener ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GObject.Object.Object) ->
Ptr (Ptr GError) ->
IO (Ptr Gio.Socket.Socket)
socketListenerAcceptSocketFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsSocketListener a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m ((Gio.Socket.Socket, Maybe GObject.Object.Object))
socketListenerAcceptSocketFinish :: a -> b -> m (Socket, Maybe Object)
socketListenerAcceptSocketFinish listener :: a
listener result_ :: b
result_ = IO (Socket, Maybe Object) -> m (Socket, Maybe Object)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Socket, Maybe Object) -> m (Socket, Maybe Object))
-> IO (Socket, Maybe Object) -> m (Socket, Maybe Object)
forall a b. (a -> b) -> a -> b
$ do
Ptr SocketListener
listener' <- a -> IO (Ptr SocketListener)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
listener
Ptr AsyncResult
result_' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
Ptr (Ptr Object)
sourceObject <- IO (Ptr (Ptr Object))
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr (Ptr GObject.Object.Object))
IO (Socket, Maybe Object) -> IO () -> IO (Socket, Maybe Object)
forall a b. IO a -> IO b -> IO a
onException (do
Ptr Socket
result <- (Ptr (Ptr GError) -> IO (Ptr Socket)) -> IO (Ptr Socket)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr Socket)) -> IO (Ptr Socket))
-> (Ptr (Ptr GError) -> IO (Ptr Socket)) -> IO (Ptr Socket)
forall a b. (a -> b) -> a -> b
$ Ptr SocketListener
-> Ptr AsyncResult
-> Ptr (Ptr Object)
-> Ptr (Ptr GError)
-> IO (Ptr Socket)
g_socket_listener_accept_socket_finish Ptr SocketListener
listener' Ptr AsyncResult
result_' Ptr (Ptr Object)
sourceObject
Text -> Ptr Socket -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "socketListenerAcceptSocketFinish" Ptr Socket
result
Socket
result' <- ((ManagedPtr Socket -> Socket) -> Ptr Socket -> IO Socket
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Socket -> Socket
Gio.Socket.Socket) Ptr Socket
result
Ptr Object
sourceObject' <- Ptr (Ptr Object) -> IO (Ptr Object)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr Object)
sourceObject
Maybe Object
maybeSourceObject' <- Ptr Object -> (Ptr Object -> IO Object) -> IO (Maybe Object)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Object
sourceObject' ((Ptr Object -> IO Object) -> IO (Maybe Object))
-> (Ptr Object -> IO Object) -> IO (Maybe Object)
forall a b. (a -> b) -> a -> b
$ \sourceObject'' :: Ptr Object
sourceObject'' -> do
Object
sourceObject''' <- ((ManagedPtr Object -> Object) -> Ptr Object -> IO Object
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Object -> Object
GObject.Object.Object) Ptr Object
sourceObject''
Object -> IO Object
forall (m :: * -> *) a. Monad m => a -> m a
return Object
sourceObject'''
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
listener
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
Ptr (Ptr Object) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr Object)
sourceObject
(Socket, Maybe Object) -> IO (Socket, Maybe Object)
forall (m :: * -> *) a. Monad m => a -> m a
return (Socket
result', Maybe Object
maybeSourceObject')
) (do
Ptr (Ptr Object) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr Object)
sourceObject
)
#if defined(ENABLE_OVERLOADING)
data SocketListenerAcceptSocketFinishMethodInfo
instance (signature ~ (b -> m ((Gio.Socket.Socket, Maybe GObject.Object.Object))), MonadIO m, IsSocketListener a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo SocketListenerAcceptSocketFinishMethodInfo a signature where
overloadedMethod = socketListenerAcceptSocketFinish
#endif
foreign import ccall "g_socket_listener_add_address" g_socket_listener_add_address ::
Ptr SocketListener ->
Ptr Gio.SocketAddress.SocketAddress ->
CUInt ->
CInt ->
Ptr GObject.Object.Object ->
Ptr (Ptr Gio.SocketAddress.SocketAddress) ->
Ptr (Ptr GError) ->
IO CInt
socketListenerAddAddress ::
(B.CallStack.HasCallStack, MonadIO m, IsSocketListener a, Gio.SocketAddress.IsSocketAddress b, GObject.Object.IsObject c) =>
a
-> b
-> Gio.Enums.SocketType
-> Gio.Enums.SocketProtocol
-> Maybe (c)
-> m (Gio.SocketAddress.SocketAddress)
socketListenerAddAddress :: a
-> b -> SocketType -> SocketProtocol -> Maybe c -> m SocketAddress
socketListenerAddAddress listener :: a
listener address :: b
address type_ :: SocketType
type_ protocol :: SocketProtocol
protocol sourceObject :: Maybe c
sourceObject = IO SocketAddress -> m SocketAddress
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SocketAddress -> m SocketAddress)
-> IO SocketAddress -> m SocketAddress
forall a b. (a -> b) -> a -> b
$ do
Ptr SocketListener
listener' <- a -> IO (Ptr SocketListener)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
listener
Ptr SocketAddress
address' <- b -> IO (Ptr SocketAddress)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
address
let type_' :: CUInt
type_' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (SocketType -> Int) -> SocketType -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SocketType -> Int
forall a. Enum a => a -> Int
fromEnum) SocketType
type_
let protocol' :: CInt
protocol' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (SocketProtocol -> Int) -> SocketProtocol -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SocketProtocol -> Int
forall a. Enum a => a -> Int
fromEnum) SocketProtocol
protocol
Ptr Object
maybeSourceObject <- case Maybe c
sourceObject of
Nothing -> Ptr Object -> IO (Ptr Object)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
forall a. Ptr a
nullPtr
Just jSourceObject :: c
jSourceObject -> do
Ptr Object
jSourceObject' <- c -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jSourceObject
Ptr Object -> IO (Ptr Object)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
jSourceObject'
Ptr (Ptr SocketAddress)
effectiveAddress <- IO (Ptr (Ptr SocketAddress))
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr (Ptr Gio.SocketAddress.SocketAddress))
IO SocketAddress -> IO () -> IO SocketAddress
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr SocketListener
-> Ptr SocketAddress
-> CUInt
-> CInt
-> Ptr Object
-> Ptr (Ptr SocketAddress)
-> Ptr (Ptr GError)
-> IO CInt
g_socket_listener_add_address Ptr SocketListener
listener' Ptr SocketAddress
address' CUInt
type_' CInt
protocol' Ptr Object
maybeSourceObject Ptr (Ptr SocketAddress)
effectiveAddress
Ptr SocketAddress
effectiveAddress' <- Ptr (Ptr SocketAddress) -> IO (Ptr SocketAddress)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr SocketAddress)
effectiveAddress
SocketAddress
effectiveAddress'' <- ((ManagedPtr SocketAddress -> SocketAddress)
-> Ptr SocketAddress -> IO SocketAddress
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr SocketAddress -> SocketAddress
Gio.SocketAddress.SocketAddress) Ptr SocketAddress
effectiveAddress'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
listener
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
address
Maybe c -> (c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
sourceObject c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Ptr (Ptr SocketAddress) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr SocketAddress)
effectiveAddress
SocketAddress -> IO SocketAddress
forall (m :: * -> *) a. Monad m => a -> m a
return SocketAddress
effectiveAddress''
) (do
Ptr (Ptr SocketAddress) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr SocketAddress)
effectiveAddress
)
#if defined(ENABLE_OVERLOADING)
data SocketListenerAddAddressMethodInfo
instance (signature ~ (b -> Gio.Enums.SocketType -> Gio.Enums.SocketProtocol -> Maybe (c) -> m (Gio.SocketAddress.SocketAddress)), MonadIO m, IsSocketListener a, Gio.SocketAddress.IsSocketAddress b, GObject.Object.IsObject c) => O.MethodInfo SocketListenerAddAddressMethodInfo a signature where
overloadedMethod = socketListenerAddAddress
#endif
foreign import ccall "g_socket_listener_add_any_inet_port" g_socket_listener_add_any_inet_port ::
Ptr SocketListener ->
Ptr GObject.Object.Object ->
Ptr (Ptr GError) ->
IO Word16
socketListenerAddAnyInetPort ::
(B.CallStack.HasCallStack, MonadIO m, IsSocketListener a, GObject.Object.IsObject b) =>
a
-> Maybe (b)
-> m Word16
socketListenerAddAnyInetPort :: a -> Maybe b -> m Word16
socketListenerAddAnyInetPort listener :: a
listener sourceObject :: Maybe b
sourceObject = IO Word16 -> m Word16
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word16 -> m Word16) -> IO Word16 -> m Word16
forall a b. (a -> b) -> a -> b
$ do
Ptr SocketListener
listener' <- a -> IO (Ptr SocketListener)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
listener
Ptr Object
maybeSourceObject <- case Maybe b
sourceObject of
Nothing -> Ptr Object -> IO (Ptr Object)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
forall a. Ptr a
nullPtr
Just jSourceObject :: b
jSourceObject -> do
Ptr Object
jSourceObject' <- b -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jSourceObject
Ptr Object -> IO (Ptr Object)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
jSourceObject'
IO Word16 -> IO () -> IO Word16
forall a b. IO a -> IO b -> IO a
onException (do
Word16
result <- (Ptr (Ptr GError) -> IO Word16) -> IO Word16
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO Word16) -> IO Word16)
-> (Ptr (Ptr GError) -> IO Word16) -> IO Word16
forall a b. (a -> b) -> a -> b
$ Ptr SocketListener -> Ptr Object -> Ptr (Ptr GError) -> IO Word16
g_socket_listener_add_any_inet_port Ptr SocketListener
listener' Ptr Object
maybeSourceObject
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
listener
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
sourceObject b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Word16 -> IO Word16
forall (m :: * -> *) a. Monad m => a -> m a
return Word16
result
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data SocketListenerAddAnyInetPortMethodInfo
instance (signature ~ (Maybe (b) -> m Word16), MonadIO m, IsSocketListener a, GObject.Object.IsObject b) => O.MethodInfo SocketListenerAddAnyInetPortMethodInfo a signature where
overloadedMethod = socketListenerAddAnyInetPort
#endif
foreign import ccall "g_socket_listener_add_inet_port" g_socket_listener_add_inet_port ::
Ptr SocketListener ->
Word16 ->
Ptr GObject.Object.Object ->
Ptr (Ptr GError) ->
IO CInt
socketListenerAddInetPort ::
(B.CallStack.HasCallStack, MonadIO m, IsSocketListener a, GObject.Object.IsObject b) =>
a
-> Word16
-> Maybe (b)
-> m ()
socketListenerAddInetPort :: a -> Word16 -> Maybe b -> m ()
socketListenerAddInetPort listener :: a
listener port :: Word16
port sourceObject :: Maybe b
sourceObject = 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 SocketListener
listener' <- a -> IO (Ptr SocketListener)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
listener
Ptr Object
maybeSourceObject <- case Maybe b
sourceObject of
Nothing -> Ptr Object -> IO (Ptr Object)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
forall a. Ptr a
nullPtr
Just jSourceObject :: b
jSourceObject -> do
Ptr Object
jSourceObject' <- b -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jSourceObject
Ptr Object -> IO (Ptr Object)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
jSourceObject'
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr SocketListener
-> Word16 -> Ptr Object -> Ptr (Ptr GError) -> IO CInt
g_socket_listener_add_inet_port Ptr SocketListener
listener' Word16
port Ptr Object
maybeSourceObject
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
listener
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
sourceObject b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data SocketListenerAddInetPortMethodInfo
instance (signature ~ (Word16 -> Maybe (b) -> m ()), MonadIO m, IsSocketListener a, GObject.Object.IsObject b) => O.MethodInfo SocketListenerAddInetPortMethodInfo a signature where
overloadedMethod = socketListenerAddInetPort
#endif
foreign import ccall "g_socket_listener_add_socket" g_socket_listener_add_socket ::
Ptr SocketListener ->
Ptr Gio.Socket.Socket ->
Ptr GObject.Object.Object ->
Ptr (Ptr GError) ->
IO CInt
socketListenerAddSocket ::
(B.CallStack.HasCallStack, MonadIO m, IsSocketListener a, Gio.Socket.IsSocket b, GObject.Object.IsObject c) =>
a
-> b
-> Maybe (c)
-> m ()
socketListenerAddSocket :: a -> b -> Maybe c -> m ()
socketListenerAddSocket listener :: a
listener socket :: b
socket sourceObject :: Maybe c
sourceObject = 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 SocketListener
listener' <- a -> IO (Ptr SocketListener)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
listener
Ptr Socket
socket' <- b -> IO (Ptr Socket)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
socket
Ptr Object
maybeSourceObject <- case Maybe c
sourceObject of
Nothing -> Ptr Object -> IO (Ptr Object)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
forall a. Ptr a
nullPtr
Just jSourceObject :: c
jSourceObject -> do
Ptr Object
jSourceObject' <- c -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jSourceObject
Ptr Object -> IO (Ptr Object)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
jSourceObject'
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr SocketListener
-> Ptr Socket -> Ptr Object -> Ptr (Ptr GError) -> IO CInt
g_socket_listener_add_socket Ptr SocketListener
listener' Ptr Socket
socket' Ptr Object
maybeSourceObject
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
listener
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
socket
Maybe c -> (c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
sourceObject c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data SocketListenerAddSocketMethodInfo
instance (signature ~ (b -> Maybe (c) -> m ()), MonadIO m, IsSocketListener a, Gio.Socket.IsSocket b, GObject.Object.IsObject c) => O.MethodInfo SocketListenerAddSocketMethodInfo a signature where
overloadedMethod = socketListenerAddSocket
#endif
foreign import ccall "g_socket_listener_close" g_socket_listener_close ::
Ptr SocketListener ->
IO ()
socketListenerClose ::
(B.CallStack.HasCallStack, MonadIO m, IsSocketListener a) =>
a
-> m ()
socketListenerClose :: a -> m ()
socketListenerClose listener :: a
listener = 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 SocketListener
listener' <- a -> IO (Ptr SocketListener)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
listener
Ptr SocketListener -> IO ()
g_socket_listener_close Ptr SocketListener
listener'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
listener
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data SocketListenerCloseMethodInfo
instance (signature ~ (m ()), MonadIO m, IsSocketListener a) => O.MethodInfo SocketListenerCloseMethodInfo a signature where
overloadedMethod = socketListenerClose
#endif
foreign import ccall "g_socket_listener_set_backlog" g_socket_listener_set_backlog ::
Ptr SocketListener ->
Int32 ->
IO ()
socketListenerSetBacklog ::
(B.CallStack.HasCallStack, MonadIO m, IsSocketListener a) =>
a
-> Int32
-> m ()
socketListenerSetBacklog :: a -> Int32 -> m ()
socketListenerSetBacklog listener :: a
listener listenBacklog :: Int32
listenBacklog = 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 SocketListener
listener' <- a -> IO (Ptr SocketListener)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
listener
Ptr SocketListener -> Int32 -> IO ()
g_socket_listener_set_backlog Ptr SocketListener
listener' Int32
listenBacklog
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
listener
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data SocketListenerSetBacklogMethodInfo
instance (signature ~ (Int32 -> m ()), MonadIO m, IsSocketListener a) => O.MethodInfo SocketListenerSetBacklogMethodInfo a signature where
overloadedMethod = socketListenerSetBacklog
#endif