aboutsummaryrefslogtreecommitdiffstats
path: root/embed/downloader-view.c
diff options
context:
space:
mode:
authorDiego Escalante Urrelo <diegoe@gnome.org>2009-12-29 14:13:18 +0800
committerDiego Escalante Urrelo <diegoe@gnome.org>2009-12-30 04:20:43 +0800
commit03ad276917dd0ffb1a6098d5d352dee63c89b7f2 (patch)
tree4734f9a6f7980d59395f9814fa2e35bf1b52d010 /embed/downloader-view.c
parent915203e369ffadb94ecf895f6c328dcba91a7789 (diff)
downloadgsoc2013-epiphany-03ad276917dd0ffb1a6098d5d352dee63c89b7f2.tar
gsoc2013-epiphany-03ad276917dd0ffb1a6098d5d352dee63c89b7f2.tar.gz
gsoc2013-epiphany-03ad276917dd0ffb1a6098d5d352dee63c89b7f2.tar.bz2
gsoc2013-epiphany-03ad276917dd0ffb1a6098d5d352dee63c89b7f2.tar.lz
gsoc2013-epiphany-03ad276917dd0ffb1a6098d5d352dee63c89b7f2.tar.xz
gsoc2013-epiphany-03ad276917dd0ffb1a6098d5d352dee63c89b7f2.tar.zst
gsoc2013-epiphany-03ad276917dd0ffb1a6098d5d352dee63c89b7f2.zip
Implement replace action for downloads
Always download to a temporary location, only move the file to the final destination after it has been downloaded completely. Bug #594192
Diffstat (limited to 'embed/downloader-view.c')
-rw-r--r--embed/downloader-view.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/embed/downloader-view.c b/embed/downloader-view.c
index 3ecb4a29d..b23d0426e 100644
--- a/embed/downloader-view.c
+++ b/embed/downloader-view.c
@@ -366,13 +366,17 @@ static char *
ephy_download_get_name (WebKitDownload *download)
{
const char *target;
+ char *user_destination;
char *result;
target = webkit_download_get_destination_uri (download);
+ user_destination = g_object_get_data (G_OBJECT (download),
+ "user-destination-uri");
- if (target)
+ if (user_destination || target)
{
- result = g_path_get_basename (target);
+ result = g_path_get_basename (user_destination ?
+ user_destination : target);
}
else
{
@@ -410,10 +414,18 @@ do_open_downloaded_file (DownloaderView *dv, WebKitDownload *download, gboolean
{
DownloaderViewPrivate *priv = dv->priv;
GdkDisplay *gdk_display;
- const char *destination_uri = webkit_download_get_destination_uri (download);
- GFile *downloaded_file = g_file_new_for_uri (destination_uri);
+ const char *destination_uri;
+ char *user_destination;
+ GFile *downloaded_file;
gdk_display = gtk_widget_get_display (priv->window);
+
+ destination_uri = webkit_download_get_destination_uri (download);
+ user_destination = g_object_get_data (G_OBJECT (download),
+ "user-destination-uri");
+
+ downloaded_file = g_file_new_for_uri (user_destination ?
+ user_destination : destination_uri);
if (open_location)
{
ephy_file_browse_to (downloaded_file,