#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Gio.Interfaces.ProxyResolver
(
ProxyResolver(..) ,
noProxyResolver ,
IsProxyResolver ,
toProxyResolver ,
proxyResolverGetDefault ,
#if ENABLE_OVERLOADING
ProxyResolverIsSupportedMethodInfo ,
#endif
proxyResolverIsSupported ,
#if ENABLE_OVERLOADING
ProxyResolverLookupMethodInfo ,
#endif
proxyResolverLookup ,
#if ENABLE_OVERLOADING
ProxyResolverLookupAsyncMethodInfo ,
#endif
proxyResolverLookupAsync ,
#if ENABLE_OVERLOADING
ProxyResolverLookupFinishMethodInfo ,
#endif
proxyResolverLookupFinish ,
) where
import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P
import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Callbacks as Gio.Callbacks
import {-# SOURCE #-} qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import {-# SOURCE #-} qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
newtype ProxyResolver = ProxyResolver (ManagedPtr ProxyResolver)
noProxyResolver :: Maybe ProxyResolver
noProxyResolver = Nothing
#if ENABLE_OVERLOADING
type instance O.SignalList ProxyResolver = ProxyResolverSignalList
type ProxyResolverSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "g_proxy_resolver_get_type"
c_g_proxy_resolver_get_type :: IO GType
instance GObject ProxyResolver where
gobjectType = c_g_proxy_resolver_get_type
class (GObject o, O.IsDescendantOf ProxyResolver o) => IsProxyResolver o
instance (GObject o, O.IsDescendantOf ProxyResolver o) => IsProxyResolver o
instance O.HasParentTypes ProxyResolver
type instance O.ParentTypes ProxyResolver = '[GObject.Object.Object]
toProxyResolver :: (MonadIO m, IsProxyResolver o) => o -> m ProxyResolver
toProxyResolver = liftIO . unsafeCastTo ProxyResolver
#if ENABLE_OVERLOADING
instance O.HasAttributeList ProxyResolver
type instance O.AttributeList ProxyResolver = ProxyResolverAttributeList
type ProxyResolverAttributeList = ('[ ] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
#endif
#if ENABLE_OVERLOADING
type family ResolveProxyResolverMethod (t :: Symbol) (o :: *) :: * where
ResolveProxyResolverMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveProxyResolverMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveProxyResolverMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveProxyResolverMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveProxyResolverMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveProxyResolverMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveProxyResolverMethod "isSupported" o = ProxyResolverIsSupportedMethodInfo
ResolveProxyResolverMethod "lookup" o = ProxyResolverLookupMethodInfo
ResolveProxyResolverMethod "lookupAsync" o = ProxyResolverLookupAsyncMethodInfo
ResolveProxyResolverMethod "lookupFinish" o = ProxyResolverLookupFinishMethodInfo
ResolveProxyResolverMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveProxyResolverMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveProxyResolverMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveProxyResolverMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveProxyResolverMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveProxyResolverMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveProxyResolverMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveProxyResolverMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveProxyResolverMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveProxyResolverMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveProxyResolverMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveProxyResolverMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveProxyResolverMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveProxyResolverMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveProxyResolverMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveProxyResolverMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveProxyResolverMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveProxyResolverMethod t ProxyResolver, O.MethodInfo info ProxyResolver p) => OL.IsLabel t (ProxyResolver -> 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
foreign import ccall "g_proxy_resolver_is_supported" g_proxy_resolver_is_supported ::
Ptr ProxyResolver ->
IO CInt
proxyResolverIsSupported ::
(B.CallStack.HasCallStack, MonadIO m, IsProxyResolver a) =>
a
-> m Bool
proxyResolverIsSupported resolver = liftIO $ do
resolver' <- unsafeManagedPtrCastPtr resolver
result <- g_proxy_resolver_is_supported resolver'
let result' = (/= 0) result
touchManagedPtr resolver
return result'
#if ENABLE_OVERLOADING
data ProxyResolverIsSupportedMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsProxyResolver a) => O.MethodInfo ProxyResolverIsSupportedMethodInfo a signature where
overloadedMethod _ = proxyResolverIsSupported
#endif
foreign import ccall "g_proxy_resolver_lookup" g_proxy_resolver_lookup ::
Ptr ProxyResolver ->
CString ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr CString)
proxyResolverLookup ::
(B.CallStack.HasCallStack, MonadIO m, IsProxyResolver a, Gio.Cancellable.IsCancellable b) =>
a
-> T.Text
-> Maybe (b)
-> m [T.Text]
proxyResolverLookup resolver uri cancellable = liftIO $ do
resolver' <- unsafeManagedPtrCastPtr resolver
uri' <- textToCString uri
maybeCancellable <- case cancellable of
Nothing -> return nullPtr
Just jCancellable -> do
jCancellable' <- unsafeManagedPtrCastPtr jCancellable
return jCancellable'
onException (do
result <- propagateGError $ g_proxy_resolver_lookup resolver' uri' maybeCancellable
checkUnexpectedReturnNULL "proxyResolverLookup" result
result' <- unpackZeroTerminatedUTF8CArray result
mapZeroTerminatedCArray freeMem result
freeMem result
touchManagedPtr resolver
whenJust cancellable touchManagedPtr
freeMem uri'
return result'
) (do
freeMem uri'
)
#if ENABLE_OVERLOADING
data ProxyResolverLookupMethodInfo
instance (signature ~ (T.Text -> Maybe (b) -> m [T.Text]), MonadIO m, IsProxyResolver a, Gio.Cancellable.IsCancellable b) => O.MethodInfo ProxyResolverLookupMethodInfo a signature where
overloadedMethod _ = proxyResolverLookup
#endif
foreign import ccall "g_proxy_resolver_lookup_async" g_proxy_resolver_lookup_async ::
Ptr ProxyResolver ->
CString ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
proxyResolverLookupAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsProxyResolver a, Gio.Cancellable.IsCancellable b) =>
a
-> T.Text
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
proxyResolverLookupAsync resolver uri cancellable callback = liftIO $ do
resolver' <- unsafeManagedPtrCastPtr resolver
uri' <- textToCString uri
maybeCancellable <- case cancellable of
Nothing -> return nullPtr
Just jCancellable -> do
jCancellable' <- unsafeManagedPtrCastPtr jCancellable
return jCancellable'
maybeCallback <- case callback of
Nothing -> return (castPtrToFunPtr nullPtr)
Just jCallback -> do
ptrcallback <- callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback))
poke ptrcallback jCallback'
return jCallback'
let userData = nullPtr
g_proxy_resolver_lookup_async resolver' uri' maybeCancellable maybeCallback userData
touchManagedPtr resolver
whenJust cancellable touchManagedPtr
freeMem uri'
return ()
#if ENABLE_OVERLOADING
data ProxyResolverLookupAsyncMethodInfo
instance (signature ~ (T.Text -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsProxyResolver a, Gio.Cancellable.IsCancellable b) => O.MethodInfo ProxyResolverLookupAsyncMethodInfo a signature where
overloadedMethod _ = proxyResolverLookupAsync
#endif
foreign import ccall "g_proxy_resolver_lookup_finish" g_proxy_resolver_lookup_finish ::
Ptr ProxyResolver ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO (Ptr CString)
proxyResolverLookupFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsProxyResolver a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m [T.Text]
proxyResolverLookupFinish resolver result_ = liftIO $ do
resolver' <- unsafeManagedPtrCastPtr resolver
result_' <- unsafeManagedPtrCastPtr result_
onException (do
result <- propagateGError $ g_proxy_resolver_lookup_finish resolver' result_'
checkUnexpectedReturnNULL "proxyResolverLookupFinish" result
result' <- unpackZeroTerminatedUTF8CArray result
mapZeroTerminatedCArray freeMem result
freeMem result
touchManagedPtr resolver
touchManagedPtr result_
return result'
) (do
return ()
)
#if ENABLE_OVERLOADING
data ProxyResolverLookupFinishMethodInfo
instance (signature ~ (b -> m [T.Text]), MonadIO m, IsProxyResolver a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo ProxyResolverLookupFinishMethodInfo a signature where
overloadedMethod _ = proxyResolverLookupFinish
#endif
foreign import ccall "g_proxy_resolver_get_default" g_proxy_resolver_get_default ::
IO (Ptr ProxyResolver)
proxyResolverGetDefault ::
(B.CallStack.HasCallStack, MonadIO m) =>
m ProxyResolver
proxyResolverGetDefault = liftIO $ do
result <- g_proxy_resolver_get_default
checkUnexpectedReturnNULL "proxyResolverGetDefault" result
result' <- (newObject ProxyResolver) result
return result'
#if ENABLE_OVERLOADING
#endif