diff options
-rw-r--r-- | embed/downloader-view.c | 1 | ||||
-rw-r--r-- | embed/webkit/webkit-embed.c | 4 | ||||
-rw-r--r-- | lib/ephy-file-helpers.c | 28 | ||||
-rw-r--r-- | lib/ephy-file-helpers.h | 1 |
4 files changed, 33 insertions, 1 deletions
diff --git a/embed/downloader-view.c b/embed/downloader-view.c index f8fe7f94e..b15459204 100644 --- a/embed/downloader-view.c +++ b/embed/downloader-view.c @@ -996,6 +996,7 @@ download_dialog_stop (DownloaderView *dv) { if (!l->data) continue; webkit_download_cancel ((WebKitDownload*) l->data); + ephy_file_delete_uri (webkit_download_get_destination_uri ((WebKitDownload*) l->data)); g_object_unref (l->data); } diff --git a/embed/webkit/webkit-embed.c b/embed/webkit/webkit-embed.c index cd1d1b11a..1886a20c5 100644 --- a/embed/webkit/webkit-embed.c +++ b/embed/webkit/webkit-embed.c @@ -425,8 +425,10 @@ download_requested_dialog_response_cb (GtkDialog *dialog, dview = EPHY_DOWNLOADER_VIEW (ephy_embed_shell_get_downloader_view (embed_shell)); downloader_view_add_download (dview, download); } - else + else { webkit_download_cancel (download); + ephy_file_delete_uri (webkit_download_get_destination_uri (download)); + } gtk_widget_destroy (GTK_WIDGET (dialog)); } diff --git a/lib/ephy-file-helpers.c b/lib/ephy-file-helpers.c index cc588985b..7f38978dd 100644 --- a/lib/ephy-file-helpers.c +++ b/lib/ephy-file-helpers.c @@ -754,3 +754,31 @@ ephy_file_delete_directory (const char *path) } g_object_unref (file); } + +/** + * ephy_file_delete_uri + * @uri: URI of the file to be deleted + * + * Remove the given URI. + * + */ +void +ephy_file_delete_uri (const char *uri) +{ + GFile *file; + gboolean ret; + + file = g_file_new_for_uri (uri); + + ret = g_file_delete (file, NULL, NULL); + + if (ret == TRUE) + { + LOG ("Deleted file at URI '%s'", uri); + } + else + { + LOG ("Couldn't file at URI '%s'", uri); + } + g_object_unref (file); +} diff --git a/lib/ephy-file-helpers.h b/lib/ephy-file-helpers.h index 77aa5e055..1127b0691 100644 --- a/lib/ephy-file-helpers.h +++ b/lib/ephy-file-helpers.h @@ -103,6 +103,7 @@ gboolean ephy_file_browse_to (GFile *file, void ephy_file_delete_directory (const char *path); +void ephy_file_delete_uri (const char *uri); G_END_DECLS #endif /* EPHY_FILE_HELPERS_H */ |