diff options
Diffstat (limited to 'embed/ephy-download.c')
-rw-r--r-- | embed/ephy-download.c | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/embed/ephy-download.c b/embed/ephy-download.c index 756a1e590..dcea8edda 100644 --- a/embed/ephy-download.c +++ b/embed/ephy-download.c @@ -968,8 +968,16 @@ ephy_download_new (void) return g_object_new (EPHY_TYPE_DOWNLOAD, NULL); } -static EphyDownload * -_ephy_download_new (WebKitDownload *webkit_download, const char *uri) +/** + * ephy_download_new_for_download: + * @download: a #WebKitDownload to wrap + * + * Wraps @download in an #EphyDownload. + * + * Returns: an #EphyDownload. + **/ +EphyDownload * +ephy_download_new_for_download (WebKitDownload *download) { EphyDownload *ephy_download; ephy_download = ephy_download_new (); @@ -977,47 +985,21 @@ _ephy_download_new (WebKitDownload *webkit_download, const char *uri) #ifdef HAVE_WEBKIT2 /* TODO: Downloads */ #else - if (webkit_download == NULL) { - WebKitNetworkRequest *request; - - request = webkit_network_request_new (uri); - webkit_download = webkit_download_new (request); - - g_return_val_if_fail (webkit_download != NULL, NULL); - g_object_unref (request); - } - - g_signal_connect (webkit_download, "notify::status", + g_signal_connect (download, "notify::status", G_CALLBACK (download_status_changed_cb), ephy_download); - g_signal_connect (webkit_download, "error", + g_signal_connect (download, "error", G_CALLBACK (download_error_cb), ephy_download); - ephy_download->priv->download = g_object_ref (webkit_download); - ephy_download->priv->source = g_strdup (webkit_download_get_uri (webkit_download)); + ephy_download->priv->download = g_object_ref (download); + ephy_download->priv->source = g_strdup (webkit_download_get_uri (download)); #endif return ephy_download; } /** - * ephy_download_new_for_download: - * @download: a #WebKitDownload to wrap - * - * Wraps @download in an #EphyDownload. - * - * Returns: an #EphyDownload. - **/ -EphyDownload * -ephy_download_new_for_download (WebKitDownload *download) -{ - g_return_val_if_fail (WEBKIT_IS_DOWNLOAD (download), NULL); - - return _ephy_download_new (download, NULL); -} - -/** * ephy_download_new_for_uri: * @uri: a source URI from where to download * @@ -1028,7 +1010,25 @@ ephy_download_new_for_download (WebKitDownload *download) EphyDownload * ephy_download_new_for_uri (const char *uri) { + EphyDownload *ephy_download; + WebKitDownload *download; +#ifdef HAVE_WEBKIT2 + /* TODO: Downloads */ + download = NULL; +#else + WebKitNetworkRequest *request; + g_return_val_if_fail (uri != NULL, NULL); - return _ephy_download_new (NULL, uri); + request = webkit_network_request_new (uri); + download = webkit_download_new (request); + + g_return_val_if_fail (download != NULL, NULL); + g_object_unref (request); +#endif + + ephy_download = ephy_download_new_for_download (download); + g_object_unref (download); + + return ephy_download; } |