[brasero/gnome-2-28] Use totem_pl_parser_save() for playlist saving.
- From: Bastien Nocera <hadess src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [brasero/gnome-2-28] Use totem_pl_parser_save() for playlist saving.
- Date: Tue, 26 Jan 2010 14:59:41 +0000 (UTC)
commit 1178032a641c4e20eb640b78376596e9a20e9fa4
Author: Carlos Garnacho <carlos lanedo com>
Date: Wed Dec 23 16:37:19 2009 +0100
Use totem_pl_parser_save() for playlist saving.
This newer API doesn't require a GtkTreeModel for writing a
playlist.
https://bugzilla.gnome.org/show_bug.cgi?id=605314
src/brasero-project-parse.c | 59 ++++++++++++++-----------------------------
1 files changed, 19 insertions(+), 40 deletions(-)
---
diff --git a/src/brasero-project-parse.c b/src/brasero-project-parse.c
index ffacf46..9be75c3 100644
--- a/src/brasero-project-parse.c
+++ b/src/brasero-project-parse.c
@@ -1054,21 +1054,6 @@ error:
#ifdef BUILD_PLAYLIST
-static void
-brasero_project_save_audio_playlist_entry (GtkTreeModel *model,
- GtkTreeIter *iter,
- gchar **uri,
- gchar **title,
- gboolean *custom_title,
- gpointer user_data)
-{
- gtk_tree_model_get (model, iter,
- 0, uri,
- 1, title,
- 2, custom_title,
- -1);
-}
-
gboolean
brasero_project_save_audio_project_playlist (BraseroBurnSession *session,
const gchar *uri,
@@ -1076,34 +1061,33 @@ brasero_project_save_audio_project_playlist (BraseroBurnSession *session,
{
TotemPlParserType pl_type;
TotemPlParser *parser;
- GtkListStore *model;
- GtkTreeIter t_iter;
+ TotemPlPlaylist *playlist;
+ TotemPlPlaylistIter pl_iter;
gboolean result;
+ GFile *file;
GSList *iter;
- gchar *path;
-
- path = g_filename_from_uri (uri, NULL, NULL);
- if (!path)
- return FALSE;
+ file = g_file_new_for_uri (uri);
parser = totem_pl_parser_new ();
+ playlist = totem_pl_playlist_new ();
- /* create and populate treemodel */
- model = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN);
+ /* populate playlist */
iter = brasero_burn_session_get_tracks (session);
for (; iter; iter = iter->next) {
BraseroTrackStream *track;
+ const gchar *title;
gchar *uri;
track = iter->data;
uri = brasero_track_stream_get_source (track, TRUE);
- gtk_list_store_append (model, &t_iter);
- gtk_list_store_set (model, &t_iter,
- 0, uri,
- 1, brasero_track_tag_lookup_string (BRASERO_TRACK (track), BRASERO_TRACK_STREAM_TITLE_TAG),
- 2, TRUE,
- -1);
+ title = brasero_track_tag_lookup_string (BRASERO_TRACK (track), BRASERO_TRACK_STREAM_TITLE_TAG);
+
+ totem_pl_playlist_append (playlist, &pl_iter);
+ totem_pl_playlist_set (playlist, &pl_iter,
+ TOTEM_PL_PARSER_FIELD_URI, uri,
+ TOTEM_PL_PARSER_FIELD_TITLE, title,
+ NULL);
g_free (uri);
}
@@ -1124,18 +1108,13 @@ brasero_project_save_audio_project_playlist (BraseroBurnSession *session,
break;
}
- result = totem_pl_parser_write_with_title (parser,
- GTK_TREE_MODEL (model),
- brasero_project_save_audio_playlist_entry,
- path,
- brasero_burn_session_get_label (session),
- pl_type,
- NULL,
- NULL);
+ result = totem_pl_parser_save (parser, playlist, file,
+ brasero_burn_session_get_label (session),
+ type, NULL);
- g_object_unref (model);
+ g_object_unref (playlist);
g_object_unref (parser);
- g_free (path);
+ g_object_unref (file);
return result;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]