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


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- /No description available in the introspection data./

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

module GI.WebKit2.Objects.Download
    ( 

-- * Exported types
    Download(..)                            ,
    IsDownload                              ,
    toDownload                              ,


 -- * 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"), [cancel]("GI.WebKit2.Objects.Download#g:method:cancel"), [forceFloating]("GI.GObject.Objects.Object#g:method:forceFloating"), [freezeNotify]("GI.GObject.Objects.Object#g:method:freezeNotify"), [getv]("GI.GObject.Objects.Object#g:method:getv"), [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
-- [getAllowOverwrite]("GI.WebKit2.Objects.Download#g:method:getAllowOverwrite"), [getData]("GI.GObject.Objects.Object#g:method:getData"), [getDestination]("GI.WebKit2.Objects.Download#g:method:getDestination"), [getElapsedTime]("GI.WebKit2.Objects.Download#g:method:getElapsedTime"), [getEstimatedProgress]("GI.WebKit2.Objects.Download#g:method:getEstimatedProgress"), [getProperty]("GI.GObject.Objects.Object#g:method:getProperty"), [getQdata]("GI.GObject.Objects.Object#g:method:getQdata"), [getReceivedDataLength]("GI.WebKit2.Objects.Download#g:method:getReceivedDataLength"), [getRequest]("GI.WebKit2.Objects.Download#g:method:getRequest"), [getResponse]("GI.WebKit2.Objects.Download#g:method:getResponse"), [getWebView]("GI.WebKit2.Objects.Download#g:method:getWebView").
-- 
-- ==== Setters
-- [setAllowOverwrite]("GI.WebKit2.Objects.Download#g:method:setAllowOverwrite"), [setData]("GI.GObject.Objects.Object#g:method:setData"), [setDataFull]("GI.GObject.Objects.Object#g:method:setDataFull"), [setDestination]("GI.WebKit2.Objects.Download#g:method:setDestination"), [setProperty]("GI.GObject.Objects.Object#g:method:setProperty").

#if defined(ENABLE_OVERLOADING)
    ResolveDownloadMethod                   ,
#endif

-- ** cancel #method:cancel#

#if defined(ENABLE_OVERLOADING)
    DownloadCancelMethodInfo                ,
#endif
    downloadCancel                          ,


-- ** getAllowOverwrite #method:getAllowOverwrite#

#if defined(ENABLE_OVERLOADING)
    DownloadGetAllowOverwriteMethodInfo     ,
#endif
    downloadGetAllowOverwrite               ,


-- ** getDestination #method:getDestination#

#if defined(ENABLE_OVERLOADING)
    DownloadGetDestinationMethodInfo        ,
#endif
    downloadGetDestination                  ,


-- ** getElapsedTime #method:getElapsedTime#

#if defined(ENABLE_OVERLOADING)
    DownloadGetElapsedTimeMethodInfo        ,
#endif
    downloadGetElapsedTime                  ,


-- ** getEstimatedProgress #method:getEstimatedProgress#

#if defined(ENABLE_OVERLOADING)
    DownloadGetEstimatedProgressMethodInfo  ,
#endif
    downloadGetEstimatedProgress            ,


-- ** getReceivedDataLength #method:getReceivedDataLength#

#if defined(ENABLE_OVERLOADING)
    DownloadGetReceivedDataLengthMethodInfo ,
#endif
    downloadGetReceivedDataLength           ,


-- ** getRequest #method:getRequest#

#if defined(ENABLE_OVERLOADING)
    DownloadGetRequestMethodInfo            ,
#endif
    downloadGetRequest                      ,


-- ** getResponse #method:getResponse#

#if defined(ENABLE_OVERLOADING)
    DownloadGetResponseMethodInfo           ,
#endif
    downloadGetResponse                     ,


-- ** getWebView #method:getWebView#

#if defined(ENABLE_OVERLOADING)
    DownloadGetWebViewMethodInfo            ,
#endif
    downloadGetWebView                      ,


-- ** setAllowOverwrite #method:setAllowOverwrite#

#if defined(ENABLE_OVERLOADING)
    DownloadSetAllowOverwriteMethodInfo     ,
#endif
    downloadSetAllowOverwrite               ,


-- ** setDestination #method:setDestination#

#if defined(ENABLE_OVERLOADING)
    DownloadSetDestinationMethodInfo        ,
#endif
    downloadSetDestination                  ,




 -- * Properties


-- ** allowOverwrite #attr:allowOverwrite#
-- | Whether or not the download is allowed to overwrite an existing file on
-- disk. If this property is 'P.False' and the destination already exists,
-- the download will fail.
-- 
-- /Since: 2.6/

#if defined(ENABLE_OVERLOADING)
    DownloadAllowOverwritePropertyInfo      ,
#endif
    constructDownloadAllowOverwrite         ,
#if defined(ENABLE_OVERLOADING)
    downloadAllowOverwrite                  ,
#endif
    getDownloadAllowOverwrite               ,
    setDownloadAllowOverwrite               ,


-- ** destination #attr:destination#
-- | The local URI to where the download will be saved.

#if defined(ENABLE_OVERLOADING)
    DownloadDestinationPropertyInfo         ,
#endif
#if defined(ENABLE_OVERLOADING)
    downloadDestination                     ,
#endif
    getDownloadDestination                  ,


-- ** estimatedProgress #attr:estimatedProgress#
-- | An estimate of the percent completion for the download operation.
-- This value will range from 0.0 to 1.0. The value is an estimate
-- based on the total number of bytes expected to be received for
-- a download.
-- If you need a more accurate progress information you can connect to
-- [receivedData]("GI.WebKit2.Objects.Download#g:signal:receivedData") signal to track the progress.

#if defined(ENABLE_OVERLOADING)
    DownloadEstimatedProgressPropertyInfo   ,
#endif
#if defined(ENABLE_OVERLOADING)
    downloadEstimatedProgress               ,
#endif
    getDownloadEstimatedProgress            ,


-- ** response #attr:response#
-- | The t'GI.WebKit2.Objects.URIResponse.URIResponse' associated with this download.

#if defined(ENABLE_OVERLOADING)
    DownloadResponsePropertyInfo            ,
#endif
#if defined(ENABLE_OVERLOADING)
    downloadResponse                        ,
#endif
    getDownloadResponse                     ,




 -- * Signals


-- ** createdDestination #signal:createdDestination#

    DownloadCreatedDestinationCallback      ,
#if defined(ENABLE_OVERLOADING)
    DownloadCreatedDestinationSignalInfo    ,
#endif
    afterDownloadCreatedDestination         ,
    onDownloadCreatedDestination            ,


-- ** decideDestination #signal:decideDestination#

    DownloadDecideDestinationCallback       ,
#if defined(ENABLE_OVERLOADING)
    DownloadDecideDestinationSignalInfo     ,
#endif
    afterDownloadDecideDestination          ,
    onDownloadDecideDestination             ,


-- ** failed #signal:failed#

    DownloadFailedCallback                  ,
#if defined(ENABLE_OVERLOADING)
    DownloadFailedSignalInfo                ,
#endif
    afterDownloadFailed                     ,
    onDownloadFailed                        ,


-- ** finished #signal:finished#

    DownloadFinishedCallback                ,
#if defined(ENABLE_OVERLOADING)
    DownloadFinishedSignalInfo              ,
#endif
    afterDownloadFinished                   ,
    onDownloadFinished                      ,


-- ** receivedData #signal:receivedData#

    DownloadReceivedDataCallback            ,
#if defined(ENABLE_OVERLOADING)
    DownloadReceivedDataSignalInfo          ,
#endif
    afterDownloadReceivedData               ,
    onDownloadReceivedData                  ,




    ) 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 {-# SOURCE #-} qualified GI.WebKit2.Objects.URIRequest as WebKit2.URIRequest
import {-# SOURCE #-} qualified GI.WebKit2.Objects.URIResponse as WebKit2.URIResponse
import {-# SOURCE #-} qualified GI.WebKit2.Objects.WebView as WebKit2.WebView

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

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

foreign import ccall "webkit_download_get_type"
    c_webkit_download_get_type :: IO B.Types.GType

instance B.Types.TypedObject Download where
    glibType :: IO GType
glibType = IO GType
c_webkit_download_get_type

instance B.Types.GObject Download

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

instance O.HasParentTypes Download
type instance O.ParentTypes Download = '[GObject.Object.Object]

-- | Cast to `Download`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toDownload :: (MIO.MonadIO m, IsDownload o) => o -> m Download
toDownload :: forall (m :: * -> *) o.
(MonadIO m, IsDownload o) =>
o -> m Download
toDownload = IO Download -> m Download
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO Download -> m Download)
-> (o -> IO Download) -> o -> m Download
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr Download -> Download) -> o -> IO Download
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
 ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr Download -> Download
Download

-- | Convert 'Download' 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 Download) where
    gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_webkit_download_get_type
    gvalueSet_ :: Ptr GValue -> Maybe Download -> IO ()
gvalueSet_ Ptr GValue
gv Maybe Download
P.Nothing = Ptr GValue -> Ptr Download -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr Download
forall a. Ptr a
FP.nullPtr :: FP.Ptr Download)
    gvalueSet_ Ptr GValue
gv (P.Just Download
obj) = Download -> (Ptr Download -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Download
obj (Ptr GValue -> Ptr Download -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
    gvalueGet_ :: Ptr GValue -> IO (Maybe Download)
gvalueGet_ Ptr GValue
gv = do
        Ptr Download
ptr <- Ptr GValue -> IO (Ptr Download)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr Download)
        if Ptr Download
ptr Ptr Download -> Ptr Download -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr Download
forall a. Ptr a
FP.nullPtr
        then Download -> Maybe Download
forall a. a -> Maybe a
P.Just (Download -> Maybe Download) -> IO Download -> IO (Maybe Download)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr Download -> Download) -> Ptr Download -> IO Download
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr Download -> Download
Download Ptr Download
ptr
        else Maybe Download -> IO (Maybe Download)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Download
forall a. Maybe a
P.Nothing
        
    

#if defined(ENABLE_OVERLOADING)
type family ResolveDownloadMethod (t :: Symbol) (o :: *) :: * where
    ResolveDownloadMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveDownloadMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveDownloadMethod "cancel" o = DownloadCancelMethodInfo
    ResolveDownloadMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveDownloadMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveDownloadMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveDownloadMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveDownloadMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveDownloadMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveDownloadMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveDownloadMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveDownloadMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveDownloadMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveDownloadMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveDownloadMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveDownloadMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveDownloadMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveDownloadMethod "getAllowOverwrite" o = DownloadGetAllowOverwriteMethodInfo
    ResolveDownloadMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveDownloadMethod "getDestination" o = DownloadGetDestinationMethodInfo
    ResolveDownloadMethod "getElapsedTime" o = DownloadGetElapsedTimeMethodInfo
    ResolveDownloadMethod "getEstimatedProgress" o = DownloadGetEstimatedProgressMethodInfo
    ResolveDownloadMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveDownloadMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveDownloadMethod "getReceivedDataLength" o = DownloadGetReceivedDataLengthMethodInfo
    ResolveDownloadMethod "getRequest" o = DownloadGetRequestMethodInfo
    ResolveDownloadMethod "getResponse" o = DownloadGetResponseMethodInfo
    ResolveDownloadMethod "getWebView" o = DownloadGetWebViewMethodInfo
    ResolveDownloadMethod "setAllowOverwrite" o = DownloadSetAllowOverwriteMethodInfo
    ResolveDownloadMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveDownloadMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveDownloadMethod "setDestination" o = DownloadSetDestinationMethodInfo
    ResolveDownloadMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveDownloadMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveDownloadMethod t Download, O.OverloadedMethod info Download p) => OL.IsLabel t (Download -> 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 ~ ResolveDownloadMethod t Download, O.OverloadedMethod info Download p, R.HasField t Download p) => R.HasField t Download p where
    getField = O.overloadedMethod @info

#endif

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

#endif

-- signal Download::created-destination
-- | This signal is emitted after [decideDestination]("GI.WebKit2.Objects.Download#g:signal:decideDestination") and before
-- [receivedData]("GI.WebKit2.Objects.Download#g:signal:receivedData") to notify that destination file has been
-- created successfully at /@destination@/.
type DownloadCreatedDestinationCallback =
    T.Text
    -- ^ /@destination@/: the destination URI
    -> IO ()

type C_DownloadCreatedDestinationCallback =
    Ptr Download ->                         -- object
    CString ->
    Ptr () ->                               -- user_data
    IO ()

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

wrap_DownloadCreatedDestinationCallback :: 
    GObject a => (a -> DownloadCreatedDestinationCallback) ->
    C_DownloadCreatedDestinationCallback
wrap_DownloadCreatedDestinationCallback :: forall a.
GObject a =>
(a -> DownloadCreatedDestinationCallback)
-> C_DownloadCreatedDestinationCallback
wrap_DownloadCreatedDestinationCallback a -> DownloadCreatedDestinationCallback
gi'cb Ptr Download
gi'selfPtr CString
destination Ptr ()
_ = do
    Text
destination' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
destination
    Ptr Download -> (Download -> IO ()) -> IO ()
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient Ptr Download
gi'selfPtr ((Download -> IO ()) -> IO ()) -> (Download -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Download
gi'self -> a -> DownloadCreatedDestinationCallback
gi'cb (Download -> a
Coerce.coerce Download
gi'self)  Text
destination'


-- | Connect a signal handler for the [createdDestination](#signal:createdDestination) 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' download #createdDestination callback
-- @
-- 
-- 
onDownloadCreatedDestination :: (IsDownload a, MonadIO m) => a -> ((?self :: a) => DownloadCreatedDestinationCallback) -> m SignalHandlerId
onDownloadCreatedDestination :: forall a (m :: * -> *).
(IsDownload a, MonadIO m) =>
a
-> ((?self::a) => DownloadCreatedDestinationCallback)
-> m SignalHandlerId
onDownloadCreatedDestination a
obj (?self::a) => DownloadCreatedDestinationCallback
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 -> DownloadCreatedDestinationCallback
wrapped a
self = let ?self = a
?self::a
self in (?self::a) => DownloadCreatedDestinationCallback
DownloadCreatedDestinationCallback
cb
    let wrapped' :: C_DownloadCreatedDestinationCallback
wrapped' = (a -> DownloadCreatedDestinationCallback)
-> C_DownloadCreatedDestinationCallback
forall a.
GObject a =>
(a -> DownloadCreatedDestinationCallback)
-> C_DownloadCreatedDestinationCallback
wrap_DownloadCreatedDestinationCallback a -> DownloadCreatedDestinationCallback
wrapped
    FunPtr C_DownloadCreatedDestinationCallback
wrapped'' <- C_DownloadCreatedDestinationCallback
-> IO (FunPtr C_DownloadCreatedDestinationCallback)
mk_DownloadCreatedDestinationCallback C_DownloadCreatedDestinationCallback
wrapped'
    a
-> Text
-> FunPtr C_DownloadCreatedDestinationCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"created-destination" FunPtr C_DownloadCreatedDestinationCallback
wrapped'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing

-- | Connect a signal handler for the [createdDestination](#signal:createdDestination) 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' download #createdDestination 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.
-- 
afterDownloadCreatedDestination :: (IsDownload a, MonadIO m) => a -> ((?self :: a) => DownloadCreatedDestinationCallback) -> m SignalHandlerId
afterDownloadCreatedDestination :: forall a (m :: * -> *).
(IsDownload a, MonadIO m) =>
a
-> ((?self::a) => DownloadCreatedDestinationCallback)
-> m SignalHandlerId
afterDownloadCreatedDestination a
obj (?self::a) => DownloadCreatedDestinationCallback
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 -> DownloadCreatedDestinationCallback
wrapped a
self = let ?self = a
?self::a
self in (?self::a) => DownloadCreatedDestinationCallback
DownloadCreatedDestinationCallback
cb
    let wrapped' :: C_DownloadCreatedDestinationCallback
wrapped' = (a -> DownloadCreatedDestinationCallback)
-> C_DownloadCreatedDestinationCallback
forall a.
GObject a =>
(a -> DownloadCreatedDestinationCallback)
-> C_DownloadCreatedDestinationCallback
wrap_DownloadCreatedDestinationCallback a -> DownloadCreatedDestinationCallback
wrapped
    FunPtr C_DownloadCreatedDestinationCallback
wrapped'' <- C_DownloadCreatedDestinationCallback
-> IO (FunPtr C_DownloadCreatedDestinationCallback)
mk_DownloadCreatedDestinationCallback C_DownloadCreatedDestinationCallback
wrapped'
    a
-> Text
-> FunPtr C_DownloadCreatedDestinationCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"created-destination" FunPtr C_DownloadCreatedDestinationCallback
wrapped'' SignalConnectMode
SignalConnectAfter Maybe Text
forall a. Maybe a
Nothing


#if defined(ENABLE_OVERLOADING)
data DownloadCreatedDestinationSignalInfo
instance SignalInfo DownloadCreatedDestinationSignalInfo where
    type HaskellCallbackType DownloadCreatedDestinationSignalInfo = DownloadCreatedDestinationCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_DownloadCreatedDestinationCallback cb
        cb'' <- mk_DownloadCreatedDestinationCallback cb'
        connectSignalFunPtr obj "created-destination" cb'' connectMode detail
    dbgSignalInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.WebKit2.Objects.Download::created-destination"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-webkit2-4.0.28/docs/GI-WebKit2-Objects-Download.html#g:signal:createdDestination"})

#endif

-- signal Download::decide-destination
-- | This signal is emitted after response is received to
-- decide a destination URI for the download. If this signal is not
-- handled the file will be downloaded to 'GI.GLib.Enums.UserDirectoryDirectoryDownload'
-- directory using /@suggestedFilename@/.
type DownloadDecideDestinationCallback =
    T.Text
    -- ^ /@suggestedFilename@/: the filename suggested for the download
    -> IO Bool
    -- ^ __Returns:__ 'P.True' to stop other handlers from being invoked for the event.
    --   'P.False' to propagate the event further.

type C_DownloadDecideDestinationCallback =
    Ptr Download ->                         -- object
    CString ->
    Ptr () ->                               -- user_data
    IO CInt

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

wrap_DownloadDecideDestinationCallback :: 
    GObject a => (a -> DownloadDecideDestinationCallback) ->
    C_DownloadDecideDestinationCallback
wrap_DownloadDecideDestinationCallback :: forall a.
GObject a =>
(a -> DownloadDecideDestinationCallback)
-> C_DownloadDecideDestinationCallback
wrap_DownloadDecideDestinationCallback a -> DownloadDecideDestinationCallback
gi'cb Ptr Download
gi'selfPtr CString
suggestedFilename Ptr ()
_ = do
    Text
suggestedFilename' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
suggestedFilename
    Bool
result <- Ptr Download -> (Download -> IO Bool) -> IO Bool
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient Ptr Download
gi'selfPtr ((Download -> IO Bool) -> IO Bool)
-> (Download -> IO Bool) -> IO Bool
forall a b. (a -> b) -> a -> b
$ \Download
gi'self -> a -> DownloadDecideDestinationCallback
gi'cb (Download -> a
Coerce.coerce Download
gi'self)  Text
suggestedFilename'
    let result' :: CInt
result' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
result
    CInt -> IO CInt
forall (m :: * -> *) a. Monad m => a -> m a
return CInt
result'


-- | Connect a signal handler for the [decideDestination](#signal:decideDestination) 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' download #decideDestination callback
-- @
-- 
-- 
onDownloadDecideDestination :: (IsDownload a, MonadIO m) => a -> ((?self :: a) => DownloadDecideDestinationCallback) -> m SignalHandlerId
onDownloadDecideDestination :: forall a (m :: * -> *).
(IsDownload a, MonadIO m) =>
a
-> ((?self::a) => DownloadDecideDestinationCallback)
-> m SignalHandlerId
onDownloadDecideDestination a
obj (?self::a) => DownloadDecideDestinationCallback
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 -> DownloadDecideDestinationCallback
wrapped a
self = let ?self = a
?self::a
self in (?self::a) => DownloadDecideDestinationCallback
DownloadDecideDestinationCallback
cb
    let wrapped' :: C_DownloadDecideDestinationCallback
wrapped' = (a -> DownloadDecideDestinationCallback)
-> C_DownloadDecideDestinationCallback
forall a.
GObject a =>
(a -> DownloadDecideDestinationCallback)
-> C_DownloadDecideDestinationCallback
wrap_DownloadDecideDestinationCallback a -> DownloadDecideDestinationCallback
wrapped
    FunPtr C_DownloadDecideDestinationCallback
wrapped'' <- C_DownloadDecideDestinationCallback
-> IO (FunPtr C_DownloadDecideDestinationCallback)
mk_DownloadDecideDestinationCallback C_DownloadDecideDestinationCallback
wrapped'
    a
-> Text
-> FunPtr C_DownloadDecideDestinationCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"decide-destination" FunPtr C_DownloadDecideDestinationCallback
wrapped'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing

-- | Connect a signal handler for the [decideDestination](#signal:decideDestination) 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' download #decideDestination 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.
-- 
afterDownloadDecideDestination :: (IsDownload a, MonadIO m) => a -> ((?self :: a) => DownloadDecideDestinationCallback) -> m SignalHandlerId
afterDownloadDecideDestination :: forall a (m :: * -> *).
(IsDownload a, MonadIO m) =>
a
-> ((?self::a) => DownloadDecideDestinationCallback)
-> m SignalHandlerId
afterDownloadDecideDestination a
obj (?self::a) => DownloadDecideDestinationCallback
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 -> DownloadDecideDestinationCallback
wrapped a
self = let ?self = a
?self::a
self in (?self::a) => DownloadDecideDestinationCallback
DownloadDecideDestinationCallback
cb
    let wrapped' :: C_DownloadDecideDestinationCallback
wrapped' = (a -> DownloadDecideDestinationCallback)
-> C_DownloadDecideDestinationCallback
forall a.
GObject a =>
(a -> DownloadDecideDestinationCallback)
-> C_DownloadDecideDestinationCallback
wrap_DownloadDecideDestinationCallback a -> DownloadDecideDestinationCallback
wrapped
    FunPtr C_DownloadDecideDestinationCallback
wrapped'' <- C_DownloadDecideDestinationCallback
-> IO (FunPtr C_DownloadDecideDestinationCallback)
mk_DownloadDecideDestinationCallback C_DownloadDecideDestinationCallback
wrapped'
    a
-> Text
-> FunPtr C_DownloadDecideDestinationCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"decide-destination" FunPtr C_DownloadDecideDestinationCallback
wrapped'' SignalConnectMode
SignalConnectAfter Maybe Text
forall a. Maybe a
Nothing


#if defined(ENABLE_OVERLOADING)
data DownloadDecideDestinationSignalInfo
instance SignalInfo DownloadDecideDestinationSignalInfo where
    type HaskellCallbackType DownloadDecideDestinationSignalInfo = DownloadDecideDestinationCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_DownloadDecideDestinationCallback cb
        cb'' <- mk_DownloadDecideDestinationCallback cb'
        connectSignalFunPtr obj "decide-destination" cb'' connectMode detail
    dbgSignalInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.WebKit2.Objects.Download::decide-destination"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-webkit2-4.0.28/docs/GI-WebKit2-Objects-Download.html#g:signal:decideDestination"})

#endif

-- signal Download::failed
-- | This signal is emitted when an error occurs during the download
-- operation. The given /@error@/, of the domain @/WEBKIT_DOWNLOAD_ERROR/@,
-- contains further details of the failure. If the download is cancelled
-- with 'GI.WebKit2.Objects.Download.downloadCancel', this signal is emitted with error
-- 'GI.WebKit2.Enums.DownloadErrorCancelledByUser'. The download operation finishes
-- after an error and [finished]("GI.WebKit2.Objects.Download#g:signal:finished") signal is emitted after this one.
type DownloadFailedCallback =
    GError
    -- ^ /@error@/: the t'GError' that was triggered
    -> IO ()

type C_DownloadFailedCallback =
    Ptr Download ->                         -- object
    Ptr GError ->
    Ptr () ->                               -- user_data
    IO ()

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

wrap_DownloadFailedCallback :: 
    GObject a => (a -> DownloadFailedCallback) ->
    C_DownloadFailedCallback
wrap_DownloadFailedCallback :: forall a.
GObject a =>
(a -> DownloadFailedCallback) -> C_DownloadFailedCallback
wrap_DownloadFailedCallback a -> DownloadFailedCallback
gi'cb Ptr Download
gi'selfPtr Ptr GError
error_ Ptr ()
_ = do
    GError
error_' <- ((ManagedPtr GError -> GError) -> Ptr GError -> IO GError
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr GError -> GError
GError) Ptr GError
error_
    Ptr Download -> (Download -> IO ()) -> IO ()
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient Ptr Download
gi'selfPtr ((Download -> IO ()) -> IO ()) -> (Download -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Download
gi'self -> a -> DownloadFailedCallback
gi'cb (Download -> a
Coerce.coerce Download
gi'self)  GError
error_'


-- | Connect a signal handler for the [failed](#signal:failed) 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' download #failed callback
-- @
-- 
-- 
onDownloadFailed :: (IsDownload a, MonadIO m) => a -> ((?self :: a) => DownloadFailedCallback) -> m SignalHandlerId
onDownloadFailed :: forall a (m :: * -> *).
(IsDownload a, MonadIO m) =>
a -> ((?self::a) => DownloadFailedCallback) -> m SignalHandlerId
onDownloadFailed a
obj (?self::a) => DownloadFailedCallback
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 -> DownloadFailedCallback
wrapped a
self = let ?self = a
?self::a
self in (?self::a) => DownloadFailedCallback
DownloadFailedCallback
cb
    let wrapped' :: C_DownloadFailedCallback
wrapped' = (a -> DownloadFailedCallback) -> C_DownloadFailedCallback
forall a.
GObject a =>
(a -> DownloadFailedCallback) -> C_DownloadFailedCallback
wrap_DownloadFailedCallback a -> DownloadFailedCallback
wrapped
    FunPtr C_DownloadFailedCallback
wrapped'' <- C_DownloadFailedCallback -> IO (FunPtr C_DownloadFailedCallback)
mk_DownloadFailedCallback C_DownloadFailedCallback
wrapped'
    a
-> Text
-> FunPtr C_DownloadFailedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"failed" FunPtr C_DownloadFailedCallback
wrapped'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing

-- | Connect a signal handler for the [failed](#signal:failed) 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' download #failed 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.
-- 
afterDownloadFailed :: (IsDownload a, MonadIO m) => a -> ((?self :: a) => DownloadFailedCallback) -> m SignalHandlerId
afterDownloadFailed :: forall a (m :: * -> *).
(IsDownload a, MonadIO m) =>
a -> ((?self::a) => DownloadFailedCallback) -> m SignalHandlerId
afterDownloadFailed a
obj (?self::a) => DownloadFailedCallback
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 -> DownloadFailedCallback
wrapped a
self = let ?self = a
?self::a
self in (?self::a) => DownloadFailedCallback
DownloadFailedCallback
cb
    let wrapped' :: C_DownloadFailedCallback
wrapped' = (a -> DownloadFailedCallback) -> C_DownloadFailedCallback
forall a.
GObject a =>
(a -> DownloadFailedCallback) -> C_DownloadFailedCallback
wrap_DownloadFailedCallback a -> DownloadFailedCallback
wrapped
    FunPtr C_DownloadFailedCallback
wrapped'' <- C_DownloadFailedCallback -> IO (FunPtr C_DownloadFailedCallback)
mk_DownloadFailedCallback C_DownloadFailedCallback
wrapped'
    a
-> Text
-> FunPtr C_DownloadFailedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"failed" FunPtr C_DownloadFailedCallback
wrapped'' SignalConnectMode
SignalConnectAfter Maybe Text
forall a. Maybe a
Nothing


#if defined(ENABLE_OVERLOADING)
data DownloadFailedSignalInfo
instance SignalInfo DownloadFailedSignalInfo where
    type HaskellCallbackType DownloadFailedSignalInfo = DownloadFailedCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_DownloadFailedCallback cb
        cb'' <- mk_DownloadFailedCallback cb'
        connectSignalFunPtr obj "failed" cb'' connectMode detail
    dbgSignalInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.WebKit2.Objects.Download::failed"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-webkit2-4.0.28/docs/GI-WebKit2-Objects-Download.html#g:signal:failed"})

#endif

-- signal Download::finished
-- | This signal is emitted when download finishes successfully or due to an error.
-- In case of errors [failed]("GI.WebKit2.Objects.Download#g:signal:failed") signal is emitted before this one.
type DownloadFinishedCallback =
    IO ()

type C_DownloadFinishedCallback =
    Ptr Download ->                         -- object
    Ptr () ->                               -- user_data
    IO ()

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

wrap_DownloadFinishedCallback :: 
    GObject a => (a -> DownloadFinishedCallback) ->
    C_DownloadFinishedCallback
wrap_DownloadFinishedCallback :: forall a. GObject a => (a -> IO ()) -> C_DownloadFinishedCallback
wrap_DownloadFinishedCallback a -> IO ()
gi'cb Ptr Download
gi'selfPtr Ptr ()
_ = do
    Ptr Download -> (Download -> IO ()) -> IO ()
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient Ptr Download
gi'selfPtr ((Download -> IO ()) -> IO ()) -> (Download -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Download
gi'self -> a -> IO ()
gi'cb (Download -> a
Coerce.coerce Download
gi'self) 


-- | Connect a signal handler for the [finished](#signal:finished) 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' download #finished callback
-- @
-- 
-- 
onDownloadFinished :: (IsDownload a, MonadIO m) => a -> ((?self :: a) => DownloadFinishedCallback) -> m SignalHandlerId
onDownloadFinished :: forall a (m :: * -> *).
(IsDownload a, MonadIO m) =>
a -> ((?self::a) => IO ()) -> m SignalHandlerId
onDownloadFinished a
obj (?self::a) => IO ()
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 -> IO ()
wrapped a
self = let ?self = a
?self::a
self in IO ()
(?self::a) => IO ()
cb
    let wrapped' :: C_DownloadFinishedCallback
wrapped' = (a -> IO ()) -> C_DownloadFinishedCallback
forall a. GObject a => (a -> IO ()) -> C_DownloadFinishedCallback
wrap_DownloadFinishedCallback a -> IO ()
wrapped
    FunPtr C_DownloadFinishedCallback
wrapped'' <- C_DownloadFinishedCallback
-> IO (FunPtr C_DownloadFinishedCallback)
mk_DownloadFinishedCallback C_DownloadFinishedCallback
wrapped'
    a
-> Text
-> FunPtr C_DownloadFinishedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"finished" FunPtr C_DownloadFinishedCallback
wrapped'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing

-- | Connect a signal handler for the [finished](#signal:finished) 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' download #finished 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.
-- 
afterDownloadFinished :: (IsDownload a, MonadIO m) => a -> ((?self :: a) => DownloadFinishedCallback) -> m SignalHandlerId
afterDownloadFinished :: forall a (m :: * -> *).
(IsDownload a, MonadIO m) =>
a -> ((?self::a) => IO ()) -> m SignalHandlerId
afterDownloadFinished a
obj (?self::a) => IO ()
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 -> IO ()
wrapped a
self = let ?self = a
?self::a
self in IO ()
(?self::a) => IO ()
cb
    let wrapped' :: C_DownloadFinishedCallback
wrapped' = (a -> IO ()) -> C_DownloadFinishedCallback
forall a. GObject a => (a -> IO ()) -> C_DownloadFinishedCallback
wrap_DownloadFinishedCallback a -> IO ()
wrapped
    FunPtr C_DownloadFinishedCallback
wrapped'' <- C_DownloadFinishedCallback
-> IO (FunPtr C_DownloadFinishedCallback)
mk_DownloadFinishedCallback C_DownloadFinishedCallback
wrapped'
    a
-> Text
-> FunPtr C_DownloadFinishedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"finished" FunPtr C_DownloadFinishedCallback
wrapped'' SignalConnectMode
SignalConnectAfter Maybe Text
forall a. Maybe a
Nothing


#if defined(ENABLE_OVERLOADING)
data DownloadFinishedSignalInfo
instance SignalInfo DownloadFinishedSignalInfo where
    type HaskellCallbackType DownloadFinishedSignalInfo = DownloadFinishedCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_DownloadFinishedCallback cb
        cb'' <- mk_DownloadFinishedCallback cb'
        connectSignalFunPtr obj "finished" cb'' connectMode detail
    dbgSignalInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.WebKit2.Objects.Download::finished"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-webkit2-4.0.28/docs/GI-WebKit2-Objects-Download.html#g:signal:finished"})

#endif

-- signal Download::received-data
-- | This signal is emitted after response is received,
-- every time new data has been written to the destination. It\'s
-- useful to know the progress of the download operation.
type DownloadReceivedDataCallback =
    Word64
    -- ^ /@dataLength@/: the length of data received in bytes
    -> IO ()

type C_DownloadReceivedDataCallback =
    Ptr Download ->                         -- object
    Word64 ->
    Ptr () ->                               -- user_data
    IO ()

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

wrap_DownloadReceivedDataCallback :: 
    GObject a => (a -> DownloadReceivedDataCallback) ->
    C_DownloadReceivedDataCallback
wrap_DownloadReceivedDataCallback :: forall a.
GObject a =>
(a -> DownloadReceivedDataCallback)
-> C_DownloadReceivedDataCallback
wrap_DownloadReceivedDataCallback a -> DownloadReceivedDataCallback
gi'cb Ptr Download
gi'selfPtr Word64
dataLength Ptr ()
_ = do
    Ptr Download -> (Download -> IO ()) -> IO ()
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient Ptr Download
gi'selfPtr ((Download -> IO ()) -> IO ()) -> (Download -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Download
gi'self -> a -> DownloadReceivedDataCallback
gi'cb (Download -> a
Coerce.coerce Download
gi'self)  Word64
dataLength


-- | Connect a signal handler for the [receivedData](#signal:receivedData) 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' download #receivedData callback
-- @
-- 
-- 
onDownloadReceivedData :: (IsDownload a, MonadIO m) => a -> ((?self :: a) => DownloadReceivedDataCallback) -> m SignalHandlerId
onDownloadReceivedData :: forall a (m :: * -> *).
(IsDownload a, MonadIO m) =>
a
-> ((?self::a) => DownloadReceivedDataCallback)
-> m SignalHandlerId
onDownloadReceivedData a
obj (?self::a) => DownloadReceivedDataCallback
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 -> DownloadReceivedDataCallback
wrapped a
self = let ?self = a
?self::a
self in (?self::a) => DownloadReceivedDataCallback
DownloadReceivedDataCallback
cb
    let wrapped' :: C_DownloadReceivedDataCallback
wrapped' = (a -> DownloadReceivedDataCallback)
-> C_DownloadReceivedDataCallback
forall a.
GObject a =>
(a -> DownloadReceivedDataCallback)
-> C_DownloadReceivedDataCallback
wrap_DownloadReceivedDataCallback a -> DownloadReceivedDataCallback
wrapped
    FunPtr C_DownloadReceivedDataCallback
wrapped'' <- C_DownloadReceivedDataCallback
-> IO (FunPtr C_DownloadReceivedDataCallback)
mk_DownloadReceivedDataCallback C_DownloadReceivedDataCallback
wrapped'
    a
-> Text
-> FunPtr C_DownloadReceivedDataCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"received-data" FunPtr C_DownloadReceivedDataCallback
wrapped'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing

-- | Connect a signal handler for the [receivedData](#signal:receivedData) 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' download #receivedData 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.
-- 
afterDownloadReceivedData :: (IsDownload a, MonadIO m) => a -> ((?self :: a) => DownloadReceivedDataCallback) -> m SignalHandlerId
afterDownloadReceivedData :: forall a (m :: * -> *).
(IsDownload a, MonadIO m) =>
a
-> ((?self::a) => DownloadReceivedDataCallback)
-> m SignalHandlerId
afterDownloadReceivedData a
obj (?self::a) => DownloadReceivedDataCallback
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 -> DownloadReceivedDataCallback
wrapped a
self = let ?self = a
?self::a
self in (?self::a) => DownloadReceivedDataCallback
DownloadReceivedDataCallback
cb
    let wrapped' :: C_DownloadReceivedDataCallback
wrapped' = (a -> DownloadReceivedDataCallback)
-> C_DownloadReceivedDataCallback
forall a.
GObject a =>
(a -> DownloadReceivedDataCallback)
-> C_DownloadReceivedDataCallback
wrap_DownloadReceivedDataCallback a -> DownloadReceivedDataCallback
wrapped
    FunPtr C_DownloadReceivedDataCallback
wrapped'' <- C_DownloadReceivedDataCallback
-> IO (FunPtr C_DownloadReceivedDataCallback)
mk_DownloadReceivedDataCallback C_DownloadReceivedDataCallback
wrapped'
    a
-> Text
-> FunPtr C_DownloadReceivedDataCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"received-data" FunPtr C_DownloadReceivedDataCallback
wrapped'' SignalConnectMode
SignalConnectAfter Maybe Text
forall a. Maybe a
Nothing


#if defined(ENABLE_OVERLOADING)
data DownloadReceivedDataSignalInfo
instance SignalInfo DownloadReceivedDataSignalInfo where
    type HaskellCallbackType DownloadReceivedDataSignalInfo = DownloadReceivedDataCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_DownloadReceivedDataCallback cb
        cb'' <- mk_DownloadReceivedDataCallback cb'
        connectSignalFunPtr obj "received-data" cb'' connectMode detail
    dbgSignalInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.WebKit2.Objects.Download::received-data"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-webkit2-4.0.28/docs/GI-WebKit2-Objects-Download.html#g:signal:receivedData"})

#endif

-- VVV Prop "allow-overwrite"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Just False,Just False)

-- | Get the value of the “@allow-overwrite@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' download #allowOverwrite
-- @
getDownloadAllowOverwrite :: (MonadIO m, IsDownload o) => o -> m Bool
getDownloadAllowOverwrite :: forall (m :: * -> *) o. (MonadIO m, IsDownload o) => o -> m Bool
getDownloadAllowOverwrite 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
"allow-overwrite"

-- | Set the value of the “@allow-overwrite@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' download [ #allowOverwrite 'Data.GI.Base.Attributes.:=' value ]
-- @
setDownloadAllowOverwrite :: (MonadIO m, IsDownload o) => o -> Bool -> m ()
setDownloadAllowOverwrite :: forall (m :: * -> *) o.
(MonadIO m, IsDownload o) =>
o -> Bool -> m ()
setDownloadAllowOverwrite o
obj Bool
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    o -> String -> Bool -> IO ()
forall a. GObject a => a -> String -> Bool -> IO ()
B.Properties.setObjectPropertyBool o
obj String
"allow-overwrite" Bool
val

-- | Construct a `GValueConstruct` with valid value for the “@allow-overwrite@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
constructDownloadAllowOverwrite :: (IsDownload o, MIO.MonadIO m) => Bool -> m (GValueConstruct o)
constructDownloadAllowOverwrite :: forall o (m :: * -> *).
(IsDownload o, MonadIO m) =>
Bool -> m (GValueConstruct o)
constructDownloadAllowOverwrite Bool
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ do
    IO (GValueConstruct o) -> IO (GValueConstruct o)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> IO (GValueConstruct o))
-> IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> Bool -> IO (GValueConstruct o)
forall o. String -> Bool -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyBool String
"allow-overwrite" Bool
val

#if defined(ENABLE_OVERLOADING)
data DownloadAllowOverwritePropertyInfo
instance AttrInfo DownloadAllowOverwritePropertyInfo where
    type AttrAllowedOps DownloadAllowOverwritePropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrBaseTypeConstraint DownloadAllowOverwritePropertyInfo = IsDownload
    type AttrSetTypeConstraint DownloadAllowOverwritePropertyInfo = (~) Bool
    type AttrTransferTypeConstraint DownloadAllowOverwritePropertyInfo = (~) Bool
    type AttrTransferType DownloadAllowOverwritePropertyInfo = Bool
    type AttrGetType DownloadAllowOverwritePropertyInfo = Bool
    type AttrLabel DownloadAllowOverwritePropertyInfo = "allow-overwrite"
    type AttrOrigin DownloadAllowOverwritePropertyInfo = Download
    attrGet = getDownloadAllowOverwrite
    attrSet = setDownloadAllowOverwrite
    attrTransfer _ v = do
        return v
    attrConstruct = constructDownloadAllowOverwrite
    attrClear = undefined
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.WebKit2.Objects.Download.allowOverwrite"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-webkit2-4.0.28/docs/GI-WebKit2-Objects-Download.html#g:attr:allowOverwrite"
        })
#endif

-- VVV Prop "destination"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable]
   -- Nullable: (Just True,Just False)

-- | Get the value of the “@destination@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' download #destination
-- @
getDownloadDestination :: (MonadIO m, IsDownload o) => o -> m (Maybe T.Text)
getDownloadDestination :: forall (m :: * -> *) o.
(MonadIO m, IsDownload o) =>
o -> m (Maybe Text)
getDownloadDestination o
obj = IO (Maybe Text) -> m (Maybe Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ o -> String -> IO (Maybe Text)
forall a. GObject a => a -> String -> IO (Maybe Text)
B.Properties.getObjectPropertyString o
obj String
"destination"

#if defined(ENABLE_OVERLOADING)
data DownloadDestinationPropertyInfo
instance AttrInfo DownloadDestinationPropertyInfo where
    type AttrAllowedOps DownloadDestinationPropertyInfo = '[ 'AttrGet]
    type AttrBaseTypeConstraint DownloadDestinationPropertyInfo = IsDownload
    type AttrSetTypeConstraint DownloadDestinationPropertyInfo = (~) ()
    type AttrTransferTypeConstraint DownloadDestinationPropertyInfo = (~) ()
    type AttrTransferType DownloadDestinationPropertyInfo = ()
    type AttrGetType DownloadDestinationPropertyInfo = (Maybe T.Text)
    type AttrLabel DownloadDestinationPropertyInfo = "destination"
    type AttrOrigin DownloadDestinationPropertyInfo = Download
    attrGet = getDownloadDestination
    attrSet = undefined
    attrTransfer _ = undefined
    attrConstruct = undefined
    attrClear = undefined
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.WebKit2.Objects.Download.destination"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-webkit2-4.0.28/docs/GI-WebKit2-Objects-Download.html#g:attr:destination"
        })
#endif

-- VVV Prop "estimated-progress"
   -- Type: TBasicType TDouble
   -- Flags: [PropertyReadable]
   -- Nullable: (Just False,Nothing)

-- | Get the value of the “@estimated-progress@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' download #estimatedProgress
-- @
getDownloadEstimatedProgress :: (MonadIO m, IsDownload o) => o -> m Double
getDownloadEstimatedProgress :: forall (m :: * -> *) o. (MonadIO m, IsDownload o) => o -> m Double
getDownloadEstimatedProgress o
obj = IO Double -> m Double
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO Double -> m Double) -> IO Double -> m Double
forall a b. (a -> b) -> a -> b
$ o -> String -> IO Double
forall a. GObject a => a -> String -> IO Double
B.Properties.getObjectPropertyDouble o
obj String
"estimated-progress"

#if defined(ENABLE_OVERLOADING)
data DownloadEstimatedProgressPropertyInfo
instance AttrInfo DownloadEstimatedProgressPropertyInfo where
    type AttrAllowedOps DownloadEstimatedProgressPropertyInfo = '[ 'AttrGet]
    type AttrBaseTypeConstraint DownloadEstimatedProgressPropertyInfo = IsDownload
    type AttrSetTypeConstraint DownloadEstimatedProgressPropertyInfo = (~) ()
    type AttrTransferTypeConstraint DownloadEstimatedProgressPropertyInfo = (~) ()
    type AttrTransferType DownloadEstimatedProgressPropertyInfo = ()
    type AttrGetType DownloadEstimatedProgressPropertyInfo = Double
    type AttrLabel DownloadEstimatedProgressPropertyInfo = "estimated-progress"
    type AttrOrigin DownloadEstimatedProgressPropertyInfo = Download
    attrGet = getDownloadEstimatedProgress
    attrSet = undefined
    attrTransfer _ = undefined
    attrConstruct = undefined
    attrClear = undefined
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.WebKit2.Objects.Download.estimatedProgress"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-webkit2-4.0.28/docs/GI-WebKit2-Objects-Download.html#g:attr:estimatedProgress"
        })
#endif

-- VVV Prop "response"
   -- Type: TInterface (Name {namespace = "WebKit2", name = "URIResponse"})
   -- Flags: [PropertyReadable]
   -- Nullable: (Just True,Nothing)

-- | Get the value of the “@response@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' download #response
-- @
getDownloadResponse :: (MonadIO m, IsDownload o) => o -> m (Maybe WebKit2.URIResponse.URIResponse)
getDownloadResponse :: forall (m :: * -> *) o.
(MonadIO m, IsDownload o) =>
o -> m (Maybe URIResponse)
getDownloadResponse o
obj = IO (Maybe URIResponse) -> m (Maybe URIResponse)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (Maybe URIResponse) -> m (Maybe URIResponse))
-> IO (Maybe URIResponse) -> m (Maybe URIResponse)
forall a b. (a -> b) -> a -> b
$ o
-> String
-> (ManagedPtr URIResponse -> URIResponse)
-> IO (Maybe URIResponse)
forall a b.
(GObject a, GObject b) =>
a -> String -> (ManagedPtr b -> b) -> IO (Maybe b)
B.Properties.getObjectPropertyObject o
obj String
"response" ManagedPtr URIResponse -> URIResponse
WebKit2.URIResponse.URIResponse

#if defined(ENABLE_OVERLOADING)
data DownloadResponsePropertyInfo
instance AttrInfo DownloadResponsePropertyInfo where
    type AttrAllowedOps DownloadResponsePropertyInfo = '[ 'AttrGet, 'AttrClear]
    type AttrBaseTypeConstraint DownloadResponsePropertyInfo = IsDownload
    type AttrSetTypeConstraint DownloadResponsePropertyInfo = (~) ()
    type AttrTransferTypeConstraint DownloadResponsePropertyInfo = (~) ()
    type AttrTransferType DownloadResponsePropertyInfo = ()
    type AttrGetType DownloadResponsePropertyInfo = (Maybe WebKit2.URIResponse.URIResponse)
    type AttrLabel DownloadResponsePropertyInfo = "response"
    type AttrOrigin DownloadResponsePropertyInfo = Download
    attrGet = getDownloadResponse
    attrSet = undefined
    attrTransfer _ = undefined
    attrConstruct = undefined
    attrClear = undefined
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.WebKit2.Objects.Download.response"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-webkit2-4.0.28/docs/GI-WebKit2-Objects-Download.html#g:attr:response"
        })
#endif

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Download
type instance O.AttributeList Download = DownloadAttributeList
type DownloadAttributeList = ('[ '("allowOverwrite", DownloadAllowOverwritePropertyInfo), '("destination", DownloadDestinationPropertyInfo), '("estimatedProgress", DownloadEstimatedProgressPropertyInfo), '("response", DownloadResponsePropertyInfo)] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING)
downloadAllowOverwrite :: AttrLabelProxy "allowOverwrite"
downloadAllowOverwrite = AttrLabelProxy

downloadDestination :: AttrLabelProxy "destination"
downloadDestination = AttrLabelProxy

downloadEstimatedProgress :: AttrLabelProxy "estimatedProgress"
downloadEstimatedProgress = AttrLabelProxy

downloadResponse :: AttrLabelProxy "response"
downloadResponse = AttrLabelProxy

#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Download = DownloadSignalList
type DownloadSignalList = ('[ '("createdDestination", DownloadCreatedDestinationSignalInfo), '("decideDestination", DownloadDecideDestinationSignalInfo), '("failed", DownloadFailedSignalInfo), '("finished", DownloadFinishedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("receivedData", DownloadReceivedDataSignalInfo)] :: [(Symbol, *)])

#endif

-- method Download::cancel
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "download"
--           , argType =
--               TInterface Name { namespace = "WebKit2" , name = "Download" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #WebKitDownload" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "webkit_download_cancel" webkit_download_cancel :: 
    Ptr Download ->                         -- download : TInterface (Name {namespace = "WebKit2", name = "Download"})
    IO ()

-- | Cancels the download. When the ongoing download
-- operation is effectively cancelled the signal
-- [failed]("GI.WebKit2.Objects.Download#g:signal:failed") is emitted with
-- 'GI.WebKit2.Enums.DownloadErrorCancelledByUser' error.
downloadCancel ::
    (B.CallStack.HasCallStack, MonadIO m, IsDownload a) =>
    a
    -- ^ /@download@/: a t'GI.WebKit2.Objects.Download.Download'
    -> m ()
downloadCancel :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsDownload a) =>
a -> m ()
downloadCancel a
download = 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 Download
download' <- a -> IO (Ptr Download)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
download
    Ptr Download -> IO ()
webkit_download_cancel Ptr Download
download'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
download
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data DownloadCancelMethodInfo
instance (signature ~ (m ()), MonadIO m, IsDownload a) => O.OverloadedMethod DownloadCancelMethodInfo a signature where
    overloadedMethod = downloadCancel

instance O.OverloadedMethodInfo DownloadCancelMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.WebKit2.Objects.Download.downloadCancel",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-webkit2-4.0.28/docs/GI-WebKit2-Objects-Download.html#v:downloadCancel"
        })


#endif

-- method Download::get_allow_overwrite
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "download"
--           , argType =
--               TInterface Name { namespace = "WebKit2" , name = "Download" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #WebKitDownload" , 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 "webkit_download_get_allow_overwrite" webkit_download_get_allow_overwrite :: 
    Ptr Download ->                         -- download : TInterface (Name {namespace = "WebKit2", name = "Download"})
    IO CInt

-- | Returns the current value of the t'GI.WebKit2.Objects.Download.Download':@/allow-overwrite/@ property,
-- which determines whether the download will overwrite an existing file on
-- disk, or if it will fail if the destination already exists.
-- 
-- /Since: 2.6/
downloadGetAllowOverwrite ::
    (B.CallStack.HasCallStack, MonadIO m, IsDownload a) =>
    a
    -- ^ /@download@/: a t'GI.WebKit2.Objects.Download.Download'
    -> m Bool
    -- ^ __Returns:__ the current value of the t'GI.WebKit2.Objects.Download.Download':@/allow-overwrite/@ property
downloadGetAllowOverwrite :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsDownload a) =>
a -> m Bool
downloadGetAllowOverwrite a
download = 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 Download
download' <- a -> IO (Ptr Download)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
download
    CInt
result <- Ptr Download -> IO CInt
webkit_download_get_allow_overwrite Ptr Download
download'
    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
download
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if defined(ENABLE_OVERLOADING)
data DownloadGetAllowOverwriteMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsDownload a) => O.OverloadedMethod DownloadGetAllowOverwriteMethodInfo a signature where
    overloadedMethod = downloadGetAllowOverwrite

instance O.OverloadedMethodInfo DownloadGetAllowOverwriteMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.WebKit2.Objects.Download.downloadGetAllowOverwrite",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-webkit2-4.0.28/docs/GI-WebKit2-Objects-Download.html#v:downloadGetAllowOverwrite"
        })


#endif

-- method Download::get_destination
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "download"
--           , argType =
--               TInterface Name { namespace = "WebKit2" , name = "Download" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #WebKitDownload" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "webkit_download_get_destination" webkit_download_get_destination :: 
    Ptr Download ->                         -- download : TInterface (Name {namespace = "WebKit2", name = "Download"})
    IO CString

-- | Obtains the URI to which the downloaded file will be written. You
-- can connect to [createdDestination]("GI.WebKit2.Objects.Download#g:signal:createdDestination") to make
-- sure this method returns a valid destination.
downloadGetDestination ::
    (B.CallStack.HasCallStack, MonadIO m, IsDownload a) =>
    a
    -- ^ /@download@/: a t'GI.WebKit2.Objects.Download.Download'
    -> m (Maybe T.Text)
    -- ^ __Returns:__ the destination URI or 'P.Nothing'
downloadGetDestination :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsDownload a) =>
a -> m (Maybe Text)
downloadGetDestination a
download = IO (Maybe Text) -> m (Maybe Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
    Ptr Download
download' <- a -> IO (Ptr Download)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
download
    CString
result <- Ptr Download -> IO CString
webkit_download_get_destination Ptr Download
download'
    Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
        Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
        Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
download
    Maybe Text -> IO (Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult

#if defined(ENABLE_OVERLOADING)
data DownloadGetDestinationMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m, IsDownload a) => O.OverloadedMethod DownloadGetDestinationMethodInfo a signature where
    overloadedMethod = downloadGetDestination

instance O.OverloadedMethodInfo DownloadGetDestinationMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.WebKit2.Objects.Download.downloadGetDestination",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-webkit2-4.0.28/docs/GI-WebKit2-Objects-Download.html#v:downloadGetDestination"
        })


#endif

-- method Download::get_elapsed_time
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "download"
--           , argType =
--               TInterface Name { namespace = "WebKit2" , name = "Download" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #WebKitDownload" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TDouble)
-- throws : False
-- Skip return : False

foreign import ccall "webkit_download_get_elapsed_time" webkit_download_get_elapsed_time :: 
    Ptr Download ->                         -- download : TInterface (Name {namespace = "WebKit2", name = "Download"})
    IO CDouble

-- | Gets the elapsed time in seconds, including any fractional part.
-- If the download finished, had an error or was cancelled this is
-- the time between its start and the event.
downloadGetElapsedTime ::
    (B.CallStack.HasCallStack, MonadIO m, IsDownload a) =>
    a
    -- ^ /@download@/: a t'GI.WebKit2.Objects.Download.Download'
    -> m Double
    -- ^ __Returns:__ seconds since the download was started
downloadGetElapsedTime :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsDownload a) =>
a -> m Double
downloadGetElapsedTime a
download = IO Double -> m Double
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Double -> m Double) -> IO Double -> m Double
forall a b. (a -> b) -> a -> b
$ do
    Ptr Download
download' <- a -> IO (Ptr Download)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
download
    CDouble
result <- Ptr Download -> IO CDouble
webkit_download_get_elapsed_time Ptr Download
download'
    let result' :: Double
result' = CDouble -> Double
forall a b. (Real a, Fractional b) => a -> b
realToFrac CDouble
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
download
    Double -> IO Double
forall (m :: * -> *) a. Monad m => a -> m a
return Double
result'

#if defined(ENABLE_OVERLOADING)
data DownloadGetElapsedTimeMethodInfo
instance (signature ~ (m Double), MonadIO m, IsDownload a) => O.OverloadedMethod DownloadGetElapsedTimeMethodInfo a signature where
    overloadedMethod = downloadGetElapsedTime

instance O.OverloadedMethodInfo DownloadGetElapsedTimeMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.WebKit2.Objects.Download.downloadGetElapsedTime",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-webkit2-4.0.28/docs/GI-WebKit2-Objects-Download.html#v:downloadGetElapsedTime"
        })


#endif

-- method Download::get_estimated_progress
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "download"
--           , argType =
--               TInterface Name { namespace = "WebKit2" , name = "Download" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #WebKitDownload" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TDouble)
-- throws : False
-- Skip return : False

foreign import ccall "webkit_download_get_estimated_progress" webkit_download_get_estimated_progress :: 
    Ptr Download ->                         -- download : TInterface (Name {namespace = "WebKit2", name = "Download"})
    IO CDouble

-- | Gets the value of the t'GI.WebKit2.Objects.Download.Download':@/estimated-progress/@ property.
-- You can monitor the estimated progress of the download operation by
-- connecting to the notify[estimatedProgress](#g:signal:estimatedProgress) signal of /@download@/.
downloadGetEstimatedProgress ::
    (B.CallStack.HasCallStack, MonadIO m, IsDownload a) =>
    a
    -- ^ /@download@/: a t'GI.WebKit2.Objects.Download.Download'
    -> m Double
    -- ^ __Returns:__ an estimate of the of the percent complete for a download
    --     as a range from 0.0 to 1.0.
downloadGetEstimatedProgress :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsDownload a) =>
a -> m Double
downloadGetEstimatedProgress a
download = IO Double -> m Double
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Double -> m Double) -> IO Double -> m Double
forall a b. (a -> b) -> a -> b
$ do
    Ptr Download
download' <- a -> IO (Ptr Download)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
download
    CDouble
result <- Ptr Download -> IO CDouble
webkit_download_get_estimated_progress Ptr Download
download'
    let result' :: Double
result' = CDouble -> Double
forall a b. (Real a, Fractional b) => a -> b
realToFrac CDouble
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
download
    Double -> IO Double
forall (m :: * -> *) a. Monad m => a -> m a
return Double
result'

#if defined(ENABLE_OVERLOADING)
data DownloadGetEstimatedProgressMethodInfo
instance (signature ~ (m Double), MonadIO m, IsDownload a) => O.OverloadedMethod DownloadGetEstimatedProgressMethodInfo a signature where
    overloadedMethod = downloadGetEstimatedProgress

instance O.OverloadedMethodInfo DownloadGetEstimatedProgressMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.WebKit2.Objects.Download.downloadGetEstimatedProgress",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-webkit2-4.0.28/docs/GI-WebKit2-Objects-Download.html#v:downloadGetEstimatedProgress"
        })


#endif

-- method Download::get_received_data_length
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "download"
--           , argType =
--               TInterface Name { namespace = "WebKit2" , name = "Download" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #WebKitDownload" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt64)
-- throws : False
-- Skip return : False

foreign import ccall "webkit_download_get_received_data_length" webkit_download_get_received_data_length :: 
    Ptr Download ->                         -- download : TInterface (Name {namespace = "WebKit2", name = "Download"})
    IO Word64

-- | Gets the length of the data already downloaded for /@download@/
-- in bytes.
downloadGetReceivedDataLength ::
    (B.CallStack.HasCallStack, MonadIO m, IsDownload a) =>
    a
    -- ^ /@download@/: a t'GI.WebKit2.Objects.Download.Download'
    -> m Word64
    -- ^ __Returns:__ the amount of bytes already downloaded.
downloadGetReceivedDataLength :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsDownload a) =>
a -> m Word64
downloadGetReceivedDataLength a
download = IO Word64 -> m Word64
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word64 -> m Word64) -> IO Word64 -> m Word64
forall a b. (a -> b) -> a -> b
$ do
    Ptr Download
download' <- a -> IO (Ptr Download)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
download
    Word64
result <- Ptr Download -> IO Word64
webkit_download_get_received_data_length Ptr Download
download'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
download
    Word64 -> IO Word64
forall (m :: * -> *) a. Monad m => a -> m a
return Word64
result

#if defined(ENABLE_OVERLOADING)
data DownloadGetReceivedDataLengthMethodInfo
instance (signature ~ (m Word64), MonadIO m, IsDownload a) => O.OverloadedMethod DownloadGetReceivedDataLengthMethodInfo a signature where
    overloadedMethod = downloadGetReceivedDataLength

instance O.OverloadedMethodInfo DownloadGetReceivedDataLengthMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.WebKit2.Objects.Download.downloadGetReceivedDataLength",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-webkit2-4.0.28/docs/GI-WebKit2-Objects-Download.html#v:downloadGetReceivedDataLength"
        })


#endif

-- method Download::get_request
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "download"
--           , argType =
--               TInterface Name { namespace = "WebKit2" , name = "Download" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #WebKitDownload" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "WebKit2" , name = "URIRequest" })
-- throws : False
-- Skip return : False

foreign import ccall "webkit_download_get_request" webkit_download_get_request :: 
    Ptr Download ->                         -- download : TInterface (Name {namespace = "WebKit2", name = "Download"})
    IO (Ptr WebKit2.URIRequest.URIRequest)

-- | Retrieves the t'GI.WebKit2.Objects.URIRequest.URIRequest' object that backs the download
-- process.
downloadGetRequest ::
    (B.CallStack.HasCallStack, MonadIO m, IsDownload a) =>
    a
    -- ^ /@download@/: a t'GI.WebKit2.Objects.Download.Download'
    -> m WebKit2.URIRequest.URIRequest
    -- ^ __Returns:__ the t'GI.WebKit2.Objects.URIRequest.URIRequest' of /@download@/
downloadGetRequest :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsDownload a) =>
a -> m URIRequest
downloadGetRequest a
download = IO URIRequest -> m URIRequest
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO URIRequest -> m URIRequest) -> IO URIRequest -> m URIRequest
forall a b. (a -> b) -> a -> b
$ do
    Ptr Download
download' <- a -> IO (Ptr Download)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
download
    Ptr URIRequest
result <- Ptr Download -> IO (Ptr URIRequest)
webkit_download_get_request Ptr Download
download'
    Text -> Ptr URIRequest -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"downloadGetRequest" Ptr URIRequest
result
    URIRequest
result' <- ((ManagedPtr URIRequest -> URIRequest)
-> Ptr URIRequest -> IO URIRequest
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr URIRequest -> URIRequest
WebKit2.URIRequest.URIRequest) Ptr URIRequest
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
download
    URIRequest -> IO URIRequest
forall (m :: * -> *) a. Monad m => a -> m a
return URIRequest
result'

#if defined(ENABLE_OVERLOADING)
data DownloadGetRequestMethodInfo
instance (signature ~ (m WebKit2.URIRequest.URIRequest), MonadIO m, IsDownload a) => O.OverloadedMethod DownloadGetRequestMethodInfo a signature where
    overloadedMethod = downloadGetRequest

instance O.OverloadedMethodInfo DownloadGetRequestMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.WebKit2.Objects.Download.downloadGetRequest",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-webkit2-4.0.28/docs/GI-WebKit2-Objects-Download.html#v:downloadGetRequest"
        })


#endif

-- method Download::get_response
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "download"
--           , argType =
--               TInterface Name { namespace = "WebKit2" , name = "Download" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #WebKitDownload" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "WebKit2" , name = "URIResponse" })
-- throws : False
-- Skip return : False

foreign import ccall "webkit_download_get_response" webkit_download_get_response :: 
    Ptr Download ->                         -- download : TInterface (Name {namespace = "WebKit2", name = "Download"})
    IO (Ptr WebKit2.URIResponse.URIResponse)

-- | Retrieves the t'GI.WebKit2.Objects.URIResponse.URIResponse' object that backs the download
-- process. This method returns 'P.Nothing' if called before the response
-- is received from the server. You can connect to notify[response](#g:signal:response)
-- signal to be notified when the response is received.
downloadGetResponse ::
    (B.CallStack.HasCallStack, MonadIO m, IsDownload a) =>
    a
    -- ^ /@download@/: a t'GI.WebKit2.Objects.Download.Download'
    -> m (Maybe WebKit2.URIResponse.URIResponse)
    -- ^ __Returns:__ the t'GI.WebKit2.Objects.URIResponse.URIResponse', or 'P.Nothing' if
    --     the response hasn\'t been received yet.
downloadGetResponse :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsDownload a) =>
a -> m (Maybe URIResponse)
downloadGetResponse a
download = IO (Maybe URIResponse) -> m (Maybe URIResponse)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe URIResponse) -> m (Maybe URIResponse))
-> IO (Maybe URIResponse) -> m (Maybe URIResponse)
forall a b. (a -> b) -> a -> b
$ do
    Ptr Download
download' <- a -> IO (Ptr Download)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
download
    Ptr URIResponse
result <- Ptr Download -> IO (Ptr URIResponse)
webkit_download_get_response Ptr Download
download'
    Maybe URIResponse
maybeResult <- Ptr URIResponse
-> (Ptr URIResponse -> IO URIResponse) -> IO (Maybe URIResponse)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr URIResponse
result ((Ptr URIResponse -> IO URIResponse) -> IO (Maybe URIResponse))
-> (Ptr URIResponse -> IO URIResponse) -> IO (Maybe URIResponse)
forall a b. (a -> b) -> a -> b
$ \Ptr URIResponse
result' -> do
        URIResponse
result'' <- ((ManagedPtr URIResponse -> URIResponse)
-> Ptr URIResponse -> IO URIResponse
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr URIResponse -> URIResponse
WebKit2.URIResponse.URIResponse) Ptr URIResponse
result'
        URIResponse -> IO URIResponse
forall (m :: * -> *) a. Monad m => a -> m a
return URIResponse
result''
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
download
    Maybe URIResponse -> IO (Maybe URIResponse)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe URIResponse
maybeResult

#if defined(ENABLE_OVERLOADING)
data DownloadGetResponseMethodInfo
instance (signature ~ (m (Maybe WebKit2.URIResponse.URIResponse)), MonadIO m, IsDownload a) => O.OverloadedMethod DownloadGetResponseMethodInfo a signature where
    overloadedMethod = downloadGetResponse

instance O.OverloadedMethodInfo DownloadGetResponseMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.WebKit2.Objects.Download.downloadGetResponse",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-webkit2-4.0.28/docs/GI-WebKit2-Objects-Download.html#v:downloadGetResponse"
        })


#endif

-- method Download::get_web_view
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "download"
--           , argType =
--               TInterface Name { namespace = "WebKit2" , name = "Download" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #WebKitDownload" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "WebKit2" , name = "WebView" })
-- throws : False
-- Skip return : False

foreign import ccall "webkit_download_get_web_view" webkit_download_get_web_view :: 
    Ptr Download ->                         -- download : TInterface (Name {namespace = "WebKit2", name = "Download"})
    IO (Ptr WebKit2.WebView.WebView)

-- | Get the t'GI.WebKit2.Objects.WebView.WebView' that initiated the download.
downloadGetWebView ::
    (B.CallStack.HasCallStack, MonadIO m, IsDownload a) =>
    a
    -- ^ /@download@/: a t'GI.WebKit2.Objects.Download.Download'
    -> m (Maybe WebKit2.WebView.WebView)
    -- ^ __Returns:__ the t'GI.WebKit2.Objects.WebView.WebView' that initiated /@download@/,
    --    or 'P.Nothing' if /@download@/ was not initiated by a t'GI.WebKit2.Objects.WebView.WebView'.
downloadGetWebView :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsDownload a) =>
a -> m (Maybe WebView)
downloadGetWebView a
download = IO (Maybe WebView) -> m (Maybe WebView)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe WebView) -> m (Maybe WebView))
-> IO (Maybe WebView) -> m (Maybe WebView)
forall a b. (a -> b) -> a -> b
$ do
    Ptr Download
download' <- a -> IO (Ptr Download)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
download
    Ptr WebView
result <- Ptr Download -> IO (Ptr WebView)
webkit_download_get_web_view Ptr Download
download'
    Maybe WebView
maybeResult <- Ptr WebView -> (Ptr WebView -> IO WebView) -> IO (Maybe WebView)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr WebView
result ((Ptr WebView -> IO WebView) -> IO (Maybe WebView))
-> (Ptr WebView -> IO WebView) -> IO (Maybe WebView)
forall a b. (a -> b) -> a -> b
$ \Ptr WebView
result' -> do
        WebView
result'' <- ((ManagedPtr WebView -> WebView) -> Ptr WebView -> IO WebView
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr WebView -> WebView
WebKit2.WebView.WebView) Ptr WebView
result'
        WebView -> IO WebView
forall (m :: * -> *) a. Monad m => a -> m a
return WebView
result''
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
download
    Maybe WebView -> IO (Maybe WebView)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe WebView
maybeResult

#if defined(ENABLE_OVERLOADING)
data DownloadGetWebViewMethodInfo
instance (signature ~ (m (Maybe WebKit2.WebView.WebView)), MonadIO m, IsDownload a) => O.OverloadedMethod DownloadGetWebViewMethodInfo a signature where
    overloadedMethod = downloadGetWebView

instance O.OverloadedMethodInfo DownloadGetWebViewMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.WebKit2.Objects.Download.downloadGetWebView",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-webkit2-4.0.28/docs/GI-WebKit2-Objects-Download.html#v:downloadGetWebView"
        })


#endif

-- method Download::set_allow_overwrite
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "download"
--           , argType =
--               TInterface Name { namespace = "WebKit2" , name = "Download" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #WebKitDownload" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "allowed"
--           , argType = TBasicType TBoolean
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the new value for the #WebKitDownload:allow-overwrite property"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "webkit_download_set_allow_overwrite" webkit_download_set_allow_overwrite :: 
    Ptr Download ->                         -- download : TInterface (Name {namespace = "WebKit2", name = "Download"})
    CInt ->                                 -- allowed : TBasicType TBoolean
    IO ()

-- | Sets the t'GI.WebKit2.Objects.Download.Download':@/allow-overwrite/@ property, which determines whether
-- the download may overwrite an existing file on disk, or if it will fail if
-- the destination already exists.
-- 
-- /Since: 2.6/
downloadSetAllowOverwrite ::
    (B.CallStack.HasCallStack, MonadIO m, IsDownload a) =>
    a
    -- ^ /@download@/: a t'GI.WebKit2.Objects.Download.Download'
    -> Bool
    -- ^ /@allowed@/: the new value for the t'GI.WebKit2.Objects.Download.Download':@/allow-overwrite/@ property
    -> m ()
downloadSetAllowOverwrite :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsDownload a) =>
a -> Bool -> m ()
downloadSetAllowOverwrite a
download Bool
allowed = 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 Download
download' <- a -> IO (Ptr Download)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
download
    let allowed' :: CInt
allowed' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
allowed
    Ptr Download -> CInt -> IO ()
webkit_download_set_allow_overwrite Ptr Download
download' CInt
allowed'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
download
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data DownloadSetAllowOverwriteMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m, IsDownload a) => O.OverloadedMethod DownloadSetAllowOverwriteMethodInfo a signature where
    overloadedMethod = downloadSetAllowOverwrite

instance O.OverloadedMethodInfo DownloadSetAllowOverwriteMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.WebKit2.Objects.Download.downloadSetAllowOverwrite",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-webkit2-4.0.28/docs/GI-WebKit2-Objects-Download.html#v:downloadSetAllowOverwrite"
        })


#endif

-- method Download::set_destination
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "download"
--           , argType =
--               TInterface Name { namespace = "WebKit2" , name = "Download" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #WebKitDownload" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "uri"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the destination URI"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "webkit_download_set_destination" webkit_download_set_destination :: 
    Ptr Download ->                         -- download : TInterface (Name {namespace = "WebKit2", name = "Download"})
    CString ->                              -- uri : TBasicType TUTF8
    IO ()

-- | Sets the URI to which the downloaded file will be written.
-- This method should be called before the download transfer
-- starts or it will not have any effect on the ongoing download
-- operation. To set the destination using the filename suggested
-- by the server connect to [decideDestination]("GI.WebKit2.Objects.Download#g:signal:decideDestination")
-- signal and call 'GI.WebKit2.Objects.Download.downloadSetDestination'. If you want to
-- set a fixed destination URI that doesn\'t depend on the suggested
-- filename you can connect to notify[response](#g:signal:response) signal and call
-- 'GI.WebKit2.Objects.Download.downloadSetDestination'.
-- If [decideDestination]("GI.WebKit2.Objects.Download#g:signal:decideDestination") signal is not handled
-- and destination URI is not set when the download transfer starts,
-- the file will be saved with the filename suggested by the server in
-- 'GI.GLib.Enums.UserDirectoryDirectoryDownload' directory.
downloadSetDestination ::
    (B.CallStack.HasCallStack, MonadIO m, IsDownload a) =>
    a
    -- ^ /@download@/: a t'GI.WebKit2.Objects.Download.Download'
    -> T.Text
    -- ^ /@uri@/: the destination URI
    -> m ()
downloadSetDestination :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsDownload a) =>
a -> Text -> m ()
downloadSetDestination a
download Text
uri = 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 Download
download' <- a -> IO (Ptr Download)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
download
    CString
uri' <- Text -> IO CString
textToCString Text
uri
    Ptr Download -> CString -> IO ()
webkit_download_set_destination Ptr Download
download' CString
uri'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
download
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
uri'
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data DownloadSetDestinationMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m, IsDownload a) => O.OverloadedMethod DownloadSetDestinationMethodInfo a signature where
    overloadedMethod = downloadSetDestination

instance O.OverloadedMethodInfo DownloadSetDestinationMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.WebKit2.Objects.Download.downloadSetDestination",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-webkit2-4.0.28/docs/GI-WebKit2-Objects-Download.html#v:downloadSetDestination"
        })


#endif