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 :: (MonadIO m, IsDownload o) => o -> m Download
- noDownload :: Maybe Download
- downloadCancel :: (HasCallStack, MonadIO m, IsDownload a) => a -> m ()
- downloadGetCurrentSize :: (HasCallStack, MonadIO m, IsDownload a) => a -> m Word64
- downloadGetDestinationUri :: (HasCallStack, MonadIO m, IsDownload a) => a -> m Text
- downloadGetElapsedTime :: (HasCallStack, MonadIO m, IsDownload a) => a -> m Double
- downloadGetNetworkRequest :: (HasCallStack, MonadIO m, IsDownload a) => a -> m NetworkRequest
- downloadGetNetworkResponse :: (HasCallStack, MonadIO m, IsDownload a) => a -> m NetworkResponse
- downloadGetProgress :: (HasCallStack, MonadIO m, IsDownload a) => a -> m Double
- downloadGetStatus :: (HasCallStack, MonadIO m, IsDownload a) => a -> m DownloadStatus
- downloadGetSuggestedFilename :: (HasCallStack, MonadIO m, IsDownload a) => a -> m Text
- downloadGetTotalSize :: (HasCallStack, MonadIO m, IsDownload a) => a -> m Word64
- downloadGetUri :: (HasCallStack, MonadIO m, IsDownload a) => a -> m Text
- downloadNew :: (HasCallStack, MonadIO m, IsNetworkRequest a) => a -> m Download
- downloadSetDestinationUri :: (HasCallStack, MonadIO m, IsDownload a) => a -> Text -> m ()
- downloadStart :: (HasCallStack, MonadIO m, IsDownload a) => a -> m ()
- getDownloadCurrentSize :: (MonadIO m, IsDownload o) => o -> m Word64
- constructDownloadDestinationUri :: IsDownload o => Text -> IO (GValueConstruct o)
- getDownloadDestinationUri :: (MonadIO m, IsDownload o) => o -> m Text
- setDownloadDestinationUri :: (MonadIO m, IsDownload o) => o -> Text -> m ()
- constructDownloadNetworkRequest :: (IsDownload o, IsNetworkRequest a) => a -> IO (GValueConstruct o)
- getDownloadNetworkRequest :: (MonadIO m, IsDownload o) => o -> m NetworkRequest
- constructDownloadNetworkResponse :: (IsDownload o, IsNetworkResponse a) => a -> IO (GValueConstruct o)
- getDownloadNetworkResponse :: (MonadIO m, IsDownload o) => o -> m NetworkResponse
- getDownloadProgress :: (MonadIO m, IsDownload o) => o -> m Double
- getDownloadStatus :: (MonadIO m, IsDownload o) => o -> m DownloadStatus
- getDownloadSuggestedFilename :: (MonadIO m, IsDownload o) => o -> m Text
- 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
- 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
class GObject o => IsDownload o Source #
(GObject a, UnknownAncestorError Constraint Download a) => IsDownload a Source # | |
IsDownload Download Source # | |
toDownload :: (MonadIO m, IsDownload o) => o -> m Download Source #
Methods
cancel
:: (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
downloadGetCurrentSize Source #
:: (HasCallStack, MonadIO m, IsDownload a) | |
=> a |
|
-> m Word64 | Returns: the already downloaded size |
Current already downloaded size.
Since: 1.1.2
getDestinationUri
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
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
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
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
:: (HasCallStack, MonadIO m, IsDownload a) | |
=> a |
|
-> m Double | Returns: a |
Determines the current progress of the download.
Since: 1.1.2
getStatus
:: (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
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
:: (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
:: (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
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
:: (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
getDownloadCurrentSize :: (MonadIO m, IsDownload o) => o -> m Word64 Source #
destinationUri
constructDownloadDestinationUri :: IsDownload o => Text -> IO (GValueConstruct o) Source #
getDownloadDestinationUri :: (MonadIO m, IsDownload o) => o -> m Text Source #
setDownloadDestinationUri :: (MonadIO m, IsDownload o) => o -> Text -> m () Source #
networkRequest
constructDownloadNetworkRequest :: (IsDownload o, IsNetworkRequest a) => a -> IO (GValueConstruct o) Source #
getDownloadNetworkRequest :: (MonadIO m, IsDownload o) => o -> m NetworkRequest Source #
networkResponse
constructDownloadNetworkResponse :: (IsDownload o, IsNetworkResponse a) => a -> IO (GValueConstruct o) Source #
getDownloadNetworkResponse :: (MonadIO m, IsDownload o) => o -> m NetworkResponse Source #
progress
getDownloadProgress :: (MonadIO m, IsDownload o) => o -> m Double Source #
status
getDownloadStatus :: (MonadIO m, IsDownload o) => o -> m DownloadStatus Source #
suggestedFilename
getDownloadSuggestedFilename :: (MonadIO m, IsDownload o) => o -> m Text Source #
totalSize
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 #