{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
-}

module GI.WebKit2.Objects.Download
    ( 

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


 -- * Methods
-- ** cancel #method:cancel#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    DownloadCancelMethodInfo                ,
#endif
    downloadCancel                          ,


-- ** getAllowOverwrite #method:getAllowOverwrite#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    DownloadGetAllowOverwriteMethodInfo     ,
#endif
    downloadGetAllowOverwrite               ,


-- ** getDestination #method:getDestination#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    DownloadGetDestinationMethodInfo        ,
#endif
    downloadGetDestination                  ,


-- ** getElapsedTime #method:getElapsedTime#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    DownloadGetElapsedTimeMethodInfo        ,
#endif
    downloadGetElapsedTime                  ,


-- ** getEstimatedProgress #method:getEstimatedProgress#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    DownloadGetEstimatedProgressMethodInfo  ,
#endif
    downloadGetEstimatedProgress            ,


-- ** getReceivedDataLength #method:getReceivedDataLength#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    DownloadGetReceivedDataLengthMethodInfo ,
#endif
    downloadGetReceivedDataLength           ,


-- ** getRequest #method:getRequest#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    DownloadGetRequestMethodInfo            ,
#endif
    downloadGetRequest                      ,


-- ** getResponse #method:getResponse#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    DownloadGetResponseMethodInfo           ,
#endif
    downloadGetResponse                     ,


-- ** getWebView #method:getWebView#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    DownloadGetWebViewMethodInfo            ,
#endif
    downloadGetWebView                      ,


-- ** setAllowOverwrite #method:setAllowOverwrite#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    DownloadSetAllowOverwriteMethodInfo     ,
#endif
    downloadSetAllowOverwrite               ,


-- ** setDestination #method:setDestination#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    DownloadSetDestinationMethodInfo        ,
#endif
    downloadSetDestination                  ,




 -- * Properties
-- ** allowOverwrite #attr:allowOverwrite#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    DownloadAllowOverwritePropertyInfo      ,
#endif
    constructDownloadAllowOverwrite         ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    downloadAllowOverwrite                  ,
#endif
    getDownloadAllowOverwrite               ,
    setDownloadAllowOverwrite               ,


-- ** destination #attr:destination#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    DownloadDestinationPropertyInfo         ,
#endif
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    downloadDestination                     ,
#endif
    getDownloadDestination                  ,


-- ** estimatedProgress #attr:estimatedProgress#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    DownloadEstimatedProgressPropertyInfo   ,
#endif
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    downloadEstimatedProgress               ,
#endif
    getDownloadEstimatedProgress            ,


-- ** response #attr:response#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    DownloadResponsePropertyInfo            ,
#endif
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    downloadResponse                        ,
#endif
    getDownloadResponse                     ,




 -- * Signals
-- ** createdDestination #signal:createdDestination#
    C_DownloadCreatedDestinationCallback    ,
    DownloadCreatedDestinationCallback      ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    DownloadCreatedDestinationSignalInfo    ,
#endif
    afterDownloadCreatedDestination         ,
    genClosure_DownloadCreatedDestination   ,
    mk_DownloadCreatedDestinationCallback   ,
    noDownloadCreatedDestinationCallback    ,
    onDownloadCreatedDestination            ,
    wrap_DownloadCreatedDestinationCallback ,


-- ** decideDestination #signal:decideDestination#
    C_DownloadDecideDestinationCallback     ,
    DownloadDecideDestinationCallback       ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    DownloadDecideDestinationSignalInfo     ,
#endif
    afterDownloadDecideDestination          ,
    genClosure_DownloadDecideDestination    ,
    mk_DownloadDecideDestinationCallback    ,
    noDownloadDecideDestinationCallback     ,
    onDownloadDecideDestination             ,
    wrap_DownloadDecideDestinationCallback  ,


-- ** failed #signal:failed#
    C_DownloadFailedCallback                ,
    DownloadFailedCallback                  ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    DownloadFailedSignalInfo                ,
#endif
    afterDownloadFailed                     ,
    genClosure_DownloadFailed               ,
    mk_DownloadFailedCallback               ,
    noDownloadFailedCallback                ,
    onDownloadFailed                        ,
    wrap_DownloadFailedCallback             ,


-- ** finished #signal:finished#
    C_DownloadFinishedCallback              ,
    DownloadFinishedCallback                ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    DownloadFinishedSignalInfo              ,
#endif
    afterDownloadFinished                   ,
    genClosure_DownloadFinished             ,
    mk_DownloadFinishedCallback             ,
    noDownloadFinishedCallback              ,
    onDownloadFinished                      ,
    wrap_DownloadFinishedCallback           ,


-- ** receivedData #signal:receivedData#
    C_DownloadReceivedDataCallback          ,
    DownloadReceivedDataCallback            ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    DownloadReceivedDataSignalInfo          ,
#endif
    afterDownloadReceivedData               ,
    genClosure_DownloadReceivedData         ,
    mk_DownloadReceivedDataCallback         ,
    noDownloadReceivedDataCallback          ,
    onDownloadReceivedData                  ,
    wrap_DownloadReceivedDataCallback       ,




    ) where

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

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP

import qualified GI.GObject.Objects.Object as GObject.Object
import {-# 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

newtype Download = Download (ManagedPtr Download)
foreign import ccall "webkit_download_get_type"
    c_webkit_download_get_type :: IO GType

instance GObject Download where
    gobjectType _ = c_webkit_download_get_type
    

class GObject o => IsDownload o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError Download a) =>
    IsDownload a
#endif
instance IsDownload Download
instance GObject.Object.IsObject Download

toDownload :: (MonadIO m, IsDownload o) => o -> m Download
toDownload = liftIO . unsafeCastTo Download

noDownload :: Maybe Download
noDownload = Nothing

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
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 "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 "replaceData" o = GObject.Object.ObjectReplaceDataMethodInfo
    ResolveDownloadMethod "replaceQdata" o = GObject.Object.ObjectReplaceQdataMethodInfo
    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 "setDestination" o = DownloadSetDestinationMethodInfo
    ResolveDownloadMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveDownloadMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveDownloadMethod t Download, O.MethodInfo info Download p) => O.IsLabelProxy t (Download -> p) where
    fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveDownloadMethod t Download, O.MethodInfo info Download p) => O.IsLabel t (Download -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif

#endif

-- signal Download::created-destination
type DownloadCreatedDestinationCallback =
    T.Text ->
    IO ()

noDownloadCreatedDestinationCallback :: Maybe DownloadCreatedDestinationCallback
noDownloadCreatedDestinationCallback = Nothing

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

foreign import ccall "wrapper"
    mk_DownloadCreatedDestinationCallback :: C_DownloadCreatedDestinationCallback -> IO (FunPtr C_DownloadCreatedDestinationCallback)

genClosure_DownloadCreatedDestination :: DownloadCreatedDestinationCallback -> IO Closure
genClosure_DownloadCreatedDestination cb = do
    let cb' = wrap_DownloadCreatedDestinationCallback cb
    mk_DownloadCreatedDestinationCallback cb' >>= newCClosure


wrap_DownloadCreatedDestinationCallback ::
    DownloadCreatedDestinationCallback ->
    Ptr () ->
    CString ->
    Ptr () ->
    IO ()
wrap_DownloadCreatedDestinationCallback _cb _ destination _ = do
    destination' <- cstringToText destination
    _cb  destination'


onDownloadCreatedDestination :: (IsDownload a, MonadIO m) => a -> DownloadCreatedDestinationCallback -> m SignalHandlerId
onDownloadCreatedDestination obj cb = liftIO $ do
    let cb' = wrap_DownloadCreatedDestinationCallback cb
    cb'' <- mk_DownloadCreatedDestinationCallback cb'
    connectSignalFunPtr obj "created-destination" cb'' SignalConnectBefore

afterDownloadCreatedDestination :: (IsDownload a, MonadIO m) => a -> DownloadCreatedDestinationCallback -> m SignalHandlerId
afterDownloadCreatedDestination obj cb = liftIO $ do
    let cb' = wrap_DownloadCreatedDestinationCallback cb
    cb'' <- mk_DownloadCreatedDestinationCallback cb'
    connectSignalFunPtr obj "created-destination" cb'' SignalConnectAfter


-- signal Download::decide-destination
type DownloadDecideDestinationCallback =
    T.Text ->
    IO Bool

noDownloadDecideDestinationCallback :: Maybe DownloadDecideDestinationCallback
noDownloadDecideDestinationCallback = Nothing

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

foreign import ccall "wrapper"
    mk_DownloadDecideDestinationCallback :: C_DownloadDecideDestinationCallback -> IO (FunPtr C_DownloadDecideDestinationCallback)

genClosure_DownloadDecideDestination :: DownloadDecideDestinationCallback -> IO Closure
genClosure_DownloadDecideDestination cb = do
    let cb' = wrap_DownloadDecideDestinationCallback cb
    mk_DownloadDecideDestinationCallback cb' >>= newCClosure


wrap_DownloadDecideDestinationCallback ::
    DownloadDecideDestinationCallback ->
    Ptr () ->
    CString ->
    Ptr () ->
    IO CInt
wrap_DownloadDecideDestinationCallback _cb _ suggestedFilename _ = do
    suggestedFilename' <- cstringToText suggestedFilename
    result <- _cb  suggestedFilename'
    let result' = (fromIntegral . fromEnum) result
    return result'


onDownloadDecideDestination :: (IsDownload a, MonadIO m) => a -> DownloadDecideDestinationCallback -> m SignalHandlerId
onDownloadDecideDestination obj cb = liftIO $ do
    let cb' = wrap_DownloadDecideDestinationCallback cb
    cb'' <- mk_DownloadDecideDestinationCallback cb'
    connectSignalFunPtr obj "decide-destination" cb'' SignalConnectBefore

afterDownloadDecideDestination :: (IsDownload a, MonadIO m) => a -> DownloadDecideDestinationCallback -> m SignalHandlerId
afterDownloadDecideDestination obj cb = liftIO $ do
    let cb' = wrap_DownloadDecideDestinationCallback cb
    cb'' <- mk_DownloadDecideDestinationCallback cb'
    connectSignalFunPtr obj "decide-destination" cb'' SignalConnectAfter


-- signal Download::failed
type DownloadFailedCallback =
    GError ->
    IO ()

noDownloadFailedCallback :: Maybe DownloadFailedCallback
noDownloadFailedCallback = Nothing

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

foreign import ccall "wrapper"
    mk_DownloadFailedCallback :: C_DownloadFailedCallback -> IO (FunPtr C_DownloadFailedCallback)

genClosure_DownloadFailed :: DownloadFailedCallback -> IO Closure
genClosure_DownloadFailed cb = do
    let cb' = wrap_DownloadFailedCallback cb
    mk_DownloadFailedCallback cb' >>= newCClosure


wrap_DownloadFailedCallback ::
    DownloadFailedCallback ->
    Ptr () ->
    Ptr GError ->
    Ptr () ->
    IO ()
wrap_DownloadFailedCallback _cb _ error_ _ = do
    error_' <- (newBoxed GError) error_
    _cb  error_'


onDownloadFailed :: (IsDownload a, MonadIO m) => a -> DownloadFailedCallback -> m SignalHandlerId
onDownloadFailed obj cb = liftIO $ do
    let cb' = wrap_DownloadFailedCallback cb
    cb'' <- mk_DownloadFailedCallback cb'
    connectSignalFunPtr obj "failed" cb'' SignalConnectBefore

afterDownloadFailed :: (IsDownload a, MonadIO m) => a -> DownloadFailedCallback -> m SignalHandlerId
afterDownloadFailed obj cb = liftIO $ do
    let cb' = wrap_DownloadFailedCallback cb
    cb'' <- mk_DownloadFailedCallback cb'
    connectSignalFunPtr obj "failed" cb'' SignalConnectAfter


-- signal Download::finished
type DownloadFinishedCallback =
    IO ()

noDownloadFinishedCallback :: Maybe DownloadFinishedCallback
noDownloadFinishedCallback = Nothing

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

foreign import ccall "wrapper"
    mk_DownloadFinishedCallback :: C_DownloadFinishedCallback -> IO (FunPtr C_DownloadFinishedCallback)

genClosure_DownloadFinished :: DownloadFinishedCallback -> IO Closure
genClosure_DownloadFinished cb = do
    let cb' = wrap_DownloadFinishedCallback cb
    mk_DownloadFinishedCallback cb' >>= newCClosure


wrap_DownloadFinishedCallback ::
    DownloadFinishedCallback ->
    Ptr () ->
    Ptr () ->
    IO ()
wrap_DownloadFinishedCallback _cb _ _ = do
    _cb 


onDownloadFinished :: (IsDownload a, MonadIO m) => a -> DownloadFinishedCallback -> m SignalHandlerId
onDownloadFinished obj cb = liftIO $ do
    let cb' = wrap_DownloadFinishedCallback cb
    cb'' <- mk_DownloadFinishedCallback cb'
    connectSignalFunPtr obj "finished" cb'' SignalConnectBefore

afterDownloadFinished :: (IsDownload a, MonadIO m) => a -> DownloadFinishedCallback -> m SignalHandlerId
afterDownloadFinished obj cb = liftIO $ do
    let cb' = wrap_DownloadFinishedCallback cb
    cb'' <- mk_DownloadFinishedCallback cb'
    connectSignalFunPtr obj "finished" cb'' SignalConnectAfter


-- signal Download::received-data
type DownloadReceivedDataCallback =
    Word64 ->
    IO ()

noDownloadReceivedDataCallback :: Maybe DownloadReceivedDataCallback
noDownloadReceivedDataCallback = Nothing

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

foreign import ccall "wrapper"
    mk_DownloadReceivedDataCallback :: C_DownloadReceivedDataCallback -> IO (FunPtr C_DownloadReceivedDataCallback)

genClosure_DownloadReceivedData :: DownloadReceivedDataCallback -> IO Closure
genClosure_DownloadReceivedData cb = do
    let cb' = wrap_DownloadReceivedDataCallback cb
    mk_DownloadReceivedDataCallback cb' >>= newCClosure


wrap_DownloadReceivedDataCallback ::
    DownloadReceivedDataCallback ->
    Ptr () ->
    Word64 ->
    Ptr () ->
    IO ()
wrap_DownloadReceivedDataCallback _cb _ dataLength _ = do
    _cb  dataLength


onDownloadReceivedData :: (IsDownload a, MonadIO m) => a -> DownloadReceivedDataCallback -> m SignalHandlerId
onDownloadReceivedData obj cb = liftIO $ do
    let cb' = wrap_DownloadReceivedDataCallback cb
    cb'' <- mk_DownloadReceivedDataCallback cb'
    connectSignalFunPtr obj "received-data" cb'' SignalConnectBefore

afterDownloadReceivedData :: (IsDownload a, MonadIO m) => a -> DownloadReceivedDataCallback -> m SignalHandlerId
afterDownloadReceivedData obj cb = liftIO $ do
    let cb' = wrap_DownloadReceivedDataCallback cb
    cb'' <- mk_DownloadReceivedDataCallback cb'
    connectSignalFunPtr obj "received-data" cb'' SignalConnectAfter


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

getDownloadAllowOverwrite :: (MonadIO m, IsDownload o) => o -> m Bool
getDownloadAllowOverwrite obj = liftIO $ getObjectPropertyBool obj "allow-overwrite"

setDownloadAllowOverwrite :: (MonadIO m, IsDownload o) => o -> Bool -> m ()
setDownloadAllowOverwrite obj val = liftIO $ setObjectPropertyBool obj "allow-overwrite" val

constructDownloadAllowOverwrite :: (IsDownload o) => Bool -> IO (GValueConstruct o)
constructDownloadAllowOverwrite val = constructObjectPropertyBool "allow-overwrite" val

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data DownloadAllowOverwritePropertyInfo
instance AttrInfo DownloadAllowOverwritePropertyInfo where
    type AttrAllowedOps DownloadAllowOverwritePropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint DownloadAllowOverwritePropertyInfo = (~) Bool
    type AttrBaseTypeConstraint DownloadAllowOverwritePropertyInfo = IsDownload
    type AttrGetType DownloadAllowOverwritePropertyInfo = Bool
    type AttrLabel DownloadAllowOverwritePropertyInfo = "allow-overwrite"
    type AttrOrigin DownloadAllowOverwritePropertyInfo = Download
    attrGet _ = getDownloadAllowOverwrite
    attrSet _ = setDownloadAllowOverwrite
    attrConstruct _ = constructDownloadAllowOverwrite
    attrClear _ = undefined
#endif

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

getDownloadDestination :: (MonadIO m, IsDownload o) => o -> m T.Text
getDownloadDestination obj = liftIO $ checkUnexpectedNothing "getDownloadDestination" $ getObjectPropertyString obj "destination"

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data DownloadDestinationPropertyInfo
instance AttrInfo DownloadDestinationPropertyInfo where
    type AttrAllowedOps DownloadDestinationPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DownloadDestinationPropertyInfo = (~) ()
    type AttrBaseTypeConstraint DownloadDestinationPropertyInfo = IsDownload
    type AttrGetType DownloadDestinationPropertyInfo = T.Text
    type AttrLabel DownloadDestinationPropertyInfo = "destination"
    type AttrOrigin DownloadDestinationPropertyInfo = Download
    attrGet _ = getDownloadDestination
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined
#endif

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

getDownloadEstimatedProgress :: (MonadIO m, IsDownload o) => o -> m Double
getDownloadEstimatedProgress obj = liftIO $ getObjectPropertyDouble obj "estimated-progress"

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data DownloadEstimatedProgressPropertyInfo
instance AttrInfo DownloadEstimatedProgressPropertyInfo where
    type AttrAllowedOps DownloadEstimatedProgressPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DownloadEstimatedProgressPropertyInfo = (~) ()
    type AttrBaseTypeConstraint DownloadEstimatedProgressPropertyInfo = IsDownload
    type AttrGetType DownloadEstimatedProgressPropertyInfo = Double
    type AttrLabel DownloadEstimatedProgressPropertyInfo = "estimated-progress"
    type AttrOrigin DownloadEstimatedProgressPropertyInfo = Download
    attrGet _ = getDownloadEstimatedProgress
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined
#endif

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

getDownloadResponse :: (MonadIO m, IsDownload o) => o -> m WebKit2.URIResponse.URIResponse
getDownloadResponse obj = liftIO $ checkUnexpectedNothing "getDownloadResponse" $ getObjectPropertyObject obj "response" WebKit2.URIResponse.URIResponse

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data DownloadResponsePropertyInfo
instance AttrInfo DownloadResponsePropertyInfo where
    type AttrAllowedOps DownloadResponsePropertyInfo = '[ 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint DownloadResponsePropertyInfo = (~) ()
    type AttrBaseTypeConstraint DownloadResponsePropertyInfo = IsDownload
    type AttrGetType DownloadResponsePropertyInfo = WebKit2.URIResponse.URIResponse
    type AttrLabel DownloadResponsePropertyInfo = "response"
    type AttrOrigin DownloadResponsePropertyInfo = Download
    attrGet _ = getDownloadResponse
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined
#endif

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
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) && !defined(__HADDOCK_VERSION__)
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) && !defined(__HADDOCK_VERSION__)
data DownloadCreatedDestinationSignalInfo
instance SignalInfo DownloadCreatedDestinationSignalInfo where
    type HaskellCallbackType DownloadCreatedDestinationSignalInfo = DownloadCreatedDestinationCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_DownloadCreatedDestinationCallback cb
        cb'' <- mk_DownloadCreatedDestinationCallback cb'
        connectSignalFunPtr obj "created-destination" cb'' connectMode

data DownloadDecideDestinationSignalInfo
instance SignalInfo DownloadDecideDestinationSignalInfo where
    type HaskellCallbackType DownloadDecideDestinationSignalInfo = DownloadDecideDestinationCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_DownloadDecideDestinationCallback cb
        cb'' <- mk_DownloadDecideDestinationCallback cb'
        connectSignalFunPtr obj "decide-destination" cb'' connectMode

data DownloadFailedSignalInfo
instance SignalInfo DownloadFailedSignalInfo where
    type HaskellCallbackType DownloadFailedSignalInfo = DownloadFailedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_DownloadFailedCallback cb
        cb'' <- mk_DownloadFailedCallback cb'
        connectSignalFunPtr obj "failed" cb'' connectMode

data DownloadFinishedSignalInfo
instance SignalInfo DownloadFinishedSignalInfo where
    type HaskellCallbackType DownloadFinishedSignalInfo = DownloadFinishedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_DownloadFinishedCallback cb
        cb'' <- mk_DownloadFinishedCallback cb'
        connectSignalFunPtr obj "finished" cb'' connectMode

data DownloadReceivedDataSignalInfo
instance SignalInfo DownloadReceivedDataSignalInfo where
    type HaskellCallbackType DownloadReceivedDataSignalInfo = DownloadReceivedDataCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_DownloadReceivedDataCallback cb
        cb'' <- mk_DownloadReceivedDataCallback cb'
        connectSignalFunPtr obj "received-data" cb'' connectMode

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
'GI.WebKit2.Objects.Download.Download'::@/failed/@ is emitted with
'GI.WebKit2.Enums.DownloadErrorCancelledByUser' error.
-}
downloadCancel ::
    (B.CallStack.HasCallStack, MonadIO m, IsDownload a) =>
    a
    {- ^ /@download@/: a 'GI.WebKit2.Objects.Download.Download' -}
    -> m ()
downloadCancel download = liftIO $ do
    download' <- unsafeManagedPtrCastPtr download
    webkit_download_cancel download'
    touchManagedPtr download
    return ()

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data DownloadCancelMethodInfo
instance (signature ~ (m ()), MonadIO m, IsDownload a) => O.MethodInfo DownloadCancelMethodInfo a signature where
    overloadedMethod _ = 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 '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 'GI.WebKit2.Objects.Download.Download' -}
    -> m Bool
    {- ^ __Returns:__ the current value of the 'GI.WebKit2.Objects.Download.Download':@/allow-overwrite/@ property -}
downloadGetAllowOverwrite download = liftIO $ do
    download' <- unsafeManagedPtrCastPtr download
    result <- webkit_download_get_allow_overwrite download'
    let result' = (/= 0) result
    touchManagedPtr download
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data DownloadGetAllowOverwriteMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsDownload a) => O.MethodInfo DownloadGetAllowOverwriteMethodInfo a signature where
    overloadedMethod _ = 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 'GI.WebKit2.Objects.Download.Download'::@/created-destination/@ to make
sure this method returns a valid destination.
-}
downloadGetDestination ::
    (B.CallStack.HasCallStack, MonadIO m, IsDownload a) =>
    a
    {- ^ /@download@/: a 'GI.WebKit2.Objects.Download.Download' -}
    -> m T.Text
    {- ^ __Returns:__ the destination URI or 'Nothing' -}
downloadGetDestination download = liftIO $ do
    download' <- unsafeManagedPtrCastPtr download
    result <- webkit_download_get_destination download'
    checkUnexpectedReturnNULL "downloadGetDestination" result
    result' <- cstringToText result
    touchManagedPtr download
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data DownloadGetDestinationMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsDownload a) => O.MethodInfo DownloadGetDestinationMethodInfo a signature where
    overloadedMethod _ = 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 'GI.WebKit2.Objects.Download.Download' -}
    -> m Double
    {- ^ __Returns:__ seconds since the download was started -}
downloadGetElapsedTime download = liftIO $ do
    download' <- unsafeManagedPtrCastPtr download
    result <- webkit_download_get_elapsed_time download'
    let result' = realToFrac result
    touchManagedPtr download
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data DownloadGetElapsedTimeMethodInfo
instance (signature ~ (m Double), MonadIO m, IsDownload a) => O.MethodInfo DownloadGetElapsedTimeMethodInfo a signature where
    overloadedMethod _ = 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 'GI.WebKit2.Objects.Download.Download':@/estimated-progress/@ property.
You can monitor the estimated progress of the download operation by
connecting to the notify::estimated-progress signal of /@download@/.
-}
downloadGetEstimatedProgress ::
    (B.CallStack.HasCallStack, MonadIO m, IsDownload a) =>
    a
    {- ^ /@download@/: a '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 download = liftIO $ do
    download' <- unsafeManagedPtrCastPtr download
    result <- webkit_download_get_estimated_progress download'
    let result' = realToFrac result
    touchManagedPtr download
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data DownloadGetEstimatedProgressMethodInfo
instance (signature ~ (m Double), MonadIO m, IsDownload a) => O.MethodInfo DownloadGetEstimatedProgressMethodInfo a signature where
    overloadedMethod _ = 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 'GI.WebKit2.Objects.Download.Download' -}
    -> m Word64
    {- ^ __Returns:__ the amount of bytes already downloaded. -}
downloadGetReceivedDataLength download = liftIO $ do
    download' <- unsafeManagedPtrCastPtr download
    result <- webkit_download_get_received_data_length download'
    touchManagedPtr download
    return result

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data DownloadGetReceivedDataLengthMethodInfo
instance (signature ~ (m Word64), MonadIO m, IsDownload a) => O.MethodInfo DownloadGetReceivedDataLengthMethodInfo a signature where
    overloadedMethod _ = 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 'GI.WebKit2.Objects.URIRequest.URIRequest' object that backs the download
process.
-}
downloadGetRequest ::
    (B.CallStack.HasCallStack, MonadIO m, IsDownload a) =>
    a
    {- ^ /@download@/: a 'GI.WebKit2.Objects.Download.Download' -}
    -> m WebKit2.URIRequest.URIRequest
    {- ^ __Returns:__ the 'GI.WebKit2.Objects.URIRequest.URIRequest' of /@download@/ -}
downloadGetRequest download = liftIO $ do
    download' <- unsafeManagedPtrCastPtr download
    result <- webkit_download_get_request download'
    checkUnexpectedReturnNULL "downloadGetRequest" result
    result' <- (newObject WebKit2.URIRequest.URIRequest) result
    touchManagedPtr download
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data DownloadGetRequestMethodInfo
instance (signature ~ (m WebKit2.URIRequest.URIRequest), MonadIO m, IsDownload a) => O.MethodInfo DownloadGetRequestMethodInfo a signature where
    overloadedMethod _ = 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 'GI.WebKit2.Objects.URIResponse.URIResponse' object that backs the download
process. This method returns 'Nothing' if called before the response
is received from the server. You can connect to notify::response
signal to be notified when the response is received.
-}
downloadGetResponse ::
    (B.CallStack.HasCallStack, MonadIO m, IsDownload a) =>
    a
    {- ^ /@download@/: a 'GI.WebKit2.Objects.Download.Download' -}
    -> m WebKit2.URIResponse.URIResponse
    {- ^ __Returns:__ the 'GI.WebKit2.Objects.URIResponse.URIResponse', or 'Nothing' if
    the response hasn\'t been received yet. -}
downloadGetResponse download = liftIO $ do
    download' <- unsafeManagedPtrCastPtr download
    result <- webkit_download_get_response download'
    checkUnexpectedReturnNULL "downloadGetResponse" result
    result' <- (newObject WebKit2.URIResponse.URIResponse) result
    touchManagedPtr download
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data DownloadGetResponseMethodInfo
instance (signature ~ (m WebKit2.URIResponse.URIResponse), MonadIO m, IsDownload a) => O.MethodInfo DownloadGetResponseMethodInfo a signature where
    overloadedMethod _ = 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 'GI.WebKit2.Objects.WebView.WebView' that initiated the download.
-}
downloadGetWebView ::
    (B.CallStack.HasCallStack, MonadIO m, IsDownload a) =>
    a
    {- ^ /@download@/: a 'GI.WebKit2.Objects.Download.Download' -}
    -> m WebKit2.WebView.WebView
    {- ^ __Returns:__ the 'GI.WebKit2.Objects.WebView.WebView' that initiated /@download@/,
   or 'Nothing' if /@download@/ was not initiated by a 'GI.WebKit2.Objects.WebView.WebView'. -}
downloadGetWebView download = liftIO $ do
    download' <- unsafeManagedPtrCastPtr download
    result <- webkit_download_get_web_view download'
    checkUnexpectedReturnNULL "downloadGetWebView" result
    result' <- (newObject WebKit2.WebView.WebView) result
    touchManagedPtr download
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data DownloadGetWebViewMethodInfo
instance (signature ~ (m WebKit2.WebView.WebView), MonadIO m, IsDownload a) => O.MethodInfo DownloadGetWebViewMethodInfo a signature where
    overloadedMethod _ = 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 '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 'GI.WebKit2.Objects.Download.Download' -}
    -> Bool
    {- ^ /@allowed@/: the new value for the 'GI.WebKit2.Objects.Download.Download':@/allow-overwrite/@ property -}
    -> m ()
downloadSetAllowOverwrite download allowed = liftIO $ do
    download' <- unsafeManagedPtrCastPtr download
    let allowed' = (fromIntegral . fromEnum) allowed
    webkit_download_set_allow_overwrite download' allowed'
    touchManagedPtr download
    return ()

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data DownloadSetAllowOverwriteMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m, IsDownload a) => O.MethodInfo DownloadSetAllowOverwriteMethodInfo a signature where
    overloadedMethod _ = 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 'GI.WebKit2.Objects.Download.Download'::@/decide-destination/@
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 signal and call
'GI.WebKit2.Objects.Download.downloadSetDestination'.
If 'GI.WebKit2.Objects.Download.Download'::@/decide-destination/@ signal is not handled
and destination URI is not set when the download tranfer 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 'GI.WebKit2.Objects.Download.Download' -}
    -> T.Text
    {- ^ /@uri@/: the destination URI -}
    -> m ()
downloadSetDestination download uri = liftIO $ do
    download' <- unsafeManagedPtrCastPtr download
    uri' <- textToCString uri
    webkit_download_set_destination download' uri'
    touchManagedPtr download
    freeMem uri'
    return ()

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

#endif