#define ENABLE_OVERLOADING \
(!defined(__HADDOCK_VERSION__))
module GI.Gio.Interfaces.NetworkMonitor
(
NetworkMonitor(..) ,
noNetworkMonitor ,
IsNetworkMonitor ,
toNetworkMonitor ,
#if ENABLE_OVERLOADING
NetworkMonitorCanReachMethodInfo ,
#endif
networkMonitorCanReach ,
#if ENABLE_OVERLOADING
NetworkMonitorCanReachAsyncMethodInfo ,
#endif
networkMonitorCanReachAsync ,
#if ENABLE_OVERLOADING
NetworkMonitorCanReachFinishMethodInfo ,
#endif
networkMonitorCanReachFinish ,
#if ENABLE_OVERLOADING
NetworkMonitorGetConnectivityMethodInfo ,
#endif
networkMonitorGetConnectivity ,
networkMonitorGetDefault ,
#if ENABLE_OVERLOADING
NetworkMonitorGetNetworkAvailableMethodInfo,
#endif
networkMonitorGetNetworkAvailable ,
#if ENABLE_OVERLOADING
NetworkMonitorGetNetworkMeteredMethodInfo,
#endif
networkMonitorGetNetworkMetered ,
#if ENABLE_OVERLOADING
NetworkMonitorConnectivityPropertyInfo ,
#endif
getNetworkMonitorConnectivity ,
#if ENABLE_OVERLOADING
networkMonitorConnectivity ,
#endif
#if ENABLE_OVERLOADING
NetworkMonitorNetworkAvailablePropertyInfo,
#endif
getNetworkMonitorNetworkAvailable ,
#if ENABLE_OVERLOADING
networkMonitorNetworkAvailable ,
#endif
#if ENABLE_OVERLOADING
NetworkMonitorNetworkMeteredPropertyInfo,
#endif
getNetworkMonitorNetworkMetered ,
#if ENABLE_OVERLOADING
networkMonitorNetworkMetered ,
#endif
C_NetworkMonitorNetworkChangedCallback ,
NetworkMonitorNetworkChangedCallback ,
#if ENABLE_OVERLOADING
NetworkMonitorNetworkChangedSignalInfo ,
#endif
afterNetworkMonitorNetworkChanged ,
genClosure_NetworkMonitorNetworkChanged ,
mk_NetworkMonitorNetworkChangedCallback ,
noNetworkMonitorNetworkChangedCallback ,
onNetworkMonitorNetworkChanged ,
wrap_NetworkMonitorNetworkChangedCallback,
) 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.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.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
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.Interfaces.Initable as Gio.Initable
import {-# SOURCE #-} qualified GI.Gio.Interfaces.SocketConnectable as Gio.SocketConnectable
import {-# SOURCE #-} qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
newtype NetworkMonitor = NetworkMonitor (ManagedPtr NetworkMonitor)
noNetworkMonitor :: Maybe NetworkMonitor
noNetworkMonitor :: Maybe NetworkMonitor
noNetworkMonitor = Maybe NetworkMonitor
forall a. Maybe a
Nothing
type NetworkMonitorNetworkChangedCallback =
Bool
-> IO ()
noNetworkMonitorNetworkChangedCallback :: Maybe NetworkMonitorNetworkChangedCallback
noNetworkMonitorNetworkChangedCallback :: Maybe NetworkMonitorNetworkChangedCallback
noNetworkMonitorNetworkChangedCallback = Maybe NetworkMonitorNetworkChangedCallback
forall a. Maybe a
Nothing
type C_NetworkMonitorNetworkChangedCallback =
Ptr () ->
CInt ->
Ptr () ->
IO ()
foreign import ccall "wrapper"
mk_NetworkMonitorNetworkChangedCallback :: C_NetworkMonitorNetworkChangedCallback -> IO (FunPtr C_NetworkMonitorNetworkChangedCallback)
genClosure_NetworkMonitorNetworkChanged :: NetworkMonitorNetworkChangedCallback -> IO Closure
genClosure_NetworkMonitorNetworkChanged :: NetworkMonitorNetworkChangedCallback -> IO Closure
genClosure_NetworkMonitorNetworkChanged cb :: NetworkMonitorNetworkChangedCallback
cb = do
let cb' :: C_NetworkMonitorNetworkChangedCallback
cb' = NetworkMonitorNetworkChangedCallback
-> C_NetworkMonitorNetworkChangedCallback
wrap_NetworkMonitorNetworkChangedCallback NetworkMonitorNetworkChangedCallback
cb
C_NetworkMonitorNetworkChangedCallback
-> IO (FunPtr C_NetworkMonitorNetworkChangedCallback)
mk_NetworkMonitorNetworkChangedCallback C_NetworkMonitorNetworkChangedCallback
cb' IO (FunPtr C_NetworkMonitorNetworkChangedCallback)
-> (FunPtr C_NetworkMonitorNetworkChangedCallback -> IO Closure)
-> IO Closure
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_NetworkMonitorNetworkChangedCallback -> IO Closure
forall a. FunPtr a -> IO Closure
newCClosure
wrap_NetworkMonitorNetworkChangedCallback ::
NetworkMonitorNetworkChangedCallback ->
C_NetworkMonitorNetworkChangedCallback
wrap_NetworkMonitorNetworkChangedCallback :: NetworkMonitorNetworkChangedCallback
-> C_NetworkMonitorNetworkChangedCallback
wrap_NetworkMonitorNetworkChangedCallback _cb :: NetworkMonitorNetworkChangedCallback
_cb _ networkAvailable :: CInt
networkAvailable _ = do
let networkAvailable' :: Bool
networkAvailable' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
networkAvailable
NetworkMonitorNetworkChangedCallback
_cb Bool
networkAvailable'
onNetworkMonitorNetworkChanged :: (IsNetworkMonitor a, MonadIO m) => a -> NetworkMonitorNetworkChangedCallback -> m SignalHandlerId
onNetworkMonitorNetworkChanged :: a -> NetworkMonitorNetworkChangedCallback -> m SignalHandlerId
onNetworkMonitorNetworkChanged obj :: a
obj cb :: NetworkMonitorNetworkChangedCallback
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_NetworkMonitorNetworkChangedCallback
cb' = NetworkMonitorNetworkChangedCallback
-> C_NetworkMonitorNetworkChangedCallback
wrap_NetworkMonitorNetworkChangedCallback NetworkMonitorNetworkChangedCallback
cb
FunPtr C_NetworkMonitorNetworkChangedCallback
cb'' <- C_NetworkMonitorNetworkChangedCallback
-> IO (FunPtr C_NetworkMonitorNetworkChangedCallback)
mk_NetworkMonitorNetworkChangedCallback C_NetworkMonitorNetworkChangedCallback
cb'
a
-> String
-> FunPtr C_NetworkMonitorNetworkChangedCallback
-> SignalConnectMode
-> IO SignalHandlerId
forall o a.
GObject o =>
o -> String -> FunPtr a -> SignalConnectMode -> IO SignalHandlerId
connectSignalFunPtr a
obj "network-changed" FunPtr C_NetworkMonitorNetworkChangedCallback
cb'' SignalConnectMode
SignalConnectBefore
afterNetworkMonitorNetworkChanged :: (IsNetworkMonitor a, MonadIO m) => a -> NetworkMonitorNetworkChangedCallback -> m SignalHandlerId
afterNetworkMonitorNetworkChanged :: a -> NetworkMonitorNetworkChangedCallback -> m SignalHandlerId
afterNetworkMonitorNetworkChanged obj :: a
obj cb :: NetworkMonitorNetworkChangedCallback
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_NetworkMonitorNetworkChangedCallback
cb' = NetworkMonitorNetworkChangedCallback
-> C_NetworkMonitorNetworkChangedCallback
wrap_NetworkMonitorNetworkChangedCallback NetworkMonitorNetworkChangedCallback
cb
FunPtr C_NetworkMonitorNetworkChangedCallback
cb'' <- C_NetworkMonitorNetworkChangedCallback
-> IO (FunPtr C_NetworkMonitorNetworkChangedCallback)
mk_NetworkMonitorNetworkChangedCallback C_NetworkMonitorNetworkChangedCallback
cb'
a
-> String
-> FunPtr C_NetworkMonitorNetworkChangedCallback
-> SignalConnectMode
-> IO SignalHandlerId
forall o a.
GObject o =>
o -> String -> FunPtr a -> SignalConnectMode -> IO SignalHandlerId
connectSignalFunPtr a
obj "network-changed" FunPtr C_NetworkMonitorNetworkChangedCallback
cb'' SignalConnectMode
SignalConnectAfter
#if ENABLE_OVERLOADING
data NetworkMonitorNetworkChangedSignalInfo
instance SignalInfo NetworkMonitorNetworkChangedSignalInfo where
type HaskellCallbackType NetworkMonitorNetworkChangedSignalInfo = NetworkMonitorNetworkChangedCallback
connectSignal _ obj cb connectMode = do
let cb' = wrap_NetworkMonitorNetworkChangedCallback cb
cb'' <- mk_NetworkMonitorNetworkChangedCallback cb'
connectSignalFunPtr obj "network-changed" cb'' connectMode
type instance O.SignalList NetworkMonitor = NetworkMonitorSignalList
type NetworkMonitorSignalList = ('[ '("networkChanged", NetworkMonitorNetworkChangedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "g_network_monitor_get_type"
c_g_network_monitor_get_type :: IO GType
instance GObject NetworkMonitor where
gobjectType :: NetworkMonitor -> IO GType
gobjectType _ = IO GType
c_g_network_monitor_get_type
class GObject o => IsNetworkMonitor o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError NetworkMonitor a) =>
IsNetworkMonitor a
#endif
instance IsNetworkMonitor NetworkMonitor
instance Gio.Initable.IsInitable NetworkMonitor
instance GObject.Object.IsObject NetworkMonitor
toNetworkMonitor :: (MonadIO m, IsNetworkMonitor o) => o -> m NetworkMonitor
toNetworkMonitor :: o -> m NetworkMonitor
toNetworkMonitor = IO NetworkMonitor -> m NetworkMonitor
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO NetworkMonitor -> m NetworkMonitor)
-> (o -> IO NetworkMonitor) -> o -> m NetworkMonitor
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr NetworkMonitor -> NetworkMonitor)
-> o -> IO NetworkMonitor
forall o o'.
(HasCallStack, GObject o, GObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr NetworkMonitor -> NetworkMonitor
NetworkMonitor
getNetworkMonitorConnectivity :: (MonadIO m, IsNetworkMonitor o) => o -> m Gio.Enums.NetworkConnectivity
getNetworkMonitorConnectivity :: o -> m NetworkConnectivity
getNetworkMonitorConnectivity obj :: o
obj = IO NetworkConnectivity -> m NetworkConnectivity
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO NetworkConnectivity -> m NetworkConnectivity)
-> IO NetworkConnectivity -> m NetworkConnectivity
forall a b. (a -> b) -> a -> b
$ o -> String -> IO NetworkConnectivity
forall a b. (GObject a, Enum b, BoxedEnum b) => a -> String -> IO b
getObjectPropertyEnum o
obj "connectivity"
#if ENABLE_OVERLOADING
data NetworkMonitorConnectivityPropertyInfo
instance AttrInfo NetworkMonitorConnectivityPropertyInfo where
type AttrAllowedOps NetworkMonitorConnectivityPropertyInfo = '[ 'AttrGet]
type AttrSetTypeConstraint NetworkMonitorConnectivityPropertyInfo = (~) ()
type AttrBaseTypeConstraint NetworkMonitorConnectivityPropertyInfo = IsNetworkMonitor
type AttrGetType NetworkMonitorConnectivityPropertyInfo = Gio.Enums.NetworkConnectivity
type AttrLabel NetworkMonitorConnectivityPropertyInfo = "connectivity"
type AttrOrigin NetworkMonitorConnectivityPropertyInfo = NetworkMonitor
attrGet _ = getNetworkMonitorConnectivity
attrSet _ = undefined
attrConstruct _ = undefined
attrClear _ = undefined
#endif
getNetworkMonitorNetworkAvailable :: (MonadIO m, IsNetworkMonitor o) => o -> m Bool
getNetworkMonitorNetworkAvailable :: o -> m Bool
getNetworkMonitorNetworkAvailable obj :: o
obj = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ o -> String -> IO Bool
forall a. GObject a => a -> String -> IO Bool
getObjectPropertyBool o
obj "network-available"
#if ENABLE_OVERLOADING
data NetworkMonitorNetworkAvailablePropertyInfo
instance AttrInfo NetworkMonitorNetworkAvailablePropertyInfo where
type AttrAllowedOps NetworkMonitorNetworkAvailablePropertyInfo = '[ 'AttrGet]
type AttrSetTypeConstraint NetworkMonitorNetworkAvailablePropertyInfo = (~) ()
type AttrBaseTypeConstraint NetworkMonitorNetworkAvailablePropertyInfo = IsNetworkMonitor
type AttrGetType NetworkMonitorNetworkAvailablePropertyInfo = Bool
type AttrLabel NetworkMonitorNetworkAvailablePropertyInfo = "network-available"
type AttrOrigin NetworkMonitorNetworkAvailablePropertyInfo = NetworkMonitor
attrGet _ = getNetworkMonitorNetworkAvailable
attrSet _ = undefined
attrConstruct _ = undefined
attrClear _ = undefined
#endif
getNetworkMonitorNetworkMetered :: (MonadIO m, IsNetworkMonitor o) => o -> m Bool
getNetworkMonitorNetworkMetered :: o -> m Bool
getNetworkMonitorNetworkMetered obj :: o
obj = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ o -> String -> IO Bool
forall a. GObject a => a -> String -> IO Bool
getObjectPropertyBool o
obj "network-metered"
#if ENABLE_OVERLOADING
data NetworkMonitorNetworkMeteredPropertyInfo
instance AttrInfo NetworkMonitorNetworkMeteredPropertyInfo where
type AttrAllowedOps NetworkMonitorNetworkMeteredPropertyInfo = '[ 'AttrGet]
type AttrSetTypeConstraint NetworkMonitorNetworkMeteredPropertyInfo = (~) ()
type AttrBaseTypeConstraint NetworkMonitorNetworkMeteredPropertyInfo = IsNetworkMonitor
type AttrGetType NetworkMonitorNetworkMeteredPropertyInfo = Bool
type AttrLabel NetworkMonitorNetworkMeteredPropertyInfo = "network-metered"
type AttrOrigin NetworkMonitorNetworkMeteredPropertyInfo = NetworkMonitor
attrGet _ = getNetworkMonitorNetworkMetered
attrSet _ = undefined
attrConstruct _ = undefined
attrClear _ = undefined
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList NetworkMonitor
type instance O.AttributeList NetworkMonitor = NetworkMonitorAttributeList
type NetworkMonitorAttributeList = ('[ '("connectivity", NetworkMonitorConnectivityPropertyInfo), '("networkAvailable", NetworkMonitorNetworkAvailablePropertyInfo), '("networkMetered", NetworkMonitorNetworkMeteredPropertyInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
networkMonitorConnectivity :: AttrLabelProxy "connectivity"
networkMonitorConnectivity = AttrLabelProxy
networkMonitorNetworkAvailable :: AttrLabelProxy "networkAvailable"
networkMonitorNetworkAvailable = AttrLabelProxy
networkMonitorNetworkMetered :: AttrLabelProxy "networkMetered"
networkMonitorNetworkMetered = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
type family ResolveNetworkMonitorMethod (t :: Symbol) (o :: *) :: * where
ResolveNetworkMonitorMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveNetworkMonitorMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveNetworkMonitorMethod "canReach" o = NetworkMonitorCanReachMethodInfo
ResolveNetworkMonitorMethod "canReachAsync" o = NetworkMonitorCanReachAsyncMethodInfo
ResolveNetworkMonitorMethod "canReachFinish" o = NetworkMonitorCanReachFinishMethodInfo
ResolveNetworkMonitorMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveNetworkMonitorMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveNetworkMonitorMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveNetworkMonitorMethod "init" o = Gio.Initable.InitableInitMethodInfo
ResolveNetworkMonitorMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveNetworkMonitorMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveNetworkMonitorMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveNetworkMonitorMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveNetworkMonitorMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveNetworkMonitorMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveNetworkMonitorMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveNetworkMonitorMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveNetworkMonitorMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveNetworkMonitorMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveNetworkMonitorMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveNetworkMonitorMethod "getConnectivity" o = NetworkMonitorGetConnectivityMethodInfo
ResolveNetworkMonitorMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveNetworkMonitorMethod "getNetworkAvailable" o = NetworkMonitorGetNetworkAvailableMethodInfo
ResolveNetworkMonitorMethod "getNetworkMetered" o = NetworkMonitorGetNetworkMeteredMethodInfo
ResolveNetworkMonitorMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveNetworkMonitorMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveNetworkMonitorMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveNetworkMonitorMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveNetworkMonitorMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveNetworkMonitorMethod t NetworkMonitor, O.MethodInfo info NetworkMonitor p) => O.IsLabelProxy t (NetworkMonitor -> p) where
fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveNetworkMonitorMethod t NetworkMonitor, O.MethodInfo info NetworkMonitor p) => O.IsLabel t (NetworkMonitor -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif
#endif
foreign import ccall "g_network_monitor_can_reach" g_network_monitor_can_reach ::
Ptr NetworkMonitor ->
Ptr Gio.SocketConnectable.SocketConnectable ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO CInt
networkMonitorCanReach ::
(B.CallStack.HasCallStack, MonadIO m, IsNetworkMonitor a, Gio.SocketConnectable.IsSocketConnectable b, Gio.Cancellable.IsCancellable c) =>
a
-> b
-> Maybe (c)
-> m ()
networkMonitorCanReach :: a -> b -> Maybe c -> m ()
networkMonitorCanReach monitor :: a
monitor connectable :: b
connectable cancellable :: Maybe c
cancellable = 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 NetworkMonitor
monitor' <- a -> IO (Ptr NetworkMonitor)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
monitor
Ptr SocketConnectable
connectable' <- b -> IO (Ptr SocketConnectable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
connectable
Ptr Cancellable
maybeCancellable <- case Maybe c
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 :: c
jCancellable -> do
Ptr Cancellable
jCancellable' <- c -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
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 NetworkMonitor
-> Ptr SocketConnectable
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO CInt
g_network_monitor_can_reach Ptr NetworkMonitor
monitor' Ptr SocketConnectable
connectable' Ptr Cancellable
maybeCancellable
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
monitor
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
connectable
Maybe c -> (c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
cancellable 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 ENABLE_OVERLOADING
data NetworkMonitorCanReachMethodInfo
instance (signature ~ (b -> Maybe (c) -> m ()), MonadIO m, IsNetworkMonitor a, Gio.SocketConnectable.IsSocketConnectable b, Gio.Cancellable.IsCancellable c) => O.MethodInfo NetworkMonitorCanReachMethodInfo a signature where
overloadedMethod _ = networkMonitorCanReach
#endif
foreign import ccall "g_network_monitor_can_reach_async" g_network_monitor_can_reach_async ::
Ptr NetworkMonitor ->
Ptr Gio.SocketConnectable.SocketConnectable ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
networkMonitorCanReachAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsNetworkMonitor a, Gio.SocketConnectable.IsSocketConnectable b, Gio.Cancellable.IsCancellable c) =>
a
-> b
-> Maybe (c)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
networkMonitorCanReachAsync :: a -> b -> Maybe c -> Maybe AsyncReadyCallback -> m ()
networkMonitorCanReachAsync monitor :: a
monitor connectable :: b
connectable cancellable :: Maybe c
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 NetworkMonitor
monitor' <- a -> IO (Ptr NetworkMonitor)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
monitor
Ptr SocketConnectable
connectable' <- b -> IO (Ptr SocketConnectable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
connectable
Ptr Cancellable
maybeCancellable <- case Maybe c
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 :: c
jCancellable -> do
Ptr Cancellable
jCancellable' <- c -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
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 NetworkMonitor
-> Ptr SocketConnectable
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_network_monitor_can_reach_async Ptr NetworkMonitor
monitor' Ptr SocketConnectable
connectable' Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
monitor
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
connectable
Maybe c -> (c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
cancellable c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if ENABLE_OVERLOADING
data NetworkMonitorCanReachAsyncMethodInfo
instance (signature ~ (b -> Maybe (c) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsNetworkMonitor a, Gio.SocketConnectable.IsSocketConnectable b, Gio.Cancellable.IsCancellable c) => O.MethodInfo NetworkMonitorCanReachAsyncMethodInfo a signature where
overloadedMethod _ = networkMonitorCanReachAsync
#endif
foreign import ccall "g_network_monitor_can_reach_finish" g_network_monitor_can_reach_finish ::
Ptr NetworkMonitor ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO CInt
networkMonitorCanReachFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsNetworkMonitor a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m ()
networkMonitorCanReachFinish :: a -> b -> m ()
networkMonitorCanReachFinish monitor :: a
monitor result_ :: b
result_ = 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 NetworkMonitor
monitor' <- a -> IO (Ptr NetworkMonitor)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
monitor
Ptr AsyncResult
result_' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
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 NetworkMonitor
-> Ptr AsyncResult -> Ptr (Ptr GError) -> IO CInt
g_network_monitor_can_reach_finish Ptr NetworkMonitor
monitor' Ptr AsyncResult
result_'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
monitor
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if ENABLE_OVERLOADING
data NetworkMonitorCanReachFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsNetworkMonitor a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo NetworkMonitorCanReachFinishMethodInfo a signature where
overloadedMethod _ = networkMonitorCanReachFinish
#endif
foreign import ccall "g_network_monitor_get_connectivity" g_network_monitor_get_connectivity ::
Ptr NetworkMonitor ->
IO CUInt
networkMonitorGetConnectivity ::
(B.CallStack.HasCallStack, MonadIO m, IsNetworkMonitor a) =>
a
-> m Gio.Enums.NetworkConnectivity
networkMonitorGetConnectivity :: a -> m NetworkConnectivity
networkMonitorGetConnectivity monitor :: a
monitor = IO NetworkConnectivity -> m NetworkConnectivity
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO NetworkConnectivity -> m NetworkConnectivity)
-> IO NetworkConnectivity -> m NetworkConnectivity
forall a b. (a -> b) -> a -> b
$ do
Ptr NetworkMonitor
monitor' <- a -> IO (Ptr NetworkMonitor)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
monitor
CUInt
result <- Ptr NetworkMonitor -> IO CUInt
g_network_monitor_get_connectivity Ptr NetworkMonitor
monitor'
let result' :: NetworkConnectivity
result' = (Int -> NetworkConnectivity
forall a. Enum a => Int -> a
toEnum (Int -> NetworkConnectivity)
-> (CUInt -> Int) -> CUInt -> NetworkConnectivity
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
monitor
NetworkConnectivity -> IO NetworkConnectivity
forall (m :: * -> *) a. Monad m => a -> m a
return NetworkConnectivity
result'
#if ENABLE_OVERLOADING
data NetworkMonitorGetConnectivityMethodInfo
instance (signature ~ (m Gio.Enums.NetworkConnectivity), MonadIO m, IsNetworkMonitor a) => O.MethodInfo NetworkMonitorGetConnectivityMethodInfo a signature where
overloadedMethod _ = networkMonitorGetConnectivity
#endif
foreign import ccall "g_network_monitor_get_network_available" g_network_monitor_get_network_available ::
Ptr NetworkMonitor ->
IO CInt
networkMonitorGetNetworkAvailable ::
(B.CallStack.HasCallStack, MonadIO m, IsNetworkMonitor a) =>
a
-> m Bool
networkMonitorGetNetworkAvailable :: a -> m Bool
networkMonitorGetNetworkAvailable monitor :: a
monitor = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr NetworkMonitor
monitor' <- a -> IO (Ptr NetworkMonitor)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
monitor
CInt
result <- Ptr NetworkMonitor -> IO CInt
g_network_monitor_get_network_available Ptr NetworkMonitor
monitor'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
monitor
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if ENABLE_OVERLOADING
data NetworkMonitorGetNetworkAvailableMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsNetworkMonitor a) => O.MethodInfo NetworkMonitorGetNetworkAvailableMethodInfo a signature where
overloadedMethod _ = networkMonitorGetNetworkAvailable
#endif
foreign import ccall "g_network_monitor_get_network_metered" g_network_monitor_get_network_metered ::
Ptr NetworkMonitor ->
IO CInt
networkMonitorGetNetworkMetered ::
(B.CallStack.HasCallStack, MonadIO m, IsNetworkMonitor a) =>
a
-> m Bool
networkMonitorGetNetworkMetered :: a -> m Bool
networkMonitorGetNetworkMetered monitor :: a
monitor = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr NetworkMonitor
monitor' <- a -> IO (Ptr NetworkMonitor)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
monitor
CInt
result <- Ptr NetworkMonitor -> IO CInt
g_network_monitor_get_network_metered Ptr NetworkMonitor
monitor'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
monitor
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if ENABLE_OVERLOADING
data NetworkMonitorGetNetworkMeteredMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsNetworkMonitor a) => O.MethodInfo NetworkMonitorGetNetworkMeteredMethodInfo a signature where
overloadedMethod _ = networkMonitorGetNetworkMetered
#endif
foreign import ccall "g_network_monitor_get_default" g_network_monitor_get_default ::
IO (Ptr NetworkMonitor)
networkMonitorGetDefault ::
(B.CallStack.HasCallStack, MonadIO m) =>
m NetworkMonitor
networkMonitorGetDefault :: m NetworkMonitor
networkMonitorGetDefault = IO NetworkMonitor -> m NetworkMonitor
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO NetworkMonitor -> m NetworkMonitor)
-> IO NetworkMonitor -> m NetworkMonitor
forall a b. (a -> b) -> a -> b
$ do
Ptr NetworkMonitor
result <- IO (Ptr NetworkMonitor)
g_network_monitor_get_default
Text -> Ptr NetworkMonitor -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "networkMonitorGetDefault" Ptr NetworkMonitor
result
NetworkMonitor
result' <- ((ManagedPtr NetworkMonitor -> NetworkMonitor)
-> Ptr NetworkMonitor -> IO NetworkMonitor
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr NetworkMonitor -> NetworkMonitor
NetworkMonitor) Ptr NetworkMonitor
result
NetworkMonitor -> IO NetworkMonitor
forall (m :: * -> *) a. Monad m => a -> m a
return NetworkMonitor
result'
#if ENABLE_OVERLOADING
#endif