{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (garetxe@gmail.com) -} module GI.Soup.Interfaces.ProxyURIResolver ( -- * Exported types ProxyURIResolver(..) , noProxyURIResolver , ProxyURIResolverK , toProxyURIResolver , -- * Methods -- ** proxyURIResolverGetProxyUriAsync proxyURIResolverGetProxyUriAsync , -- ** proxyURIResolverGetProxyUriSync proxyURIResolverGetProxyUriSync , ) where import Prelude () import Data.GI.Base.ShortPrelude import qualified Data.Text as T import qualified Data.ByteString.Char8 as B import qualified Data.Map as Map import GI.Soup.Types import GI.Soup.Callbacks import qualified GI.GLib as GLib import qualified GI.GObject as GObject import qualified GI.Gio as Gio -- interface ProxyURIResolver newtype ProxyURIResolver = ProxyURIResolver (ForeignPtr ProxyURIResolver) noProxyURIResolver :: Maybe ProxyURIResolver noProxyURIResolver = Nothing type instance AttributeList ProxyURIResolver = ProxyURIResolverAttributeList type ProxyURIResolverAttributeList = ('[ ] :: [(Symbol, *)]) type instance SignalList ProxyURIResolver = ProxyURIResolverSignalList type ProxyURIResolverSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)]) foreign import ccall "soup_proxy_uri_resolver_get_type" c_soup_proxy_uri_resolver_get_type :: IO GType type instance ParentTypes ProxyURIResolver = ProxyURIResolverParentTypes type ProxyURIResolverParentTypes = '[SessionFeature, GObject.Object] instance GObject ProxyURIResolver where gobjectIsInitiallyUnowned _ = False gobjectType _ = c_soup_proxy_uri_resolver_get_type class GObject o => ProxyURIResolverK o instance (GObject o, IsDescendantOf ProxyURIResolver o) => ProxyURIResolverK o toProxyURIResolver :: ProxyURIResolverK o => o -> IO ProxyURIResolver toProxyURIResolver = unsafeCastTo ProxyURIResolver -- method ProxyURIResolver::get_proxy_uri_async -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Soup" "ProxyURIResolver", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "uri", argType = TInterface "Soup" "URI", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "async_context", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Soup" "ProxyURIResolverCallback", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeAsync, argClosure = 5, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Soup" "ProxyURIResolver", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "uri", argType = TInterface "Soup" "URI", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "async_context", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Soup" "ProxyURIResolverCallback", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeAsync, argClosure = 5, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "soup_proxy_uri_resolver_get_proxy_uri_async" soup_proxy_uri_resolver_get_proxy_uri_async :: Ptr ProxyURIResolver -> -- _obj : TInterface "Soup" "ProxyURIResolver" Ptr URI -> -- uri : TInterface "Soup" "URI" Ptr GLib.MainContext -> -- async_context : TInterface "GLib" "MainContext" Ptr Gio.Cancellable -> -- cancellable : TInterface "Gio" "Cancellable" FunPtr ProxyURIResolverCallbackC -> -- callback : TInterface "Soup" "ProxyURIResolverCallback" Ptr () -> -- user_data : TBasicType TVoid IO () {-# DEPRECATED proxyURIResolverGetProxyUriAsync ["#SoupProxyURIResolver is deprecated in favor of","#GProxyResolver"]#-} proxyURIResolverGetProxyUriAsync :: (MonadIO m, ProxyURIResolverK a, Gio.CancellableK b) => a -> -- _obj URI -> -- uri Maybe (GLib.MainContext) -> -- async_context Maybe (b) -> -- cancellable ProxyURIResolverCallback -> -- callback m () proxyURIResolverGetProxyUriAsync _obj uri async_context cancellable callback = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj let uri' = unsafeManagedPtrGetPtr uri maybeAsync_context <- case async_context of Nothing -> return nullPtr Just jAsync_context -> do let jAsync_context' = unsafeManagedPtrGetPtr jAsync_context return jAsync_context' maybeCancellable <- case cancellable of Nothing -> return nullPtr Just jCancellable -> do let jCancellable' = unsafeManagedPtrCastPtr jCancellable return jCancellable' ptrcallback <- callocMem :: IO (Ptr (FunPtr ProxyURIResolverCallbackC)) callback' <- mkProxyURIResolverCallback (proxyURIResolverCallbackWrapper (Just ptrcallback) callback) poke ptrcallback callback' let user_data = nullPtr soup_proxy_uri_resolver_get_proxy_uri_async _obj' uri' maybeAsync_context maybeCancellable callback' user_data touchManagedPtr _obj touchManagedPtr uri whenJust async_context touchManagedPtr whenJust cancellable touchManagedPtr return () -- method ProxyURIResolver::get_proxy_uri_sync -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Soup" "ProxyURIResolver", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "uri", argType = TInterface "Soup" "URI", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "proxy_uri", argType = TInterface "Soup" "URI", direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Soup" "ProxyURIResolver", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "uri", argType = TInterface "Soup" "URI", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TUInt32 -- throws : False -- Skip return : False foreign import ccall "soup_proxy_uri_resolver_get_proxy_uri_sync" soup_proxy_uri_resolver_get_proxy_uri_sync :: Ptr ProxyURIResolver -> -- _obj : TInterface "Soup" "ProxyURIResolver" Ptr URI -> -- uri : TInterface "Soup" "URI" Ptr Gio.Cancellable -> -- cancellable : TInterface "Gio" "Cancellable" Ptr URI -> -- proxy_uri : TInterface "Soup" "URI" IO Word32 {-# DEPRECATED proxyURIResolverGetProxyUriSync ["#SoupProxyURIResolver is deprecated in favor of","#GProxyResolver"]#-} proxyURIResolverGetProxyUriSync :: (MonadIO m, ProxyURIResolverK a, Gio.CancellableK b) => a -> -- _obj URI -> -- uri Maybe (b) -> -- cancellable m (Word32,URI) proxyURIResolverGetProxyUriSync _obj uri cancellable = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj let uri' = unsafeManagedPtrGetPtr uri maybeCancellable <- case cancellable of Nothing -> return nullPtr Just jCancellable -> do let jCancellable' = unsafeManagedPtrCastPtr jCancellable return jCancellable' proxy_uri <- callocBoxedBytes 64 :: IO (Ptr URI) result <- soup_proxy_uri_resolver_get_proxy_uri_sync _obj' uri' maybeCancellable proxy_uri proxy_uri' <- (wrapBoxed URI) proxy_uri touchManagedPtr _obj touchManagedPtr uri whenJust cancellable touchManagedPtr return (result, proxy_uri')