Class

WPEWebKitDownload

Description [src]

class WPEWebKit.Download : GObject.Object {
  parent: GObject
}

Object used to communicate with the application when downloading.

WebKitDownload carries information about a download request and response, including a WebKitURIRequest and a WebKitURIResponse objects. The application may use this object to control the download process, or to simply figure out what is to be downloaded, and handle the download process itself.

Hierarchy

hierarchy this WebKitDownload ancestor_0 GObject ancestor_0--this

Ancestors

Instance methods

webkit_download_cancel

Cancels the download. When the ongoing download operation is effectively cancelled the signal WebKitDownload::failed is emitted with WEBKIT_DOWNLOAD_ERROR_CANCELLED_BY_USER error.

webkit_download_get_allow_overwrite

Returns the current value of the WebKitDownload: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.

Available since: 2.6

webkit_download_get_destination

Obtains the URI to which the downloaded file will be written. You can connect to WebKitDownload::created-destination to make sure this method returns a valid destination.

webkit_download_get_elapsed_time

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.

webkit_download_get_estimated_progress

Gets the value of the WebKitDownload:estimated-progress property. You can monitor the estimated progress of the download operation by connecting to the notify::estimated-progress signal of download.

webkit_download_get_received_data_length

Gets the length of the data already downloaded for download in bytes.

webkit_download_get_request

Retrieves the WebKitURIRequest object that backs the download process.

webkit_download_get_response

Retrieves the WebKitURIResponse object that backs the download process. This method returns NULL 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.

webkit_download_get_web_view

Get the WebKitWebView that initiated the download.

webkit_download_set_allow_overwrite

Sets the WebKitDownload: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.

Available since: 2.6

webkit_download_set_destination

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 WebKitDownload::decide-destination signal and call webkit_download_set_destination(). 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 webkit_download_set_destination(). If WebKitDownload::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 G_USER_DIRECTORY_DOWNLOAD directory.

Methods inherited from GObject (42)

Please see GObject for a full list of methods.

Properties

WPEWebKit.Download:allow-overwrite

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.

Available since: 2.6

WPEWebKit.Download:destination

The local URI to where the download will be saved.

WPEWebKit.Download:estimated-progress

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 WebKitDownload::received-data signal to track the progress.

WPEWebKit.Download:response

The WebKitURIResponse associated with this download.

Signals

WPEWebKit.Download::created-destination

This signal is emitted after WebKitDownload::decide-destination and before WebKitDownload::received-data to notify that destination file has been created successfully at destination.

WPEWebKit.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 G_USER_DIRECTORY_DOWNLOAD directory using suggested_filename.

WPEWebKit.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 webkit_download_cancel(), this signal is emitted with error WEBKIT_DOWNLOAD_ERROR_CANCELLED_BY_USER. The download operation finishes after an error and WebKitDownload::finished signal is emitted after this one.

WPEWebKit.Download::finished

This signal is emitted when download finishes successfully or due to an error. In case of errors WebKitDownload::failed signal is emitted before this one.

WPEWebKit.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.

Signals inherited from GObject (1)
GObject.Object::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

Class structure

struct WPEWebKitDownloadClass {
  GObjectClass parent_class;
  gboolean (* decide_destination) (
    WebKitDownload* download,
    const gchar* suggested_filename
  );
  void (* _webkit_reserved0) (
void
  );
  void (* _webkit_reserved1) (
void
  );
  void (* _webkit_reserved2) (
void
  );
  void (* _webkit_reserved3) (
void
  );
  
}
Class members
parent_class
GObjectClass
  No description available.
decide_destination
gboolean (* decide_destination) (
    WebKitDownload* download,
    const gchar* suggested_filename
  )
  No description available.
_webkit_reserved0
void (* _webkit_reserved0) (
void
  )
  No description available.
_webkit_reserved1
void (* _webkit_reserved1) (
void
  )
  No description available.
_webkit_reserved2
void (* _webkit_reserved2) (
void
  )
  No description available.
_webkit_reserved3
void (* _webkit_reserved3) (
void
  )
  No description available.

Virtual methods

WPEWebKit.DownloadClass.decide_destination
No description available.