Copyright | Will Thompson, Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
Safe Haskell | None |
Language | Haskell2010 |
Download
carries information about a download request,
including a NetworkRequest
object. The application may use
this object to control the download process, or to simply figure
out what is to be downloaded, and do it itself.
- newtype Download = Download (ManagedPtr Download)
- class GObject o => IsDownload o
- toDownload :: IsDownload o => o -> IO Download
- noDownload :: Maybe Download
- data DownloadCancelMethodInfo
- downloadCancel :: (HasCallStack, MonadIO m, IsDownload a) => a -> m ()
- data DownloadGetCurrentSizeMethodInfo
- downloadGetCurrentSize :: (HasCallStack, MonadIO m, IsDownload a) => a -> m Word64
- data DownloadGetDestinationUriMethodInfo
- downloadGetDestinationUri :: (HasCallStack, MonadIO m, IsDownload a) => a -> m Text
- data DownloadGetElapsedTimeMethodInfo
- downloadGetElapsedTime :: (HasCallStack, MonadIO m, IsDownload a) => a -> m Double
- data DownloadGetNetworkRequestMethodInfo
- downloadGetNetworkRequest :: (HasCallStack, MonadIO m, IsDownload a) => a -> m NetworkRequest
- data DownloadGetNetworkResponseMethodInfo
- downloadGetNetworkResponse :: (HasCallStack, MonadIO m, IsDownload a) => a -> m NetworkResponse
- data DownloadGetProgressMethodInfo
- downloadGetProgress :: (HasCallStack, MonadIO m, IsDownload a) => a -> m Double
- data DownloadGetStatusMethodInfo
- downloadGetStatus :: (HasCallStack, MonadIO m, IsDownload a) => a -> m DownloadStatus
- data DownloadGetSuggestedFilenameMethodInfo
- downloadGetSuggestedFilename :: (HasCallStack, MonadIO m, IsDownload a) => a -> m Text
- data DownloadGetTotalSizeMethodInfo
- downloadGetTotalSize :: (HasCallStack, MonadIO m, IsDownload a) => a -> m Word64
- data DownloadGetUriMethodInfo
- downloadGetUri :: (HasCallStack, MonadIO m, IsDownload a) => a -> m Text
- downloadNew :: (HasCallStack, MonadIO m, IsNetworkRequest a) => a -> m Download
- data DownloadSetDestinationUriMethodInfo
- downloadSetDestinationUri :: (HasCallStack, MonadIO m, IsDownload a) => a -> Text -> m ()
- data DownloadStartMethodInfo
- downloadStart :: (HasCallStack, MonadIO m, IsDownload a) => a -> m ()
- data DownloadCurrentSizePropertyInfo
- downloadCurrentSize :: AttrLabelProxy "currentSize"
- getDownloadCurrentSize :: (MonadIO m, IsDownload o) => o -> m Word64
- data DownloadDestinationUriPropertyInfo
- constructDownloadDestinationUri :: IsDownload o => Text -> IO (GValueConstruct o)
- downloadDestinationUri :: AttrLabelProxy "destinationUri"
- getDownloadDestinationUri :: (MonadIO m, IsDownload o) => o -> m Text
- setDownloadDestinationUri :: (MonadIO m, IsDownload o) => o -> Text -> m ()
- data DownloadNetworkRequestPropertyInfo
- constructDownloadNetworkRequest :: (IsDownload o, IsNetworkRequest a) => a -> IO (GValueConstruct o)
- downloadNetworkRequest :: AttrLabelProxy "networkRequest"
- getDownloadNetworkRequest :: (MonadIO m, IsDownload o) => o -> m NetworkRequest
- data DownloadNetworkResponsePropertyInfo
- constructDownloadNetworkResponse :: (IsDownload o, IsNetworkResponse a) => a -> IO (GValueConstruct o)
- downloadNetworkResponse :: AttrLabelProxy "networkResponse"
- getDownloadNetworkResponse :: (MonadIO m, IsDownload o) => o -> m NetworkResponse
- data DownloadProgressPropertyInfo
- downloadProgress :: AttrLabelProxy "progress"
- getDownloadProgress :: (MonadIO m, IsDownload o) => o -> m Double
- data DownloadStatusPropertyInfo
- downloadStatus :: AttrLabelProxy "status"
- getDownloadStatus :: (MonadIO m, IsDownload o) => o -> m DownloadStatus
- data DownloadSuggestedFilenamePropertyInfo
- downloadSuggestedFilename :: AttrLabelProxy "suggestedFilename"
- getDownloadSuggestedFilename :: (MonadIO m, IsDownload o) => o -> m Text
- data DownloadTotalSizePropertyInfo
- downloadTotalSize :: AttrLabelProxy "totalSize"
- getDownloadTotalSize :: (MonadIO m, IsDownload o) => o -> m Word64
- type C_DownloadErrorCallback = Ptr () -> Int32 -> Int32 -> CString -> Ptr () -> IO CInt
- type DownloadErrorCallback = Int32 -> Int32 -> Text -> IO Bool
- data DownloadErrorSignalInfo
- afterDownloadError :: (IsDownload a, MonadIO m) => a -> DownloadErrorCallback -> m SignalHandlerId
- genClosure_DownloadError :: DownloadErrorCallback -> IO Closure
- mk_DownloadErrorCallback :: C_DownloadErrorCallback -> IO (FunPtr C_DownloadErrorCallback)
- noDownloadErrorCallback :: Maybe DownloadErrorCallback
- onDownloadError :: (IsDownload a, MonadIO m) => a -> DownloadErrorCallback -> m SignalHandlerId
- wrap_DownloadErrorCallback :: DownloadErrorCallback -> Ptr () -> Int32 -> Int32 -> CString -> Ptr () -> IO CInt
Exported types
GObject Download Source # | |
IsObject Download Source # | |
IsDownload Download Source # | |
((~) * info (ResolveDownloadMethod t Download), MethodInfo * info Download p) => IsLabel t (Download -> p) Source # | |
((~) * info (ResolveDownloadMethod t Download), MethodInfo * info Download p) => IsLabelProxy t (Download -> p) Source # | |
HasAttributeList * Download Source # | |
type AttributeList Download Source # | |
type SignalList Download Source # | |
class GObject o => IsDownload o Source #
(GObject a, UnknownAncestorError Constraint Download a) => IsDownload a Source # | |
IsDownload Download Source # | |
toDownload :: IsDownload o => o -> IO Download Source #
Methods
cancel
data DownloadCancelMethodInfo Source #
((~) * signature (m ()), MonadIO m, IsDownload a) => MethodInfo * DownloadCancelMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsDownload a) | |
=> a |
|
-> m () |
Cancels the download. Calling this will not free the
Download
object, so you still need to call
objectUnref
on it, if you are the owner of a reference. Notice
that cancelling the download provokes the emission of the
WebKitDownload::error signal, reporting that the download was
cancelled.
Since: 1.1.2
getCurrentSize
data DownloadGetCurrentSizeMethodInfo Source #
((~) * signature (m Word64), MonadIO m, IsDownload a) => MethodInfo * DownloadGetCurrentSizeMethodInfo a signature Source # | |
downloadGetCurrentSize Source #
:: (HasCallStack, MonadIO m, IsDownload a) | |
=> a |
|
-> m Word64 | Returns: the already downloaded size |
Current already downloaded size.
Since: 1.1.2
getDestinationUri
data DownloadGetDestinationUriMethodInfo Source #
((~) * signature (m Text), MonadIO m, IsDownload a) => MethodInfo * DownloadGetDestinationUriMethodInfo a signature Source # | |
downloadGetDestinationUri Source #
:: (HasCallStack, MonadIO m, IsDownload a) | |
=> a |
|
-> m Text | Returns: the destination URI or |
Obtains the URI to which the downloaded file will be written. This
must have been set by the application before calling
downloadStart
, and may be Nothing
.
Since: 1.1.2
getElapsedTime
data DownloadGetElapsedTimeMethodInfo Source #
((~) * signature (m Double), MonadIO m, IsDownload a) => MethodInfo * DownloadGetElapsedTimeMethodInfo a signature Source # | |
downloadGetElapsedTime Source #
:: (HasCallStack, MonadIO m, IsDownload a) | |
=> a |
|
-> m Double | Returns: seconds since the download was started, as a |
Elapsed time for the download in seconds, including any fractional part. If the download is finished, had an error or was cancelled this is the time between its start and the event.
Since: 1.1.2
getNetworkRequest
data DownloadGetNetworkRequestMethodInfo Source #
((~) * signature (m NetworkRequest), MonadIO m, IsDownload a) => MethodInfo * DownloadGetNetworkRequestMethodInfo a signature Source # | |
downloadGetNetworkRequest Source #
:: (HasCallStack, MonadIO m, IsDownload a) | |
=> a |
|
-> m NetworkRequest | Returns: the |
Retrieves the NetworkRequest
object that backs the download
process.
Since: 1.1.2
getNetworkResponse
data DownloadGetNetworkResponseMethodInfo Source #
((~) * signature (m NetworkResponse), MonadIO m, IsDownload a) => MethodInfo * DownloadGetNetworkResponseMethodInfo a signature Source # | |
downloadGetNetworkResponse Source #
:: (HasCallStack, MonadIO m, IsDownload a) | |
=> a |
|
-> m NetworkResponse | Returns: the |
Retrieves the NetworkResponse
object that backs the download
process.
Since: 1.1.16
getProgress
data DownloadGetProgressMethodInfo Source #
((~) * signature (m Double), MonadIO m, IsDownload a) => MethodInfo * DownloadGetProgressMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsDownload a) | |
=> a |
|
-> m Double | Returns: a |
Determines the current progress of the download.
Since: 1.1.2
getStatus
data DownloadGetStatusMethodInfo Source #
((~) * signature (m DownloadStatus), MonadIO m, IsDownload a) => MethodInfo * DownloadGetStatusMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsDownload a) | |
=> a |
|
-> m DownloadStatus | Returns: the current |
Obtains the current status of the download, as a
DownloadStatus
.
Since: 1.1.2
getSuggestedFilename
data DownloadGetSuggestedFilenameMethodInfo Source #
((~) * signature (m Text), MonadIO m, IsDownload a) => MethodInfo * DownloadGetSuggestedFilenameMethodInfo a signature Source # | |
downloadGetSuggestedFilename Source #
:: (HasCallStack, MonadIO m, IsDownload a) | |
=> a |
|
-> m Text | Returns: the suggested filename |
Retrieves the filename that was suggested by the server, or the one derived by WebKit from the URI.
Since: 1.1.2
getTotalSize
data DownloadGetTotalSizeMethodInfo Source #
((~) * signature (m Word64), MonadIO m, IsDownload a) => MethodInfo * DownloadGetTotalSizeMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsDownload a) | |
=> a |
|
-> m Word64 | Returns: the expected total size of the downloaded file |
Returns the expected total size of the download. This is expected because the server may provide incorrect or missing Content-Length. Notice that this may grow over time, as it will be always the same as current_size in the cases where current size surpasses it.
Since: 1.1.2
getUri
data DownloadGetUriMethodInfo Source #
((~) * signature (m Text), MonadIO m, IsDownload a) => MethodInfo * DownloadGetUriMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsDownload a) | |
=> a |
|
-> m Text | Returns: the URI |
Convenience method to retrieve the URI from the
NetworkRequest
which is being downloaded.
Since: 1.1.2
new
:: (HasCallStack, MonadIO m, IsNetworkRequest a) | |
=> a |
|
-> m Download | Returns: the new |
Creates a new Download
object for the given
NetworkRequest
object.
Since: 1.1.2
setDestinationUri
data DownloadSetDestinationUriMethodInfo Source #
((~) * signature (Text -> m ()), MonadIO m, IsDownload a) => MethodInfo * DownloadSetDestinationUriMethodInfo a signature Source # | |
downloadSetDestinationUri Source #
:: (HasCallStack, MonadIO m, IsDownload a) | |
=> a |
|
-> Text |
|
-> m () |
Defines the URI that should be used to save the downloaded file to.
Since: 1.1.2
start
data DownloadStartMethodInfo Source #
((~) * signature (m ()), MonadIO m, IsDownload a) => MethodInfo * DownloadStartMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsDownload a) | |
=> a |
|
-> m () |
Initiates the download. Notice that you must have set the destination-uri property before calling this method.
Since: 1.1.2
Properties
currentSize
data DownloadCurrentSizePropertyInfo Source #
downloadCurrentSize :: AttrLabelProxy "currentSize" Source #
getDownloadCurrentSize :: (MonadIO m, IsDownload o) => o -> m Word64 Source #
destinationUri
data DownloadDestinationUriPropertyInfo Source #
constructDownloadDestinationUri :: IsDownload o => Text -> IO (GValueConstruct o) Source #
downloadDestinationUri :: AttrLabelProxy "destinationUri" Source #
getDownloadDestinationUri :: (MonadIO m, IsDownload o) => o -> m Text Source #
setDownloadDestinationUri :: (MonadIO m, IsDownload o) => o -> Text -> m () Source #
networkRequest
data DownloadNetworkRequestPropertyInfo Source #
constructDownloadNetworkRequest :: (IsDownload o, IsNetworkRequest a) => a -> IO (GValueConstruct o) Source #
downloadNetworkRequest :: AttrLabelProxy "networkRequest" Source #
getDownloadNetworkRequest :: (MonadIO m, IsDownload o) => o -> m NetworkRequest Source #
networkResponse
data DownloadNetworkResponsePropertyInfo Source #
constructDownloadNetworkResponse :: (IsDownload o, IsNetworkResponse a) => a -> IO (GValueConstruct o) Source #
downloadNetworkResponse :: AttrLabelProxy "networkResponse" Source #
getDownloadNetworkResponse :: (MonadIO m, IsDownload o) => o -> m NetworkResponse Source #
progress
data DownloadProgressPropertyInfo Source #
downloadProgress :: AttrLabelProxy "progress" Source #
getDownloadProgress :: (MonadIO m, IsDownload o) => o -> m Double Source #
status
data DownloadStatusPropertyInfo Source #
downloadStatus :: AttrLabelProxy "status" Source #
getDownloadStatus :: (MonadIO m, IsDownload o) => o -> m DownloadStatus Source #
suggestedFilename
data DownloadSuggestedFilenamePropertyInfo Source #
downloadSuggestedFilename :: AttrLabelProxy "suggestedFilename" Source #
getDownloadSuggestedFilename :: (MonadIO m, IsDownload o) => o -> m Text Source #
totalSize
data DownloadTotalSizePropertyInfo Source #
downloadTotalSize :: AttrLabelProxy "totalSize" Source #
getDownloadTotalSize :: (MonadIO m, IsDownload o) => o -> m Word64 Source #
Signals
error
afterDownloadError :: (IsDownload a, MonadIO m) => a -> DownloadErrorCallback -> m SignalHandlerId Source #
onDownloadError :: (IsDownload a, MonadIO m) => a -> DownloadErrorCallback -> m SignalHandlerId Source #