rpms/rhythmbox/devel 0001-Use-totem_pl_parser_save-for-playlist-saving.patch, NONE, 1.1 rhythmbox.spec, 1.283, 1.284

Bastien Nocera hadess at fedoraproject.org
Tue Jan 26 14:45:16 UTC 2010


Author: hadess

Update of /cvs/pkgs/rpms/rhythmbox/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv24587

Modified Files:
	rhythmbox.spec 
Added Files:
	0001-Use-totem_pl_parser_save-for-playlist-saving.patch 
Log Message:
* Tue Jan 26 2010 Bastien Nocera <bnocera at redhat.com> 0.12.6-7
- Rebuild for new totem-pl-parser


0001-Use-totem_pl_parser_save-for-playlist-saving.patch:
 plugins/generic-player/rb-generic-player-playlist-source.c |   77 ++++++++-----
 sources/rb-playlist-source.c                               |   55 +++++----
 2 files changed, 85 insertions(+), 47 deletions(-)

--- NEW FILE 0001-Use-totem_pl_parser_save-for-playlist-saving.patch ---
>From afe9495731edafe7142073d0600cb4cec361bc0e Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlos at lanedo.com>
Date: Wed, 23 Dec 2009 16:35:09 +0100
Subject: [PATCH] Use totem_pl_parser_save() for playlist saving.

Both RBPlaylistSource and RBGenericPlayerPlaylistSource use now
newer totem-pl-parser API.

https://bugzilla.gnome.org/show_bug.cgi?id=605313
---
 .../rb-generic-player-playlist-source.c            |   77 ++++++++++++++------
 sources/rb-playlist-source.c                       |   54 ++++++++------
 2 files changed, 85 insertions(+), 46 deletions(-)

diff --git a/plugins/generic-player/rb-generic-player-playlist-source.c b/plugins/generic-player/rb-generic-player-playlist-source.c
index 0dfe26f..dd22181 100644
--- a/plugins/generic-player/rb-generic-player-playlist-source.c
+++ b/plugins/generic-player/rb-generic-player-playlist-source.c
@@ -50,6 +50,12 @@ typedef struct
 	gboolean loading;
 } RBGenericPlayerPlaylistSourcePrivate;
 
+typedef struct
+{
+	RBGenericPlayerPlaylistSource *source;
+	TotemPlPlaylist *playlist;
+} SavePlaylistData;
+
 RB_PLUGIN_DEFINE_TYPE(RBGenericPlayerPlaylistSource,
 		      rb_generic_player_playlist_source,
 		      RB_TYPE_STATIC_PLAYLIST_SOURCE)
@@ -70,26 +76,37 @@ impl_save_to_xml (RBPlaylistSource *source, xmlNodePtr node)
 	/* do nothing; just to prevent weirdness */
 }
 
-static void
-save_playlist_entry (GtkTreeModel *model, GtkTreeIter *iter,
-		     char **uri, char **title,
-		     gboolean *custom_title,
-		     RBGenericPlayerPlaylistSource *source)
+static gboolean
+save_playlist_foreach (GtkTreeModel *model,
+		       GtkTreePath *path,
+		       GtkTreeIter *iter,
+		       gpointer user_data)
 {
-	RBGenericPlayerPlaylistSourcePrivate *priv = GET_PRIVATE (source);
+	SavePlaylistData *data = user_data;
+	RBGenericPlayerPlaylistSourcePrivate *priv = GET_PRIVATE (data->source);
 	RhythmDBEntry *entry;
-	const char *host_uri;
+	TotemPlPlaylistIter pl_iter;
+	const char *host_uri, *title;
+	gchar *uri;
 
 	entry = rhythmdb_query_model_iter_to_entry (RHYTHMDB_QUERY_MODEL (model),
 						    iter);
 	if (entry == NULL) {
-		return;
+		return FALSE;
 	}
 
 	host_uri = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION);
-	*uri = rb_generic_player_source_uri_to_playlist_uri (priv->player_source, host_uri);
-	*title = rhythmdb_entry_dup_string (entry, RHYTHMDB_PROP_TITLE);
-	*custom_title = TRUE;
+	uri = rb_generic_player_source_uri_to_playlist_uri (priv->player_source, host_uri);
+	title = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_TITLE);
+
+	totem_pl_playlist_append (data->playlist, &pl_iter);
+	totem_pl_playlist_set (data->playlist, &pl_iter,
+			       TOTEM_PL_PARSER_FIELD_URI, uri,
+			       TOTEM_PL_PARSER_FIELD_TITLE, title,
+			       NULL);
+	g_free (uri);
+
+	return FALSE;
 }
 
 /* this probably belongs more in totem than here */
@@ -120,11 +137,14 @@ save_playlist (RBGenericPlayerPlaylistSource *source)
 {
 	TotemPlParser *parser;
 	TotemPlParserType playlist_type;
+	TotemPlPlaylist *playlist;
 	RhythmDBQueryModel *query_model;
 	char *name;
 	char *temp_uri;
 	GError *error = NULL;
 	RBGenericPlayerPlaylistSourcePrivate *priv = GET_PRIVATE (source);
+	SavePlaylistData data;
+	GFile *file;
 
 	priv->save_playlist_id = 0;
 	playlist_type = rb_generic_player_source_get_playlist_format (priv->player_source);
@@ -174,41 +194,50 @@ save_playlist (RBGenericPlayerPlaylistSource *source)
 	}
 
 	temp_uri = g_strdup_printf ("%s%06X", priv->playlist_path, g_random_int_range (0, 0xFFFFFF));
+	file = g_file_new_for_path (temp_uri);
 
 	parser = totem_pl_parser_new ();
-	if (rb_debug_matches ("totem_pl_parser_write_with_title", "totem-pl-parser.c")) {
+	playlist = totem_pl_playlist_new ();
+
+	data.source = source;
+	data.playlist = playlist;
+
+	gtk_tree_model_foreach (GTK_TREE_MODEL (query_model),
+				save_playlist_foreach,
+				&data);
+
+	if (rb_debug_matches ("totem_pl_parser_save", "totem-pl-parser.c")) {
 		g_object_set (parser, "debug", TRUE, NULL);
 	}
-	if (totem_pl_parser_write_with_title (parser,
-					      GTK_TREE_MODEL (query_model),
-					      (TotemPlParserIterFunc) save_playlist_entry,
-					      temp_uri,
-					      name,
-					      playlist_type,
-					      source,
-					      &error) == FALSE) {
+
+	if (totem_pl_parser_save (parser,
+				  playlist,
+				  file,
+				  name,
+				  playlist_type,
+				  &error) == FALSE) {
 		/* XXX report this more usefully */
 		g_warning ("Playlist save failed: %s", error->message);
 	} else {
 		GFile *dest;
-		GFile *src;
 
 		dest = g_file_new_for_path (priv->playlist_path);
-		src = g_file_new_for_path (temp_uri);
-		g_file_move (src, dest, G_FILE_COPY_OVERWRITE | G_FILE_COPY_NO_FALLBACK_FOR_MOVE, NULL, NULL, NULL, &error);
+		g_file_move (file, dest, G_FILE_COPY_OVERWRITE | G_FILE_COPY_NO_FALLBACK_FOR_MOVE, NULL, NULL, NULL, &error);
 		if (error != NULL) {
 			/* XXX report this more usefully */
 			g_warning ("Replacing playlist failed: %s", error->message);
 		}
 
 		g_object_unref (dest);
-		g_object_unref (src);
 	}
 
 	g_clear_error (&error);
 	g_free (name);
 	g_free (temp_uri);
 	g_object_unref (query_model);
+	g_object_unref (playlist);
+	g_object_unref (parser);
+	g_object_unref (file);
 
 	return FALSE;
 }
diff --git a/sources/rb-playlist-source.c b/sources/rb-playlist-source.c
index 7b2bbc0..9d3fcbd 100644
--- a/sources/rb-playlist-source.c
+++ b/sources/rb-playlist-source.c
@@ -567,31 +567,31 @@ rb_playlist_source_drop_cb (GtkWidget *widget,
 	gtk_drag_finish (context, TRUE, FALSE, time);
 }
 
-static void
-playlist_iter_func (GtkTreeModel *model,
-		    GtkTreeIter *iter,
-		    char **uri,
-		    char **title,
-		    gboolean *custom_title,
-		    gpointer user_data)
+static gboolean
+playlist_iter_foreach (GtkTreeModel *model,
+		       GtkTreePath *path,
+		       GtkTreeIter *iter,
+		       gpointer user_data)
 {
+	TotemPlPlaylist *playlist = user_data;
+	TotemPlPlaylistIter pl_iter;
 	RhythmDBEntry *entry;
+	const gchar *uri;
 
 	gtk_tree_model_get (model, iter, 0, &entry, -1);
 
-	if (uri != NULL) {
-		*uri = rhythmdb_entry_dup_string (entry, RHYTHMDB_PROP_LOCATION);
-	}
-	if (title != NULL) {
-		*title = rhythmdb_entry_dup_string (entry, RHYTHMDB_PROP_TITLE);
-	}
-	if (custom_title != NULL) {
-		*custom_title = FALSE;
-	}
+	uri = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION);
+
+	totem_pl_playlist_append (playlist, &pl_iter);
+	totem_pl_playlist_set (playlist, &pl_iter,
+			       TOTEM_PL_PARSER_FIELD_URI, uri,
+			       NULL);
 
 	if (entry != NULL) {
 		rhythmdb_entry_unref (entry);
 	}
+
+	return FALSE;
 }
 
 /**
@@ -608,15 +608,19 @@ rb_playlist_source_save_playlist (RBPlaylistSource *source,
 				  const char *uri,
 				  RBPlaylistExportType export_type)
 {
-	TotemPlParser *playlist;
+	TotemPlParser *pl;
+	TotemPlPlaylist *playlist;
 	GError *error = NULL;
+	GFile *file;
 	char *name;
 	gint totem_format;
 
 	g_return_if_fail (RB_IS_PLAYLIST_SOURCE (source));
 
 	rb_debug ("saving playlist");
-	playlist = totem_pl_parser_new ();
+	pl = totem_pl_parser_new ();
+	playlist = totem_pl_playlist_new ();
+	file = g_file_new_for_uri (uri);
 
 	g_object_get (source, "name", &name, NULL);
 
@@ -633,12 +637,18 @@ rb_playlist_source_save_playlist (RBPlaylistSource *source,
 		break;
 	}
 
-	totem_pl_parser_write_with_title (playlist, GTK_TREE_MODEL (source->priv->model),
-					  playlist_iter_func, uri, name,
-					  totem_format,
-					  NULL, &error);
+	gtk_tree_model_foreach (GTK_TREE_MODEL (source->priv->model),
+				playlist_iter_foreach,
+				playlist);
+
+	totem_pl_parser_save (pl, playlist, file, name,
+			      totem_format, &error);
+
+	g_object_unref (pl);
 	g_object_unref (playlist);
+	g_object_unref (file);
 	g_free (name);
+
 	if (error != NULL) {
 		rb_error_dialog (NULL, _("Couldn't save playlist"),
 				 "%s", error->message);
-- 
1.6.6



Index: rhythmbox.spec
===================================================================
RCS file: /cvs/pkgs/rpms/rhythmbox/devel/rhythmbox.spec,v
retrieving revision 1.283
retrieving revision 1.284
diff -u -p -r1.283 -r1.284
--- rhythmbox.spec	6 Jan 2010 14:03:44 -0000	1.283
+++ rhythmbox.spec	26 Jan 2010 14:45:15 -0000	1.284
@@ -3,7 +3,7 @@
 Name: rhythmbox
 Summary: Music Management Application
 Version: 0.12.6
-Release: 6%{?dist}
+Release: 7%{?dist}
 License: GPLv2+ with exceptions and GFDL
 Group: Applications/Multimedia
 URL: http://projects.gnome.org/rhythmbox/
@@ -60,6 +60,8 @@ Patch2: 0001-Fix-crasher-when-MusicBrain
 # https://bugzilla.gnome.org/show_bug.cgi?id=601524
 # https://bugzilla.gnome.org/show_bug.cgi?id=602957
 Patch3: rb-playbin2-track-changes.patch
+# https://bugzilla.gnome.org/show_bug.cgi?id=605313
+Patch4: 0001-Use-totem_pl_parser_save-for-playlist-saving.patch
 
 %description
 Rhythmbox is an integrated music management application based on the powerful
@@ -97,6 +99,7 @@ from, and sending media to UPnP/DLNA net
 %patch1 -p1 -b .webkit
 %patch2 -p1 -b .mb-crasher
 %patch3 -p1 -b .track-change-hang
+%patch4 -p1 -b .plparser
 
 # Use the installed louie, not the one in Coherence
 find plugins/coherence/upnp_coherence/ -type f -exec sed -i 's/coherence.extern.louie as louie/louie/' '{}' ';'
@@ -231,6 +234,9 @@ fi
 %{_libdir}/rhythmbox/plugins/upnp_coherence
 
 %changelog
+* Tue Jan 26 2010 Bastien Nocera <bnocera at redhat.com> 0.12.6-7
+- Rebuild for new totem-pl-parser
+
 * Wed Jan 06 2010 Bastien Nocera <bnocera at redhat.com> 0.12.6-6
 - Add patches from F-12
 



More information about the scm-commits mailing list