{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc) /No description available in the introspection data./ -} #define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \ && !defined(__HADDOCK_VERSION__)) module GI.WebKit2.Objects.Download ( -- * Exported types Download(..) , IsDownload , toDownload , noDownload , -- * Methods -- ** cancel #method:cancel# #if ENABLE_OVERLOADING DownloadCancelMethodInfo , #endif downloadCancel , -- ** getAllowOverwrite #method:getAllowOverwrite# #if ENABLE_OVERLOADING DownloadGetAllowOverwriteMethodInfo , #endif downloadGetAllowOverwrite , -- ** getDestination #method:getDestination# #if ENABLE_OVERLOADING DownloadGetDestinationMethodInfo , #endif downloadGetDestination , -- ** getElapsedTime #method:getElapsedTime# #if ENABLE_OVERLOADING DownloadGetElapsedTimeMethodInfo , #endif downloadGetElapsedTime , -- ** getEstimatedProgress #method:getEstimatedProgress# #if ENABLE_OVERLOADING DownloadGetEstimatedProgressMethodInfo , #endif downloadGetEstimatedProgress , -- ** getReceivedDataLength #method:getReceivedDataLength# #if ENABLE_OVERLOADING DownloadGetReceivedDataLengthMethodInfo , #endif downloadGetReceivedDataLength , -- ** getRequest #method:getRequest# #if ENABLE_OVERLOADING DownloadGetRequestMethodInfo , #endif downloadGetRequest , -- ** getResponse #method:getResponse# #if ENABLE_OVERLOADING DownloadGetResponseMethodInfo , #endif downloadGetResponse , -- ** getWebView #method:getWebView# #if ENABLE_OVERLOADING DownloadGetWebViewMethodInfo , #endif downloadGetWebView , -- ** setAllowOverwrite #method:setAllowOverwrite# #if ENABLE_OVERLOADING DownloadSetAllowOverwriteMethodInfo , #endif downloadSetAllowOverwrite , -- ** setDestination #method:setDestination# #if 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 'False' and the destination already exists, the download will fail. /Since: 2.6/ -} #if ENABLE_OVERLOADING DownloadAllowOverwritePropertyInfo , #endif constructDownloadAllowOverwrite , #if ENABLE_OVERLOADING downloadAllowOverwrite , #endif getDownloadAllowOverwrite , setDownloadAllowOverwrite , -- ** destination #attr:destination# {- | The local URI to where the download will be saved. -} #if ENABLE_OVERLOADING DownloadDestinationPropertyInfo , #endif #if 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 'GI.WebKit2.Objects.Download.Download'::@/received-data/@ signal to track the progress. -} #if ENABLE_OVERLOADING DownloadEstimatedProgressPropertyInfo , #endif #if ENABLE_OVERLOADING downloadEstimatedProgress , #endif getDownloadEstimatedProgress , -- ** response #attr:response# {- | The 'GI.WebKit2.Objects.URIResponse.URIResponse' associated with this download. -} #if ENABLE_OVERLOADING DownloadResponsePropertyInfo , #endif #if ENABLE_OVERLOADING downloadResponse , #endif getDownloadResponse , -- * Signals -- ** createdDestination #signal:createdDestination# C_DownloadCreatedDestinationCallback , DownloadCreatedDestinationCallback , #if ENABLE_OVERLOADING DownloadCreatedDestinationSignalInfo , #endif afterDownloadCreatedDestination , genClosure_DownloadCreatedDestination , mk_DownloadCreatedDestinationCallback , noDownloadCreatedDestinationCallback , onDownloadCreatedDestination , wrap_DownloadCreatedDestinationCallback , -- ** decideDestination #signal:decideDestination# C_DownloadDecideDestinationCallback , DownloadDecideDestinationCallback , #if ENABLE_OVERLOADING DownloadDecideDestinationSignalInfo , #endif afterDownloadDecideDestination , genClosure_DownloadDecideDestination , mk_DownloadDecideDestinationCallback , noDownloadDecideDestinationCallback , onDownloadDecideDestination , wrap_DownloadDecideDestinationCallback , -- ** failed #signal:failed# C_DownloadFailedCallback , DownloadFailedCallback , #if ENABLE_OVERLOADING DownloadFailedSignalInfo , #endif afterDownloadFailed , genClosure_DownloadFailed , mk_DownloadFailedCallback , noDownloadFailedCallback , onDownloadFailed , wrap_DownloadFailedCallback , -- ** finished #signal:finished# C_DownloadFinishedCallback , DownloadFinishedCallback , #if ENABLE_OVERLOADING DownloadFinishedSignalInfo , #endif afterDownloadFinished , genClosure_DownloadFinished , mk_DownloadFinishedCallback , noDownloadFinishedCallback , onDownloadFinished , wrap_DownloadFinishedCallback , -- ** receivedData #signal:receivedData# C_DownloadReceivedDataCallback , DownloadReceivedDataCallback , #if ENABLE_OVERLOADING 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.GClosure as B.GClosure import qualified Data.GI.Base.GError as B.GError import qualified Data.GI.Base.GVariant as B.GVariant import qualified Data.GI.Base.GValue as B.GValue import qualified Data.GI.Base.GParamSpec as B.GParamSpec import qualified Data.GI.Base.CallStack as B.CallStack import qualified Data.GI.Base.Properties as B.Properties import qualified Data.Text as T import qualified Data.ByteString.Char8 as B import qualified Data.Map as Map import qualified Foreign.Ptr as FP import qualified GHC.OverloadedLabels as OL import qualified GI.GObject.Objects.Object as GObject.Object import {-# 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 (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 -- | Type class for types which can be safely cast to `Download`, for instance with `toDownload`. class (GObject o, O.IsDescendantOf Download o) => IsDownload o instance (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 :: (MonadIO m, IsDownload o) => o -> m Download toDownload = liftIO . unsafeCastTo Download -- | A convenience alias for `Nothing` :: `Maybe` `Download`. noDownload :: Maybe Download noDownload = Nothing #if 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 "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) => OL.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 -- signal Download::created-destination {- | This signal is emitted after 'GI.WebKit2.Objects.Download.Download'::@/decide-destination/@ and before 'GI.WebKit2.Objects.Download.Download'::@/received-data/@ to notify that destination file has been created successfully at /@destination@/. -} type DownloadCreatedDestinationCallback = T.Text {- ^ /@destination@/: the destination URI -} -> IO () -- | A convenience synonym for @`Nothing` :: `Maybe` `DownloadCreatedDestinationCallback`@. noDownloadCreatedDestinationCallback :: Maybe DownloadCreatedDestinationCallback noDownloadCreatedDestinationCallback = Nothing -- | Type for the callback on the (unwrapped) C side. type C_DownloadCreatedDestinationCallback = Ptr () -> -- 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 the callback into a `GClosure`. genClosure_DownloadCreatedDestination :: MonadIO m => DownloadCreatedDestinationCallback -> m (GClosure C_DownloadCreatedDestinationCallback) genClosure_DownloadCreatedDestination cb = liftIO $ do let cb' = wrap_DownloadCreatedDestinationCallback cb mk_DownloadCreatedDestinationCallback cb' >>= B.GClosure.newGClosure -- | Wrap a `DownloadCreatedDestinationCallback` into a `C_DownloadCreatedDestinationCallback`. wrap_DownloadCreatedDestinationCallback :: DownloadCreatedDestinationCallback -> C_DownloadCreatedDestinationCallback wrap_DownloadCreatedDestinationCallback _cb _ destination _ = do destination' <- cstringToText destination _cb destination' {- | Connect a signal handler for the “@created-destination@” signal, to be run before the default handler. When is enabled, this is equivalent to @ 'Data.GI.Base.Signals.on' download #createdDestination callback @ -} 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 {- | Connect a signal handler for the “@created-destination@” signal, to be run after the default handler. When is enabled, this is equivalent to @ 'Data.GI.Base.Signals.after' download #createdDestination callback @ -} 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 {- | 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:__ 'True' to stop other handlers from being invoked for the event. 'False' to propagate the event further. -} -- | A convenience synonym for @`Nothing` :: `Maybe` `DownloadDecideDestinationCallback`@. noDownloadDecideDestinationCallback :: Maybe DownloadDecideDestinationCallback noDownloadDecideDestinationCallback = Nothing -- | Type for the callback on the (unwrapped) C side. type C_DownloadDecideDestinationCallback = Ptr () -> -- 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 the callback into a `GClosure`. genClosure_DownloadDecideDestination :: MonadIO m => DownloadDecideDestinationCallback -> m (GClosure C_DownloadDecideDestinationCallback) genClosure_DownloadDecideDestination cb = liftIO $ do let cb' = wrap_DownloadDecideDestinationCallback cb mk_DownloadDecideDestinationCallback cb' >>= B.GClosure.newGClosure -- | Wrap a `DownloadDecideDestinationCallback` into a `C_DownloadDecideDestinationCallback`. wrap_DownloadDecideDestinationCallback :: DownloadDecideDestinationCallback -> C_DownloadDecideDestinationCallback wrap_DownloadDecideDestinationCallback _cb _ suggestedFilename _ = do suggestedFilename' <- cstringToText suggestedFilename result <- _cb suggestedFilename' let result' = (fromIntegral . fromEnum) result return result' {- | Connect a signal handler for the “@decide-destination@” signal, to be run before the default handler. When is enabled, this is equivalent to @ 'Data.GI.Base.Signals.on' download #decideDestination callback @ -} 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 {- | Connect a signal handler for the “@decide-destination@” signal, to be run after the default handler. When is enabled, this is equivalent to @ 'Data.GI.Base.Signals.after' download #decideDestination callback @ -} 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 {- | 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 'GI.WebKit2.Objects.Download.Download'::@/finished/@ signal is emitted after this one. -} type DownloadFailedCallback = GError {- ^ /@error@/: the 'GError' that was triggered -} -> IO () -- | A convenience synonym for @`Nothing` :: `Maybe` `DownloadFailedCallback`@. noDownloadFailedCallback :: Maybe DownloadFailedCallback noDownloadFailedCallback = Nothing -- | Type for the callback on the (unwrapped) C side. type C_DownloadFailedCallback = Ptr () -> -- 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 the callback into a `GClosure`. genClosure_DownloadFailed :: MonadIO m => DownloadFailedCallback -> m (GClosure C_DownloadFailedCallback) genClosure_DownloadFailed cb = liftIO $ do let cb' = wrap_DownloadFailedCallback cb mk_DownloadFailedCallback cb' >>= B.GClosure.newGClosure -- | Wrap a `DownloadFailedCallback` into a `C_DownloadFailedCallback`. wrap_DownloadFailedCallback :: DownloadFailedCallback -> C_DownloadFailedCallback wrap_DownloadFailedCallback _cb _ error_ _ = do error_' <- (newBoxed GError) error_ _cb error_' {- | Connect a signal handler for the “@failed@” signal, to be run before the default handler. When is enabled, this is equivalent to @ 'Data.GI.Base.Signals.on' download #failed callback @ -} 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 {- | Connect a signal handler for the “@failed@” signal, to be run after the default handler. When is enabled, this is equivalent to @ 'Data.GI.Base.Signals.after' download #failed callback @ -} 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 {- | This signal is emitted when download finishes successfully or due to an error. In case of errors 'GI.WebKit2.Objects.Download.Download'::@/failed/@ signal is emitted before this one. -} type DownloadFinishedCallback = IO () -- | A convenience synonym for @`Nothing` :: `Maybe` `DownloadFinishedCallback`@. noDownloadFinishedCallback :: Maybe DownloadFinishedCallback noDownloadFinishedCallback = Nothing -- | Type for the callback on the (unwrapped) C side. type C_DownloadFinishedCallback = Ptr () -> -- 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 the callback into a `GClosure`. genClosure_DownloadFinished :: MonadIO m => DownloadFinishedCallback -> m (GClosure C_DownloadFinishedCallback) genClosure_DownloadFinished cb = liftIO $ do let cb' = wrap_DownloadFinishedCallback cb mk_DownloadFinishedCallback cb' >>= B.GClosure.newGClosure -- | Wrap a `DownloadFinishedCallback` into a `C_DownloadFinishedCallback`. wrap_DownloadFinishedCallback :: DownloadFinishedCallback -> C_DownloadFinishedCallback wrap_DownloadFinishedCallback _cb _ _ = do _cb {- | Connect a signal handler for the “@finished@” signal, to be run before the default handler. When is enabled, this is equivalent to @ 'Data.GI.Base.Signals.on' download #finished callback @ -} 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 {- | Connect a signal handler for the “@finished@” signal, to be run after the default handler. When is enabled, this is equivalent to @ 'Data.GI.Base.Signals.after' download #finished callback @ -} 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 {- | 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 () -- | A convenience synonym for @`Nothing` :: `Maybe` `DownloadReceivedDataCallback`@. noDownloadReceivedDataCallback :: Maybe DownloadReceivedDataCallback noDownloadReceivedDataCallback = Nothing -- | Type for the callback on the (unwrapped) C side. type C_DownloadReceivedDataCallback = Ptr () -> -- 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 the callback into a `GClosure`. genClosure_DownloadReceivedData :: MonadIO m => DownloadReceivedDataCallback -> m (GClosure C_DownloadReceivedDataCallback) genClosure_DownloadReceivedData cb = liftIO $ do let cb' = wrap_DownloadReceivedDataCallback cb mk_DownloadReceivedDataCallback cb' >>= B.GClosure.newGClosure -- | Wrap a `DownloadReceivedDataCallback` into a `C_DownloadReceivedDataCallback`. wrap_DownloadReceivedDataCallback :: DownloadReceivedDataCallback -> C_DownloadReceivedDataCallback wrap_DownloadReceivedDataCallback _cb _ dataLength _ = do _cb dataLength {- | Connect a signal handler for the “@received-data@” signal, to be run before the default handler. When is enabled, this is equivalent to @ 'Data.GI.Base.Signals.on' download #receivedData callback @ -} 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 {- | Connect a signal handler for the “@received-data@” signal, to be run after the default handler. When is enabled, this is equivalent to @ 'Data.GI.Base.Signals.after' download #receivedData callback @ -} 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) {- | Get the value of the “@allow-overwrite@” property. When is enabled, this is equivalent to @ 'Data.GI.Base.Attributes.get' download #allowOverwrite @ -} getDownloadAllowOverwrite :: (MonadIO m, IsDownload o) => o -> m Bool getDownloadAllowOverwrite obj = liftIO $ B.Properties.getObjectPropertyBool obj "allow-overwrite" {- | Set the value of the “@allow-overwrite@” property. When 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 obj val = liftIO $ B.Properties.setObjectPropertyBool obj "allow-overwrite" 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) => Bool -> IO (GValueConstruct o) constructDownloadAllowOverwrite val = B.Properties.constructObjectPropertyBool "allow-overwrite" val #if ENABLE_OVERLOADING 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 True,Just False) {- | Get the value of the “@destination@” property. When is enabled, this is equivalent to @ 'Data.GI.Base.Attributes.get' download #destination @ -} getDownloadDestination :: (MonadIO m, IsDownload o) => o -> m (Maybe T.Text) getDownloadDestination obj = liftIO $ B.Properties.getObjectPropertyString obj "destination" #if ENABLE_OVERLOADING data DownloadDestinationPropertyInfo instance AttrInfo DownloadDestinationPropertyInfo where type AttrAllowedOps DownloadDestinationPropertyInfo = '[ 'AttrGet] type AttrSetTypeConstraint DownloadDestinationPropertyInfo = (~) () type AttrBaseTypeConstraint DownloadDestinationPropertyInfo = IsDownload type AttrGetType DownloadDestinationPropertyInfo = (Maybe 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) {- | Get the value of the “@estimated-progress@” property. When is enabled, this is equivalent to @ 'Data.GI.Base.Attributes.get' download #estimatedProgress @ -} getDownloadEstimatedProgress :: (MonadIO m, IsDownload o) => o -> m Double getDownloadEstimatedProgress obj = liftIO $ B.Properties.getObjectPropertyDouble obj "estimated-progress" #if ENABLE_OVERLOADING 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 True,Nothing) {- | Get the value of the “@response@” property. When 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 obj = liftIO $ B.Properties.getObjectPropertyObject obj "response" WebKit2.URIResponse.URIResponse #if ENABLE_OVERLOADING data DownloadResponsePropertyInfo instance AttrInfo DownloadResponsePropertyInfo where type AttrAllowedOps DownloadResponsePropertyInfo = '[ 'AttrGet, 'AttrClear] type AttrSetTypeConstraint DownloadResponsePropertyInfo = (~) () type AttrBaseTypeConstraint DownloadResponsePropertyInfo = IsDownload type AttrGetType DownloadResponsePropertyInfo = (Maybe WebKit2.URIResponse.URIResponse) type AttrLabel DownloadResponsePropertyInfo = "response" type AttrOrigin DownloadResponsePropertyInfo = Download attrGet _ = getDownloadResponse attrSet _ = undefined attrConstruct _ = undefined attrClear _ = undefined #endif #if 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 ENABLE_OVERLOADING downloadAllowOverwrite :: AttrLabelProxy "allowOverwrite" downloadAllowOverwrite = AttrLabelProxy downloadDestination :: AttrLabelProxy "destination" downloadDestination = AttrLabelProxy downloadEstimatedProgress :: AttrLabelProxy "estimatedProgress" downloadEstimatedProgress = AttrLabelProxy downloadResponse :: AttrLabelProxy "response" downloadResponse = AttrLabelProxy #endif #if ENABLE_OVERLOADING 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 ENABLE_OVERLOADING 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 ENABLE_OVERLOADING 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 (Maybe T.Text) {- ^ __Returns:__ the destination URI or 'Nothing' -} downloadGetDestination download = liftIO $ do download' <- unsafeManagedPtrCastPtr download result <- webkit_download_get_destination download' maybeResult <- convertIfNonNull result $ \result' -> do result'' <- cstringToText result' return result'' touchManagedPtr download return maybeResult #if ENABLE_OVERLOADING data DownloadGetDestinationMethodInfo instance (signature ~ (m (Maybe 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 ENABLE_OVERLOADING 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 ENABLE_OVERLOADING 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 ENABLE_OVERLOADING 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 ENABLE_OVERLOADING 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 (Maybe 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' maybeResult <- convertIfNonNull result $ \result' -> do result'' <- (newObject WebKit2.URIResponse.URIResponse) result' return result'' touchManagedPtr download return maybeResult #if ENABLE_OVERLOADING data DownloadGetResponseMethodInfo instance (signature ~ (m (Maybe 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 (Maybe 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' maybeResult <- convertIfNonNull result $ \result' -> do result'' <- (newObject WebKit2.WebView.WebView) result' return result'' touchManagedPtr download return maybeResult #if ENABLE_OVERLOADING data DownloadGetWebViewMethodInfo instance (signature ~ (m (Maybe 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 ENABLE_OVERLOADING 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 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 '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 ENABLE_OVERLOADING data DownloadSetDestinationMethodInfo instance (signature ~ (T.Text -> m ()), MonadIO m, IsDownload a) => O.MethodInfo DownloadSetDestinationMethodInfo a signature where overloadedMethod _ = downloadSetDestination #endif