{-# LANGUAGE ImplicitParams, RankNTypes, TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- t'GI.Gio.Interfaces.NetworkMonitor.NetworkMonitor' provides an easy-to-use cross-platform API
-- for monitoring network connectivity. On Linux, the available
-- implementations are based on the kernel\'s netlink interface and
-- on NetworkManager.
-- 
-- There is also an implementation for use inside Flatpak sandboxes.
-- 
-- /Since: 2.32/

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.Gio.Interfaces.NetworkMonitor
    ( 

-- * Exported types
    NetworkMonitor(..)                      ,
    IsNetworkMonitor                        ,
    toNetworkMonitor                        ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [bindProperty]("GI.GObject.Objects.Object#g:method:bindProperty"), [bindPropertyFull]("GI.GObject.Objects.Object#g:method:bindPropertyFull"), [canReach]("GI.Gio.Interfaces.NetworkMonitor#g:method:canReach"), [canReachAsync]("GI.Gio.Interfaces.NetworkMonitor#g:method:canReachAsync"), [canReachFinish]("GI.Gio.Interfaces.NetworkMonitor#g:method:canReachFinish"), [forceFloating]("GI.GObject.Objects.Object#g:method:forceFloating"), [freezeNotify]("GI.GObject.Objects.Object#g:method:freezeNotify"), [getv]("GI.GObject.Objects.Object#g:method:getv"), [init]("GI.Gio.Interfaces.Initable#g:method:init"), [isFloating]("GI.GObject.Objects.Object#g:method:isFloating"), [notify]("GI.GObject.Objects.Object#g:method:notify"), [notifyByPspec]("GI.GObject.Objects.Object#g:method:notifyByPspec"), [ref]("GI.GObject.Objects.Object#g:method:ref"), [refSink]("GI.GObject.Objects.Object#g:method:refSink"), [runDispose]("GI.GObject.Objects.Object#g:method:runDispose"), [stealData]("GI.GObject.Objects.Object#g:method:stealData"), [stealQdata]("GI.GObject.Objects.Object#g:method:stealQdata"), [thawNotify]("GI.GObject.Objects.Object#g:method:thawNotify"), [unref]("GI.GObject.Objects.Object#g:method:unref"), [watchClosure]("GI.GObject.Objects.Object#g:method:watchClosure").
-- 
-- ==== Getters
-- [getConnectivity]("GI.Gio.Interfaces.NetworkMonitor#g:method:getConnectivity"), [getData]("GI.GObject.Objects.Object#g:method:getData"), [getNetworkAvailable]("GI.Gio.Interfaces.NetworkMonitor#g:method:getNetworkAvailable"), [getNetworkMetered]("GI.Gio.Interfaces.NetworkMonitor#g:method:getNetworkMetered"), [getProperty]("GI.GObject.Objects.Object#g:method:getProperty"), [getQdata]("GI.GObject.Objects.Object#g:method:getQdata").
-- 
-- ==== Setters
-- [setData]("GI.GObject.Objects.Object#g:method:setData"), [setDataFull]("GI.GObject.Objects.Object#g:method:setDataFull"), [setProperty]("GI.GObject.Objects.Object#g:method:setProperty").

#if defined(ENABLE_OVERLOADING)
    ResolveNetworkMonitorMethod             ,
#endif

-- ** canReach #method:canReach#

#if defined(ENABLE_OVERLOADING)
    NetworkMonitorCanReachMethodInfo        ,
#endif
    networkMonitorCanReach                  ,


-- ** canReachAsync #method:canReachAsync#

#if defined(ENABLE_OVERLOADING)
    NetworkMonitorCanReachAsyncMethodInfo   ,
#endif
    networkMonitorCanReachAsync             ,


-- ** canReachFinish #method:canReachFinish#

#if defined(ENABLE_OVERLOADING)
    NetworkMonitorCanReachFinishMethodInfo  ,
#endif
    networkMonitorCanReachFinish            ,


-- ** getConnectivity #method:getConnectivity#

#if defined(ENABLE_OVERLOADING)
    NetworkMonitorGetConnectivityMethodInfo ,
#endif
    networkMonitorGetConnectivity           ,


-- ** getDefault #method:getDefault#

    networkMonitorGetDefault                ,


-- ** getNetworkAvailable #method:getNetworkAvailable#

#if defined(ENABLE_OVERLOADING)
    NetworkMonitorGetNetworkAvailableMethodInfo,
#endif
    networkMonitorGetNetworkAvailable       ,


-- ** getNetworkMetered #method:getNetworkMetered#

#if defined(ENABLE_OVERLOADING)
    NetworkMonitorGetNetworkMeteredMethodInfo,
#endif
    networkMonitorGetNetworkMetered         ,




 -- * Properties


-- ** connectivity #attr:connectivity#
-- | More detailed information about the host\'s network connectivity.
-- See 'GI.Gio.Interfaces.NetworkMonitor.networkMonitorGetConnectivity' and
-- t'GI.Gio.Enums.NetworkConnectivity' for more details.
-- 
-- /Since: 2.44/

#if defined(ENABLE_OVERLOADING)
    NetworkMonitorConnectivityPropertyInfo  ,
#endif
    getNetworkMonitorConnectivity           ,
#if defined(ENABLE_OVERLOADING)
    networkMonitorConnectivity              ,
#endif


-- ** networkAvailable #attr:networkAvailable#
-- | Whether the network is considered available. That is, whether the
-- system has a default route for at least one of IPv4 or IPv6.
-- 
-- Real-world networks are of course much more complicated than
-- this; the machine may be connected to a wifi hotspot that
-- requires payment before allowing traffic through, or may be
-- connected to a functioning router that has lost its own upstream
-- connectivity. Some hosts might only be accessible when a VPN is
-- active. Other hosts might only be accessible when the VPN is
-- not active. Thus, it is best to use 'GI.Gio.Interfaces.NetworkMonitor.networkMonitorCanReach'
-- or 'GI.Gio.Interfaces.NetworkMonitor.networkMonitorCanReachAsync' to test for reachability
-- on a host-by-host basis. (On the other hand, when the property is
-- 'P.False', the application can reasonably expect that no remote
-- hosts at all are reachable, and should indicate this to the user
-- in its UI.)
-- 
-- See also [NetworkMonitor::networkChanged]("GI.Gio.Interfaces.NetworkMonitor#g:signal:networkChanged").
-- 
-- /Since: 2.32/

#if defined(ENABLE_OVERLOADING)
    NetworkMonitorNetworkAvailablePropertyInfo,
#endif
    getNetworkMonitorNetworkAvailable       ,
#if defined(ENABLE_OVERLOADING)
    networkMonitorNetworkAvailable          ,
#endif


-- ** networkMetered #attr:networkMetered#
-- | Whether the network is considered metered. That is, whether the
-- system has traffic flowing through the default connection that is
-- subject to limitations set by service providers. For example, traffic
-- might be billed by the amount of data transmitted, or there might be a
-- quota on the amount of traffic per month. This is typical with tethered
-- connections (3G and 4G) and in such situations, bandwidth intensive
-- applications may wish to avoid network activity where possible if it will
-- cost the user money or use up their limited quota.
-- 
-- If more information is required about specific devices then the
-- system network management API should be used instead (for example,
-- NetworkManager or ConnMan).
-- 
-- If this information is not available then no networks will be
-- marked as metered.
-- 
-- See also t'GI.Gio.Interfaces.NetworkMonitor.NetworkMonitor':@/network-available/@.
-- 
-- /Since: 2.46/

#if defined(ENABLE_OVERLOADING)
    NetworkMonitorNetworkMeteredPropertyInfo,
#endif
    getNetworkMonitorNetworkMetered         ,
#if defined(ENABLE_OVERLOADING)
    networkMonitorNetworkMetered            ,
#endif




 -- * Signals


-- ** networkChanged #signal:networkChanged#

    NetworkMonitorNetworkChangedCallback    ,
#if defined(ENABLE_OVERLOADING)
    NetworkMonitorNetworkChangedSignalInfo  ,
#endif
    afterNetworkMonitorNetworkChanged       ,
    onNetworkMonitorNetworkChanged          ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
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 GHC.Records as R

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

-- interface NetworkMonitor 
-- | Memory-managed wrapper type.
newtype NetworkMonitor = NetworkMonitor (SP.ManagedPtr NetworkMonitor)
    deriving (NetworkMonitor -> NetworkMonitor -> Bool
(NetworkMonitor -> NetworkMonitor -> Bool)
-> (NetworkMonitor -> NetworkMonitor -> Bool) -> Eq NetworkMonitor
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NetworkMonitor -> NetworkMonitor -> Bool
$c/= :: NetworkMonitor -> NetworkMonitor -> Bool
== :: NetworkMonitor -> NetworkMonitor -> Bool
$c== :: NetworkMonitor -> NetworkMonitor -> Bool
Eq)

instance SP.ManagedPtrNewtype NetworkMonitor where
    toManagedPtr :: NetworkMonitor -> ManagedPtr NetworkMonitor
toManagedPtr (NetworkMonitor ManagedPtr NetworkMonitor
p) = ManagedPtr NetworkMonitor
p

foreign import ccall "g_network_monitor_get_type"
    c_g_network_monitor_get_type :: IO B.Types.GType

instance B.Types.TypedObject NetworkMonitor where
    glibType :: IO GType
glibType = IO GType
c_g_network_monitor_get_type

instance B.Types.GObject NetworkMonitor

-- | Type class for types which can be safely cast to `NetworkMonitor`, for instance with `toNetworkMonitor`.
class (SP.GObject o, O.IsDescendantOf NetworkMonitor o) => IsNetworkMonitor o
instance (SP.GObject o, O.IsDescendantOf NetworkMonitor o) => IsNetworkMonitor o

instance O.HasParentTypes NetworkMonitor
type instance O.ParentTypes NetworkMonitor = '[Gio.Initable.Initable, GObject.Object.Object]

-- | Cast to `NetworkMonitor`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toNetworkMonitor :: (MIO.MonadIO m, IsNetworkMonitor o) => o -> m NetworkMonitor
toNetworkMonitor :: forall (m :: * -> *) o.
(MonadIO m, IsNetworkMonitor o) =>
o -> m NetworkMonitor
toNetworkMonitor = IO NetworkMonitor -> m NetworkMonitor
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.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, ManagedPtrNewtype o, TypedObject o,
 ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr NetworkMonitor -> NetworkMonitor
NetworkMonitor

-- | Convert 'NetworkMonitor' to and from 'Data.GI.Base.GValue.GValue'. See 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue (Maybe NetworkMonitor) where
    gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_g_network_monitor_get_type
    gvalueSet_ :: Ptr GValue -> Maybe NetworkMonitor -> IO ()
gvalueSet_ Ptr GValue
gv Maybe NetworkMonitor
P.Nothing = Ptr GValue -> Ptr NetworkMonitor -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr NetworkMonitor
forall a. Ptr a
FP.nullPtr :: FP.Ptr NetworkMonitor)
    gvalueSet_ Ptr GValue
gv (P.Just NetworkMonitor
obj) = NetworkMonitor -> (Ptr NetworkMonitor -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr NetworkMonitor
obj (Ptr GValue -> Ptr NetworkMonitor -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
    gvalueGet_ :: Ptr GValue -> IO (Maybe NetworkMonitor)
gvalueGet_ Ptr GValue
gv = do
        Ptr NetworkMonitor
ptr <- Ptr GValue -> IO (Ptr NetworkMonitor)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr NetworkMonitor)
        if Ptr NetworkMonitor
ptr Ptr NetworkMonitor -> Ptr NetworkMonitor -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr NetworkMonitor
forall a. Ptr a
FP.nullPtr
        then NetworkMonitor -> Maybe NetworkMonitor
forall a. a -> Maybe a
P.Just (NetworkMonitor -> Maybe NetworkMonitor)
-> IO NetworkMonitor -> IO (Maybe NetworkMonitor)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr NetworkMonitor -> NetworkMonitor)
-> Ptr NetworkMonitor -> IO NetworkMonitor
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr NetworkMonitor -> NetworkMonitor
NetworkMonitor Ptr NetworkMonitor
ptr
        else Maybe NetworkMonitor -> IO (Maybe NetworkMonitor)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe NetworkMonitor
forall a. Maybe a
P.Nothing
        
    

-- VVV Prop "connectivity"
   -- Type: TInterface (Name {namespace = "Gio", name = "NetworkConnectivity"})
   -- Flags: [PropertyReadable]
   -- Nullable: (Just False,Nothing)

-- | Get the value of the “@connectivity@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' networkMonitor #connectivity
-- @
getNetworkMonitorConnectivity :: (MonadIO m, IsNetworkMonitor o) => o -> m Gio.Enums.NetworkConnectivity
getNetworkMonitorConnectivity :: forall (m :: * -> *) o.
(MonadIO m, IsNetworkMonitor o) =>
o -> m NetworkConnectivity
getNetworkMonitorConnectivity o
obj = IO NetworkConnectivity -> m NetworkConnectivity
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.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
B.Properties.getObjectPropertyEnum o
obj String
"connectivity"

#if defined(ENABLE_OVERLOADING)
data NetworkMonitorConnectivityPropertyInfo
instance AttrInfo NetworkMonitorConnectivityPropertyInfo where
    type AttrAllowedOps NetworkMonitorConnectivityPropertyInfo = '[ 'AttrGet]
    type AttrBaseTypeConstraint NetworkMonitorConnectivityPropertyInfo = IsNetworkMonitor
    type AttrSetTypeConstraint NetworkMonitorConnectivityPropertyInfo = (~) ()
    type AttrTransferTypeConstraint NetworkMonitorConnectivityPropertyInfo = (~) ()
    type AttrTransferType NetworkMonitorConnectivityPropertyInfo = ()
    type AttrGetType NetworkMonitorConnectivityPropertyInfo = Gio.Enums.NetworkConnectivity
    type AttrLabel NetworkMonitorConnectivityPropertyInfo = "connectivity"
    type AttrOrigin NetworkMonitorConnectivityPropertyInfo = NetworkMonitor
    attrGet = getNetworkMonitorConnectivity
    attrSet = undefined
    attrTransfer _ = undefined
    attrConstruct = undefined
    attrClear = undefined
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Interfaces.NetworkMonitor.connectivity"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.29/docs/GI-Gio-Interfaces-NetworkMonitor.html#g:attr:connectivity"
        })
#endif

-- VVV Prop "network-available"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable]
   -- Nullable: (Just False,Nothing)

-- | Get the value of the “@network-available@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' networkMonitor #networkAvailable
-- @
getNetworkMonitorNetworkAvailable :: (MonadIO m, IsNetworkMonitor o) => o -> m Bool
getNetworkMonitorNetworkAvailable :: forall (m :: * -> *) o.
(MonadIO m, IsNetworkMonitor o) =>
o -> m Bool
getNetworkMonitorNetworkAvailable o
obj = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.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
B.Properties.getObjectPropertyBool o
obj String
"network-available"

#if defined(ENABLE_OVERLOADING)
data NetworkMonitorNetworkAvailablePropertyInfo
instance AttrInfo NetworkMonitorNetworkAvailablePropertyInfo where
    type AttrAllowedOps NetworkMonitorNetworkAvailablePropertyInfo = '[ 'AttrGet]
    type AttrBaseTypeConstraint NetworkMonitorNetworkAvailablePropertyInfo = IsNetworkMonitor
    type AttrSetTypeConstraint NetworkMonitorNetworkAvailablePropertyInfo = (~) ()
    type AttrTransferTypeConstraint NetworkMonitorNetworkAvailablePropertyInfo = (~) ()
    type AttrTransferType NetworkMonitorNetworkAvailablePropertyInfo = ()
    type AttrGetType NetworkMonitorNetworkAvailablePropertyInfo = Bool
    type AttrLabel NetworkMonitorNetworkAvailablePropertyInfo = "network-available"
    type AttrOrigin NetworkMonitorNetworkAvailablePropertyInfo = NetworkMonitor
    attrGet = getNetworkMonitorNetworkAvailable
    attrSet = undefined
    attrTransfer _ = undefined
    attrConstruct = undefined
    attrClear = undefined
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Interfaces.NetworkMonitor.networkAvailable"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.29/docs/GI-Gio-Interfaces-NetworkMonitor.html#g:attr:networkAvailable"
        })
#endif

-- VVV Prop "network-metered"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable]
   -- Nullable: (Just False,Nothing)

-- | Get the value of the “@network-metered@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' networkMonitor #networkMetered
-- @
getNetworkMonitorNetworkMetered :: (MonadIO m, IsNetworkMonitor o) => o -> m Bool
getNetworkMonitorNetworkMetered :: forall (m :: * -> *) o.
(MonadIO m, IsNetworkMonitor o) =>
o -> m Bool
getNetworkMonitorNetworkMetered o
obj = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.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
B.Properties.getObjectPropertyBool o
obj String
"network-metered"

#if defined(ENABLE_OVERLOADING)
data NetworkMonitorNetworkMeteredPropertyInfo
instance AttrInfo NetworkMonitorNetworkMeteredPropertyInfo where
    type AttrAllowedOps NetworkMonitorNetworkMeteredPropertyInfo = '[ 'AttrGet]
    type AttrBaseTypeConstraint NetworkMonitorNetworkMeteredPropertyInfo = IsNetworkMonitor
    type AttrSetTypeConstraint NetworkMonitorNetworkMeteredPropertyInfo = (~) ()
    type AttrTransferTypeConstraint NetworkMonitorNetworkMeteredPropertyInfo = (~) ()
    type AttrTransferType NetworkMonitorNetworkMeteredPropertyInfo = ()
    type AttrGetType NetworkMonitorNetworkMeteredPropertyInfo = Bool
    type AttrLabel NetworkMonitorNetworkMeteredPropertyInfo = "network-metered"
    type AttrOrigin NetworkMonitorNetworkMeteredPropertyInfo = NetworkMonitor
    attrGet = getNetworkMonitorNetworkMetered
    attrSet = undefined
    attrTransfer _ = undefined
    attrConstruct = undefined
    attrClear = undefined
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Interfaces.NetworkMonitor.networkMetered"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.29/docs/GI-Gio-Interfaces-NetworkMonitor.html#g:attr:networkMetered"
        })
#endif

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList NetworkMonitor
type instance O.AttributeList NetworkMonitor = NetworkMonitorAttributeList
type NetworkMonitorAttributeList = ('[ '("connectivity", NetworkMonitorConnectivityPropertyInfo), '("networkAvailable", NetworkMonitorNetworkAvailablePropertyInfo), '("networkMetered", NetworkMonitorNetworkMeteredPropertyInfo)] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING)
networkMonitorConnectivity :: AttrLabelProxy "connectivity"
networkMonitorConnectivity = AttrLabelProxy

networkMonitorNetworkAvailable :: AttrLabelProxy "networkAvailable"
networkMonitorNetworkAvailable = AttrLabelProxy

networkMonitorNetworkMetered :: AttrLabelProxy "networkMetered"
networkMonitorNetworkMetered = AttrLabelProxy

#endif

#if defined(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 "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveNetworkMonitorMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveNetworkMonitorMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveNetworkMonitorMethod t NetworkMonitor, O.OverloadedMethod info NetworkMonitor p) => OL.IsLabel t (NetworkMonitor -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveNetworkMonitorMethod t NetworkMonitor, O.OverloadedMethod info NetworkMonitor p, R.HasField t NetworkMonitor p) => R.HasField t NetworkMonitor p where
    getField = O.overloadedMethod @info

#endif

instance (info ~ ResolveNetworkMonitorMethod t NetworkMonitor, O.OverloadedMethodInfo info NetworkMonitor) => OL.IsLabel t (O.MethodProxy info NetworkMonitor) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.MethodProxy
#else
    fromLabel _ = O.MethodProxy
#endif

#endif

-- method NetworkMonitor::can_reach
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "monitor"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "NetworkMonitor" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GNetworkMonitor" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "connectable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "SocketConnectable" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSocketConnectable"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GCancellable, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_network_monitor_can_reach" g_network_monitor_can_reach :: 
    Ptr NetworkMonitor ->                   -- monitor : TInterface (Name {namespace = "Gio", name = "NetworkMonitor"})
    Ptr Gio.SocketConnectable.SocketConnectable -> -- connectable : TInterface (Name {namespace = "Gio", name = "SocketConnectable"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Attempts to determine whether or not the host pointed to by
-- /@connectable@/ can be reached, without actually trying to connect to
-- it.
-- 
-- This may return 'P.True' even when t'GI.Gio.Interfaces.NetworkMonitor.NetworkMonitor':@/network-available/@
-- is 'P.False', if, for example, /@monitor@/ can determine that
-- /@connectable@/ refers to a host on a local network.
-- 
-- If /@monitor@/ believes that an attempt to connect to /@connectable@/
-- will succeed, it will return 'P.True'. Otherwise, it will return
-- 'P.False' and set /@error@/ to an appropriate error (such as
-- 'GI.Gio.Enums.IOErrorEnumHostUnreachable').
-- 
-- Note that although this does not attempt to connect to
-- /@connectable@/, it may still block for a brief period of time (eg,
-- trying to do multicast DNS on the local network), so if you do not
-- want to block, you should use 'GI.Gio.Interfaces.NetworkMonitor.networkMonitorCanReachAsync'.
-- 
-- /Since: 2.32/
networkMonitorCanReach ::
    (B.CallStack.HasCallStack, MonadIO m, IsNetworkMonitor a, Gio.SocketConnectable.IsSocketConnectable b, Gio.Cancellable.IsCancellable c) =>
    a
    -- ^ /@monitor@/: a t'GI.Gio.Interfaces.NetworkMonitor.NetworkMonitor'
    -> b
    -- ^ /@connectable@/: a t'GI.Gio.Interfaces.SocketConnectable.SocketConnectable'
    -> Maybe (c)
    -- ^ /@cancellable@/: a t'GI.Gio.Objects.Cancellable.Cancellable', or 'P.Nothing'
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
networkMonitorCanReach :: forall (m :: * -> *) a b c.
(HasCallStack, MonadIO m, IsNetworkMonitor a,
 IsSocketConnectable b, IsCancellable c) =>
a -> b -> Maybe c -> m ()
networkMonitorCanReach a
monitor b
connectable 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
        Maybe c
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just 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 defined(ENABLE_OVERLOADING)
data NetworkMonitorCanReachMethodInfo
instance (signature ~ (b -> Maybe (c) -> m ()), MonadIO m, IsNetworkMonitor a, Gio.SocketConnectable.IsSocketConnectable b, Gio.Cancellable.IsCancellable c) => O.OverloadedMethod NetworkMonitorCanReachMethodInfo a signature where
    overloadedMethod = networkMonitorCanReach

instance O.OverloadedMethodInfo NetworkMonitorCanReachMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Interfaces.NetworkMonitor.networkMonitorCanReach",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.29/docs/GI-Gio-Interfaces-NetworkMonitor.html#v:networkMonitorCanReach"
        })


#endif

-- method NetworkMonitor::can_reach_async
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "monitor"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "NetworkMonitor" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GNetworkMonitor" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "connectable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "SocketConnectable" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSocketConnectable"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GCancellable, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "callback"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncReadyCallback" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a #GAsyncReadyCallback to call when the\n    request is satisfied"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeAsync
--           , argClosure = 4
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the data to pass to callback function"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_network_monitor_can_reach_async" g_network_monitor_can_reach_async :: 
    Ptr NetworkMonitor ->                   -- monitor : TInterface (Name {namespace = "Gio", name = "NetworkMonitor"})
    Ptr Gio.SocketConnectable.SocketConnectable -> -- connectable : TInterface (Name {namespace = "Gio", name = "SocketConnectable"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

-- | Asynchronously attempts to determine whether or not the host
-- pointed to by /@connectable@/ can be reached, without actually
-- trying to connect to it.
-- 
-- For more details, see 'GI.Gio.Interfaces.NetworkMonitor.networkMonitorCanReach'.
-- 
-- When the operation is finished, /@callback@/ will be called.
-- You can then call 'GI.Gio.Interfaces.NetworkMonitor.networkMonitorCanReachFinish'
-- to get the result of the operation.
networkMonitorCanReachAsync ::
    (B.CallStack.HasCallStack, MonadIO m, IsNetworkMonitor a, Gio.SocketConnectable.IsSocketConnectable b, Gio.Cancellable.IsCancellable c) =>
    a
    -- ^ /@monitor@/: a t'GI.Gio.Interfaces.NetworkMonitor.NetworkMonitor'
    -> b
    -- ^ /@connectable@/: a t'GI.Gio.Interfaces.SocketConnectable.SocketConnectable'
    -> Maybe (c)
    -- ^ /@cancellable@/: a t'GI.Gio.Objects.Cancellable.Cancellable', or 'P.Nothing'
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    -- ^ /@callback@/: a t'GI.Gio.Callbacks.AsyncReadyCallback' to call when the
    --     request is satisfied
    -> m ()
networkMonitorCanReachAsync :: forall (m :: * -> *) a b c.
(HasCallStack, MonadIO m, IsNetworkMonitor a,
 IsSocketConnectable b, IsCancellable c) =>
a -> b -> Maybe c -> Maybe AsyncReadyCallback -> m ()
networkMonitorCanReachAsync a
monitor b
connectable Maybe c
cancellable 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
        Maybe c
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just 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
        Maybe AsyncReadyCallback
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 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 defined(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.OverloadedMethod NetworkMonitorCanReachAsyncMethodInfo a signature where
    overloadedMethod = networkMonitorCanReachAsync

instance O.OverloadedMethodInfo NetworkMonitorCanReachAsyncMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Interfaces.NetworkMonitor.networkMonitorCanReachAsync",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.29/docs/GI-Gio-Interfaces-NetworkMonitor.html#v:networkMonitorCanReachAsync"
        })


#endif

-- method NetworkMonitor::can_reach_finish
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "monitor"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "NetworkMonitor" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GNetworkMonitor" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "result"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncResult" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GAsyncResult" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_network_monitor_can_reach_finish" g_network_monitor_can_reach_finish :: 
    Ptr NetworkMonitor ->                   -- monitor : TInterface (Name {namespace = "Gio", name = "NetworkMonitor"})
    Ptr Gio.AsyncResult.AsyncResult ->      -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Finishes an async network connectivity test.
-- See 'GI.Gio.Interfaces.NetworkMonitor.networkMonitorCanReachAsync'.
networkMonitorCanReachFinish ::
    (B.CallStack.HasCallStack, MonadIO m, IsNetworkMonitor a, Gio.AsyncResult.IsAsyncResult b) =>
    a
    -- ^ /@monitor@/: a t'GI.Gio.Interfaces.NetworkMonitor.NetworkMonitor'
    -> b
    -- ^ /@result@/: a t'GI.Gio.Interfaces.AsyncResult.AsyncResult'
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
networkMonitorCanReachFinish :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsNetworkMonitor a, IsAsyncResult b) =>
a -> b -> m ()
networkMonitorCanReachFinish a
monitor 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 defined(ENABLE_OVERLOADING)
data NetworkMonitorCanReachFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsNetworkMonitor a, Gio.AsyncResult.IsAsyncResult b) => O.OverloadedMethod NetworkMonitorCanReachFinishMethodInfo a signature where
    overloadedMethod = networkMonitorCanReachFinish

instance O.OverloadedMethodInfo NetworkMonitorCanReachFinishMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Interfaces.NetworkMonitor.networkMonitorCanReachFinish",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.29/docs/GI-Gio-Interfaces-NetworkMonitor.html#v:networkMonitorCanReachFinish"
        })


#endif

-- method NetworkMonitor::get_connectivity
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "monitor"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "NetworkMonitor" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #GNetworkMonitor"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface
--                  Name { namespace = "Gio" , name = "NetworkConnectivity" })
-- throws : False
-- Skip return : False

foreign import ccall "g_network_monitor_get_connectivity" g_network_monitor_get_connectivity :: 
    Ptr NetworkMonitor ->                   -- monitor : TInterface (Name {namespace = "Gio", name = "NetworkMonitor"})
    IO CUInt

-- | Gets a more detailed networking state than
-- 'GI.Gio.Interfaces.NetworkMonitor.networkMonitorGetNetworkAvailable'.
-- 
-- If t'GI.Gio.Interfaces.NetworkMonitor.NetworkMonitor':@/network-available/@ is 'P.False', then the
-- connectivity state will be 'GI.Gio.Enums.NetworkConnectivityLocal'.
-- 
-- If t'GI.Gio.Interfaces.NetworkMonitor.NetworkMonitor':@/network-available/@ is 'P.True', then the
-- connectivity state will be 'GI.Gio.Enums.NetworkConnectivityFull' (if there
-- is full Internet connectivity), 'GI.Gio.Enums.NetworkConnectivityLimited' (if
-- the host has a default route, but appears to be unable to actually
-- reach the full Internet), or 'GI.Gio.Enums.NetworkConnectivityPortal' (if the
-- host is trapped behind a \"captive portal\" that requires some sort
-- of login or acknowledgement before allowing full Internet access).
-- 
-- Note that in the case of 'GI.Gio.Enums.NetworkConnectivityLimited' and
-- 'GI.Gio.Enums.NetworkConnectivityPortal', it is possible that some sites are
-- reachable but others are not. In this case, applications can
-- attempt to connect to remote servers, but should gracefully fall
-- back to their \"offline\" behavior if the connection attempt fails.
-- 
-- /Since: 2.44/
networkMonitorGetConnectivity ::
    (B.CallStack.HasCallStack, MonadIO m, IsNetworkMonitor a) =>
    a
    -- ^ /@monitor@/: the t'GI.Gio.Interfaces.NetworkMonitor.NetworkMonitor'
    -> m Gio.Enums.NetworkConnectivity
    -- ^ __Returns:__ the network connectivity state
networkMonitorGetConnectivity :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsNetworkMonitor a) =>
a -> m NetworkConnectivity
networkMonitorGetConnectivity 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 defined(ENABLE_OVERLOADING)
data NetworkMonitorGetConnectivityMethodInfo
instance (signature ~ (m Gio.Enums.NetworkConnectivity), MonadIO m, IsNetworkMonitor a) => O.OverloadedMethod NetworkMonitorGetConnectivityMethodInfo a signature where
    overloadedMethod = networkMonitorGetConnectivity

instance O.OverloadedMethodInfo NetworkMonitorGetConnectivityMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Interfaces.NetworkMonitor.networkMonitorGetConnectivity",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.29/docs/GI-Gio-Interfaces-NetworkMonitor.html#v:networkMonitorGetConnectivity"
        })


#endif

-- method NetworkMonitor::get_network_available
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "monitor"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "NetworkMonitor" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #GNetworkMonitor"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_network_monitor_get_network_available" g_network_monitor_get_network_available :: 
    Ptr NetworkMonitor ->                   -- monitor : TInterface (Name {namespace = "Gio", name = "NetworkMonitor"})
    IO CInt

-- | Checks if the network is available. \"Available\" here means that the
-- system has a default route available for at least one of IPv4 or
-- IPv6. It does not necessarily imply that the public Internet is
-- reachable. See t'GI.Gio.Interfaces.NetworkMonitor.NetworkMonitor':@/network-available/@ for more details.
-- 
-- /Since: 2.32/
networkMonitorGetNetworkAvailable ::
    (B.CallStack.HasCallStack, MonadIO m, IsNetworkMonitor a) =>
    a
    -- ^ /@monitor@/: the t'GI.Gio.Interfaces.NetworkMonitor.NetworkMonitor'
    -> m Bool
    -- ^ __Returns:__ whether the network is available
networkMonitorGetNetworkAvailable :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsNetworkMonitor a) =>
a -> m Bool
networkMonitorGetNetworkAvailable 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
/= CInt
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 defined(ENABLE_OVERLOADING)
data NetworkMonitorGetNetworkAvailableMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsNetworkMonitor a) => O.OverloadedMethod NetworkMonitorGetNetworkAvailableMethodInfo a signature where
    overloadedMethod = networkMonitorGetNetworkAvailable

instance O.OverloadedMethodInfo NetworkMonitorGetNetworkAvailableMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Interfaces.NetworkMonitor.networkMonitorGetNetworkAvailable",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.29/docs/GI-Gio-Interfaces-NetworkMonitor.html#v:networkMonitorGetNetworkAvailable"
        })


#endif

-- method NetworkMonitor::get_network_metered
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "monitor"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "NetworkMonitor" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #GNetworkMonitor"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_network_monitor_get_network_metered" g_network_monitor_get_network_metered :: 
    Ptr NetworkMonitor ->                   -- monitor : TInterface (Name {namespace = "Gio", name = "NetworkMonitor"})
    IO CInt

-- | Checks if the network is metered.
-- See t'GI.Gio.Interfaces.NetworkMonitor.NetworkMonitor':@/network-metered/@ for more details.
-- 
-- /Since: 2.46/
networkMonitorGetNetworkMetered ::
    (B.CallStack.HasCallStack, MonadIO m, IsNetworkMonitor a) =>
    a
    -- ^ /@monitor@/: the t'GI.Gio.Interfaces.NetworkMonitor.NetworkMonitor'
    -> m Bool
    -- ^ __Returns:__ whether the connection is metered
networkMonitorGetNetworkMetered :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsNetworkMonitor a) =>
a -> m Bool
networkMonitorGetNetworkMetered 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
/= CInt
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 defined(ENABLE_OVERLOADING)
data NetworkMonitorGetNetworkMeteredMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsNetworkMonitor a) => O.OverloadedMethod NetworkMonitorGetNetworkMeteredMethodInfo a signature where
    overloadedMethod = networkMonitorGetNetworkMetered

instance O.OverloadedMethodInfo NetworkMonitorGetNetworkMeteredMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Interfaces.NetworkMonitor.networkMonitorGetNetworkMetered",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.29/docs/GI-Gio-Interfaces-NetworkMonitor.html#v:networkMonitorGetNetworkMetered"
        })


#endif

-- method NetworkMonitor::get_default
-- method type : MemberFunction
-- Args: []
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "Gio" , name = "NetworkMonitor" })
-- throws : False
-- Skip return : False

foreign import ccall "g_network_monitor_get_default" g_network_monitor_get_default :: 
    IO (Ptr NetworkMonitor)

-- | Gets the default t'GI.Gio.Interfaces.NetworkMonitor.NetworkMonitor' for the system.
-- 
-- /Since: 2.32/
networkMonitorGetDefault ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m NetworkMonitor
    -- ^ __Returns:__ a t'GI.Gio.Interfaces.NetworkMonitor.NetworkMonitor', which will be
    --     a dummy object if no network monitor is available
networkMonitorGetDefault :: forall (m :: * -> *). (HasCallStack, MonadIO m) => 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 Text
"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 defined(ENABLE_OVERLOADING)
#endif

-- signal NetworkMonitor::network-changed
-- | Emitted when the network configuration changes.
-- 
-- /Since: 2.32/
type NetworkMonitorNetworkChangedCallback =
    Bool
    -- ^ /@networkAvailable@/: the current value of t'GI.Gio.Interfaces.NetworkMonitor.NetworkMonitor':@/network-available/@
    -> IO ()

type C_NetworkMonitorNetworkChangedCallback =
    Ptr NetworkMonitor ->                   -- object
    CInt ->
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_NetworkMonitorNetworkChangedCallback`.
foreign import ccall "wrapper"
    mk_NetworkMonitorNetworkChangedCallback :: C_NetworkMonitorNetworkChangedCallback -> IO (FunPtr C_NetworkMonitorNetworkChangedCallback)

wrap_NetworkMonitorNetworkChangedCallback :: 
    GObject a => (a -> NetworkMonitorNetworkChangedCallback) ->
    C_NetworkMonitorNetworkChangedCallback
wrap_NetworkMonitorNetworkChangedCallback :: forall a.
GObject a =>
(a -> NetworkMonitorNetworkChangedCallback)
-> C_NetworkMonitorNetworkChangedCallback
wrap_NetworkMonitorNetworkChangedCallback a -> NetworkMonitorNetworkChangedCallback
gi'cb Ptr NetworkMonitor
gi'selfPtr CInt
networkAvailable Ptr ()
_ = do
    let networkAvailable' :: Bool
networkAvailable' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
networkAvailable
    Ptr NetworkMonitor -> (NetworkMonitor -> IO ()) -> IO ()
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient Ptr NetworkMonitor
gi'selfPtr ((NetworkMonitor -> IO ()) -> IO ())
-> (NetworkMonitor -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \NetworkMonitor
gi'self -> a -> NetworkMonitorNetworkChangedCallback
gi'cb (NetworkMonitor -> a
Coerce.coerce NetworkMonitor
gi'self)  Bool
networkAvailable'


-- | Connect a signal handler for the [networkChanged](#signal:networkChanged) signal, to be run before the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.on' networkMonitor #networkChanged callback
-- @
-- 
-- 
onNetworkMonitorNetworkChanged :: (IsNetworkMonitor a, MonadIO m) => a -> ((?self :: a) => NetworkMonitorNetworkChangedCallback) -> m SignalHandlerId
onNetworkMonitorNetworkChanged :: forall a (m :: * -> *).
(IsNetworkMonitor a, MonadIO m) =>
a
-> ((?self::a) => NetworkMonitorNetworkChangedCallback)
-> m SignalHandlerId
onNetworkMonitorNetworkChanged a
obj (?self::a) => 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 wrapped :: a -> NetworkMonitorNetworkChangedCallback
wrapped a
self = let ?self = a
?self::a
self in (?self::a) => NetworkMonitorNetworkChangedCallback
NetworkMonitorNetworkChangedCallback
cb
    let wrapped' :: C_NetworkMonitorNetworkChangedCallback
wrapped' = (a -> NetworkMonitorNetworkChangedCallback)
-> C_NetworkMonitorNetworkChangedCallback
forall a.
GObject a =>
(a -> NetworkMonitorNetworkChangedCallback)
-> C_NetworkMonitorNetworkChangedCallback
wrap_NetworkMonitorNetworkChangedCallback a -> NetworkMonitorNetworkChangedCallback
wrapped
    FunPtr C_NetworkMonitorNetworkChangedCallback
wrapped'' <- C_NetworkMonitorNetworkChangedCallback
-> IO (FunPtr C_NetworkMonitorNetworkChangedCallback)
mk_NetworkMonitorNetworkChangedCallback C_NetworkMonitorNetworkChangedCallback
wrapped'
    a
-> Text
-> FunPtr C_NetworkMonitorNetworkChangedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"network-changed" FunPtr C_NetworkMonitorNetworkChangedCallback
wrapped'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing

-- | Connect a signal handler for the [networkChanged](#signal:networkChanged) signal, to be run after the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.after' networkMonitor #networkChanged callback
-- @
-- 
-- 
-- 
-- By default the object invoking the signal is not passed to the callback.
-- If you need to access it, you can use the implit @?self@ parameter.
-- Note that this requires activating the @ImplicitParams@ GHC extension.
-- 
afterNetworkMonitorNetworkChanged :: (IsNetworkMonitor a, MonadIO m) => a -> ((?self :: a) => NetworkMonitorNetworkChangedCallback) -> m SignalHandlerId
afterNetworkMonitorNetworkChanged :: forall a (m :: * -> *).
(IsNetworkMonitor a, MonadIO m) =>
a
-> ((?self::a) => NetworkMonitorNetworkChangedCallback)
-> m SignalHandlerId
afterNetworkMonitorNetworkChanged a
obj (?self::a) => 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 wrapped :: a -> NetworkMonitorNetworkChangedCallback
wrapped a
self = let ?self = a
?self::a
self in (?self::a) => NetworkMonitorNetworkChangedCallback
NetworkMonitorNetworkChangedCallback
cb
    let wrapped' :: C_NetworkMonitorNetworkChangedCallback
wrapped' = (a -> NetworkMonitorNetworkChangedCallback)
-> C_NetworkMonitorNetworkChangedCallback
forall a.
GObject a =>
(a -> NetworkMonitorNetworkChangedCallback)
-> C_NetworkMonitorNetworkChangedCallback
wrap_NetworkMonitorNetworkChangedCallback a -> NetworkMonitorNetworkChangedCallback
wrapped
    FunPtr C_NetworkMonitorNetworkChangedCallback
wrapped'' <- C_NetworkMonitorNetworkChangedCallback
-> IO (FunPtr C_NetworkMonitorNetworkChangedCallback)
mk_NetworkMonitorNetworkChangedCallback C_NetworkMonitorNetworkChangedCallback
wrapped'
    a
-> Text
-> FunPtr C_NetworkMonitorNetworkChangedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"network-changed" FunPtr C_NetworkMonitorNetworkChangedCallback
wrapped'' SignalConnectMode
SignalConnectAfter Maybe Text
forall a. Maybe a
Nothing


#if defined(ENABLE_OVERLOADING)
data NetworkMonitorNetworkChangedSignalInfo
instance SignalInfo NetworkMonitorNetworkChangedSignalInfo where
    type HaskellCallbackType NetworkMonitorNetworkChangedSignalInfo = NetworkMonitorNetworkChangedCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_NetworkMonitorNetworkChangedCallback cb
        cb'' <- mk_NetworkMonitorNetworkChangedCallback cb'
        connectSignalFunPtr obj "network-changed" cb'' connectMode detail
    dbgSignalInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Interfaces.NetworkMonitor::network-changed"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.29/docs/GI-Gio-Interfaces-NetworkMonitor.html#g:signal:networkChanged"})

#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList NetworkMonitor = NetworkMonitorSignalList
type NetworkMonitorSignalList = ('[ '("networkChanged", NetworkMonitorNetworkChangedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif