[rhythmbox] podcast: restore location and mountpoint on errors
- From: Jonathan Matthew <jmatthew src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox] podcast: restore location and mountpoint on errors
- Date: Tue, 1 Jun 2021 11:09:03 +0000 (UTC)
commit 32648264b1cda7bb3cfc9552ec27222abb64c3a5
Author: crvi <crvisqr gmail com>
Date: Thu Apr 29 04:34:35 2021 +0530
podcast: restore location and mountpoint on errors
Closes: #1876
podcast/rb-podcast-manager.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
---
diff --git a/podcast/rb-podcast-manager.c b/podcast/rb-podcast-manager.c
index d6fd6035a..635db0b27 100644
--- a/podcast/rb-podcast-manager.c
+++ b/podcast/rb-podcast-manager.c
@@ -445,6 +445,27 @@ set_download_location (RhythmDB *db, RhythmDBEntry *entry, GValue *value)
}
}
+static void
+unset_download_location (RhythmDB *db, RhythmDBEntry *entry)
+{
+ GValue val = {0, };
+ const char *remote_location;
+
+ remote_location = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_MOUNTPOINT);
+ if (remote_location == NULL)
+ return;
+
+ /* restore mountpoint as location */
+ g_value_init (&val, G_TYPE_STRING);
+ g_value_set_string (&val, remote_location);
+ rhythmdb_entry_set (db, entry, RHYTHMDB_PROP_LOCATION, &val);
+
+ /* unset mountpoint */
+ g_value_reset (&val);
+ rhythmdb_entry_set (db, entry, RHYTHMDB_PROP_MOUNTPOINT, &val);
+ g_value_unset (&val);
+}
+
static const char *
get_remote_location (RhythmDBEntry *entry)
{
@@ -1728,6 +1749,8 @@ podcast_download_cb (GObject *source_object, GAsyncResult *res, gpointer data)
g_value_unset (&val);
}
+ unset_download_location (pd->priv->db, download->entry);
+
rhythmdb_commit (pd->priv->db);
g_clear_error (&error);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]