WebKitDownload

WebKitDownload — Object used to communicate with the application when downloading.

Synopsis

enum                WebKitDownloadError;
enum                WebKitDownloadStatus;
                    WebKitDownload;
void                webkit_download_cancel              (WebKitDownload *download);
GType               webkit_download_error_get_type      (void);
guint64             webkit_download_get_current_size    (WebKitDownload *download);
const gchar *       webkit_download_get_destination_uri (WebKitDownload *download);
gdouble             webkit_download_get_elapsed_time    (WebKitDownload *download);
WebKitNetworkRequest * webkit_download_get_network_request
                                                        (WebKitDownload *download);
WebKitNetworkResponse * webkit_download_get_network_response
                                                        (WebKitDownload *download);
gdouble             webkit_download_get_progress        (WebKitDownload *download);
WebKitDownloadStatus  webkit_download_get_status        (WebKitDownload *download);
const gchar *       webkit_download_get_suggested_filename
                                                        (WebKitDownload *download);
guint64             webkit_download_get_total_size      (WebKitDownload *download);
const gchar *       webkit_download_get_uri             (WebKitDownload *download);
WebKitDownload *    webkit_download_new                 (WebKitNetworkRequest *request);
void                webkit_download_set_destination_uri (WebKitDownload *download,
                                                         const gchar *destination_uri);
void                webkit_download_start               (WebKitDownload *download);
GType               webkit_download_status_get_type     (void);

Description

WebKitDownload carries information about a download request, including a WebKitNetworkRequest 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.

Details

enum WebKitDownloadError

typedef enum {
    WEBKIT_DOWNLOAD_ERROR_CANCELLED_BY_USER,
    WEBKIT_DOWNLOAD_ERROR_DESTINATION,
    WEBKIT_DOWNLOAD_ERROR_NETWORK
} WebKitDownloadError;


enum WebKitDownloadStatus

typedef enum {
    WEBKIT_DOWNLOAD_STATUS_ERROR = -1,
    WEBKIT_DOWNLOAD_STATUS_CREATED = 0,
    WEBKIT_DOWNLOAD_STATUS_STARTED,
    WEBKIT_DOWNLOAD_STATUS_CANCELLED,
    WEBKIT_DOWNLOAD_STATUS_FINISHED
} WebKitDownloadStatus;


WebKitDownload

typedef struct {
    GObject parent_instance;

    WebKitDownloadPrivate *priv;
} WebKitDownload;


webkit_download_cancel ()

void                webkit_download_cancel              (WebKitDownload *download);

Cancels the download. Calling this will not free the WebKitDownload object, so you still need to call g_object_unref() 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.

download :

the WebKitDownload

Since 1.1.2


webkit_download_error_get_type ()

GType               webkit_download_error_get_type      (void);

Returns :


webkit_download_get_current_size ()

guint64             webkit_download_get_current_size    (WebKitDownload *download);

Current already downloaded size.

download :

the WebKitDownload

Returns :

the already downloaded size

Since 1.1.2


webkit_download_get_destination_uri ()

const gchar *       webkit_download_get_destination_uri (WebKitDownload *download);

Obtains the URI to which the downloaded file will be written. This must have been set by the application before calling webkit_download_start(), and may be NULL.

download :

the WebKitDownload

Returns :

the destination URI or NULL

Since 1.1.2


webkit_download_get_elapsed_time ()

gdouble             webkit_download_get_elapsed_time    (WebKitDownload *download);

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.

download :

a WebKitDownload

Returns :

seconds since the download was started, as a gdouble

Since 1.1.2


webkit_download_get_network_request ()

WebKitNetworkRequest * webkit_download_get_network_request
                                                        (WebKitDownload *download);

Retrieves the WebKitNetworkRequest object that backs the download process.

download :

the WebKitDownload

Returns :

the WebKitNetworkRequest instance

Since 1.1.2


webkit_download_get_network_response ()

WebKitNetworkResponse * webkit_download_get_network_response
                                                        (WebKitDownload *download);

Retrieves the WebKitNetworkResponse object that backs the download process.

download :

the WebKitDownload

Returns :

the WebKitNetworkResponse instance

Since 1.1.16


webkit_download_get_progress ()

gdouble             webkit_download_get_progress        (WebKitDownload *download);

Determines the current progress of the download.

download :

a WebKitDownload

Returns :

a gdouble ranging from 0.0 to 1.0.

Since 1.1.2


webkit_download_get_status ()

WebKitDownloadStatus  webkit_download_get_status        (WebKitDownload *download);

Obtains the current status of the download, as a WebKitDownloadStatus.

download :

the WebKitDownload

Returns :

the current WebKitDownloadStatus

Since 1.1.2


webkit_download_get_suggested_filename ()

const gchar *       webkit_download_get_suggested_filename
                                                        (WebKitDownload *download);

Retrieves the filename that was suggested by the server, or the one derived by WebKit from the URI.

download :

the WebKitDownload

Returns :

the suggested filename

Since 1.1.2


webkit_download_get_total_size ()

guint64             webkit_download_get_total_size      (WebKitDownload *download);

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.

download :

the WebKitDownload

Returns :

the expected total size of the downloaded file

Since 1.1.2


webkit_download_get_uri ()

const gchar *       webkit_download_get_uri             (WebKitDownload *download);

Convenience method to retrieve the URI from the WebKitNetworkRequest which is being downloaded.

download :

the WebKitDownload

Returns :

the uri

Since 1.1.2


webkit_download_new ()

WebKitDownload *    webkit_download_new                 (WebKitNetworkRequest *request);

Creates a new WebKitDownload object for the given WebKitNetworkRequest object.

request :

a WebKitNetworkRequest

Returns :

the new WebKitDownload

Since 1.1.2


webkit_download_set_destination_uri ()

void                webkit_download_set_destination_uri (WebKitDownload *download,
                                                         const gchar *destination_uri);

Defines the URI that should be used to save the downloaded file to.

download :

the WebKitDownload

destination_uri :

the destination URI

Since 1.1.2


webkit_download_start ()

void                webkit_download_start               (WebKitDownload *download);

Initiates the download. Notice that you must have set the destination-uri property before calling this method.

download :

the WebKitDownload

Since 1.1.2


webkit_download_status_get_type ()

GType               webkit_download_status_get_type     (void);

Returns :