sound-juicer r2431 - in trunk: . src



Author: rburton
Date: Tue Feb 10 21:22:32 2009
New Revision: 2431
URL: http://svn.gnome.org/viewvc/sound-juicer?rev=2431&view=rev

Log:
2009-02-10  Ross Burton  <ross linux intel com>

	* src/sj-main.c:
	Remove musicbrainz data if the album artist and title are
	edited (#566431).


Modified:
   trunk/ChangeLog
   trunk/src/sj-main.c

Modified: trunk/src/sj-main.c
==============================================================================
--- trunk/src/sj-main.c	(original)
+++ trunk/src/sj-main.c	Tue Feb 10 21:22:32 2009
@@ -1355,11 +1355,44 @@
   }
   g_free (artist);
   g_free (title);
+
   return;
 }
 
+/*
+ * Remove all of the data which is intrinsic to the album being correctly
+ * detected, such as MusicBrainz IDs, ASIN, and Wikipedia links.
+ */
+static void
+remove_musicbrainz_ids (AlbumDetails *album)
+{
+  GList *l;
+#define UNSET(id) g_free (album->id);           \
+  album->id = NULL;
+
+  UNSET (album_id);
+  UNSET (artist_id);
+  UNSET (asin);
+  UNSET (discogs);
+  UNSET (wikipedia);
+#undef UNSET
+
+#define UNSET(id) g_free (track->id);           \
+  track->id = NULL;
+
+  for (l = album->tracks; l; l = l->next) {
+    TrackDetails *track = l->data;
+    UNSET (track_id);
+    UNSET (artist_id);
+  }
+#undef UNSET
+}
+
 void on_title_edit_changed(GtkEditable *widget, gpointer user_data) {
   g_return_if_fail (current_album != NULL);
+
+  remove_musicbrainz_ids (current_album);
+
   if (current_album->title) {
     g_free (current_album->title);
   }
@@ -1373,6 +1406,8 @@
 
   g_return_if_fail (current_album != NULL);
 
+  remove_musicbrainz_ids (current_album);
+
   /* Unset the sortable artist field, as we can't change it automatically */
   if (current_album->artist_sortname) {
     g_free (current_album->artist_sortname);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]