summaryrefslogtreecommitdiff
path: root/src/totem-playlist.c
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2013-03-11 13:42:58 +0100
committerBastien Nocera <hadess@hadess.net>2013-03-11 13:42:58 +0100
commit3aa062419c13142300812cbdf733100d186bb4eb (patch)
treed4ba09ef3f65eaa1458bb146905bb80748230cee /src/totem-playlist.c
parentb720cdd388976778f2b9948fc2972f34624d1792 (diff)
downloadtotem-3aa062419c13142300812cbdf733100d186bb4eb.tar.gz
main: Split off saving of the session playlist
We were using the same code as the interactive playlist saving, which meant that error messages popped up in an error dialogue as we were closing the application.
Diffstat (limited to 'src/totem-playlist.c')
-rw-r--r--src/totem-playlist.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/src/totem-playlist.c b/src/totem-playlist.c
index b65c74653..17e4ccc64 100644
--- a/src/totem-playlist.c
+++ b/src/totem-playlist.c
@@ -440,24 +440,39 @@ totem_playlist_save_iter_foreach (GtkTreeModel *model,
void
totem_playlist_save_session_playlist (TotemPlaylist *playlist,
- const char *output_uri)
+ GFile *output)
{
+ TotemPlPlaylist *pl_playlist;
+ GError *error = NULL;
+ gboolean retval;
+
if (playlist->priv->disable_save_to_disk) {
/* On lockdown, we do not touch the disk,
* even to remove the existing session */
return;
}
if (!playlist->priv->save || PL_LEN == 0) {
- GFile *file;
+ g_file_delete (output, NULL, NULL);
+ return;
+ }
+ pl_playlist = totem_pl_playlist_new ();
- file = g_file_new_for_uri (output_uri);
- g_file_delete (file, NULL, NULL);
- g_object_unref (file);
- return;
+ gtk_tree_model_foreach (playlist->priv->model,
+ totem_playlist_save_iter_foreach,
+ pl_playlist);
+
+ retval = totem_pl_parser_save (playlist->priv->parser,
+ pl_playlist,
+ output,
+ NULL, TOTEM_PL_PARSER_XSPF, &error);
+
+ if (retval == FALSE) {
+ g_warning ("Failed to save the session playlist: %s", error->message);
+ g_error_free (error);
}
- totem_playlist_save_current_playlist_ext (playlist, output_uri, TOTEM_PL_PARSER_XSPF);
+ g_object_unref (pl_playlist);
}
void