[rhythmbox] podcast: delete partial downloads when they're cancelled
- From: Jonathan Matthew <jmatthew src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox] podcast: delete partial downloads when they're cancelled
- Date: Thu, 15 Oct 2020 06:59:15 +0000 (UTC)
commit 85d6bc797bb157afe2afd4cf0a70589297a86997
Author: Jonathan Matthew <jonathan d14n org>
Date: Thu Oct 15 16:14:13 2020 +1000
podcast: delete partial downloads when they're cancelled
Leaving the partial download lying around means we'll resume it on next
startup. Deleting it seems like a better match for the intent.
podcast/rb-podcast-manager.c | 8 ++++++++
1 file changed, 8 insertions(+)
---
diff --git a/podcast/rb-podcast-manager.c b/podcast/rb-podcast-manager.c
index 2b31ea86b..ca524d4a0 100644
--- a/podcast/rb-podcast-manager.c
+++ b/podcast/rb-podcast-manager.c
@@ -1758,6 +1758,10 @@ podcast_download_cb (GObject *source_object, GAsyncResult *res, gpointer data)
rhythmdb_commit (pd->priv->db);
} else {
rb_debug ("download of %s was cancelled", get_remote_location (download->entry));
+ g_value_init (&val, G_TYPE_ULONG);
+ g_value_set_ulong (&val, RHYTHMDB_PODCAST_STATUS_PAUSED);
+ rhythmdb_entry_set (pd->priv->db, download->entry, RHYTHMDB_PROP_STATUS, &val);
+ g_value_unset (&val);
}
g_clear_error (&error);
@@ -2251,6 +2255,10 @@ download_task (GTask *task, gpointer source_object, gpointer task_data, GCancell
}
if (error != NULL) {
+ if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+ rb_debug ("deleting cancelled download");
+ g_file_delete (download->destination, NULL, NULL);
+ }
g_task_return_error (task, error);
} else {
finish_download (pd, download, remote_size, downloaded);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]