? =
? b
? bug-23368-integrated-ripping.diff
? bug325034.diff
? bug338561.diff
? bug338562.diff
? burner.Diff
? burner.diff
? burner.diuff
? conf11657.file
? detect.diff
? eject-rename.diff
? hashtable.dif
? interdiff.diff
? ipod-plugins.diff
? ipod-todo.txt
? ipod-write.diff
? malloc-overflows.diff
? move-to-trash.didd
? move-to-trash.diff
? patch.diff
? playbin.diff
? playlist.diff
? queue-set.diff
? rb-ipod-source-libgpod.diff
? rb-recorder-gst.diff
? rhythmbox-audioscrobbler-libsoup-new-files.tar.bz2
? rhythmbox-gpod.diff
? show_bug.cgi?id=338443
? treeview.diff
? plugins/ipod
? remote/dbus/rb-remote-dbus.loT
? sources/rb-audioscrobbler.c
? sources/rb-library-source.diff
Index: sources/rb-ipod-source.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/sources/rb-ipod-source.c,v
retrieving revision 1.41
diff -u -r1.41 rb-ipod-source.c
--- sources/rb-ipod-source.c	16 Apr 2006 10:53:27 -0000	1.41
+++ sources/rb-ipod-source.c	16 Apr 2006 10:55:48 -0000
@@ -68,6 +68,7 @@
 {
 	Itdb_iTunesDB *ipod_db;
 	gchar *ipod_mount_path;
+	GHashTable *entry_map;
 	GtkActionGroup *action_group;	
 } RBiPodSourcePrivate;
 
@@ -184,6 +185,11 @@
 		priv->ipod_mount_path = NULL;
 	}
 
+	if (priv->entry_map) {
+		g_hash_table_destroy (priv->entry_map);
+		priv->entry_map = NULL;
+ 	}
+
 	G_OBJECT_CLASS (rb_ipod_source_parent_class)->dispose (object);
 }
 
@@ -448,7 +454,10 @@
 		
 	entry_set_string_prop (RHYTHMDB (db), entry, 
 			       RHYTHMDB_PROP_GENRE, song->genre);
-		
+
+
+	g_hash_table_insert (priv->entry_map, entry, song);
+
 	rhythmdb_commit (RHYTHMDB (db));
 }
 
@@ -485,7 +494,8 @@
 	priv->ipod_mount_path = rb_ipod_get_mount_path (volume);
 
  	priv->ipod_db = itdb_parse (priv->ipod_mount_path, NULL);
-	if (priv->ipod_db != NULL) {
+	priv->entry_map = g_hash_table_new (g_direct_hash, g_direct_equal);
+	if ((priv->ipod_db != NULL) && (priv->entry_map != NULL)) {
 		/* FIXME: we could set a different icon depending on the iPod
 		 * model
 		 */
@@ -692,37 +702,6 @@
 	return TRUE;
 }
 
-static Itdb_Track *
-itdb_track_find_by_uri (Itdb_iTunesDB *ipod_db, const char *uri)
-{
-	GList *it;
-
-	/* FIXME: if RhythmDBEntry had a few opaque pointers that can be set by
-	 * specific source, we could stick a pointer to the Itdb_Track there 
-	 * and avoid all this work 
-	 */
-	for (it = ipod_db->tracks; it != NULL; it = it->next) {
-		Itdb_Track *track;
-		gchar *ipod_uri;
-		gboolean matches;
-
-		track = (Itdb_Track *)it->data;
-		ipod_uri = ipod_path_to_uri (itdb_get_mountpoint (ipod_db), 
-					     track->ipod_path);
-		matches = (strcmp (ipod_uri, uri) == 0);
-
-		g_free (ipod_uri);
-		if (matches) {
-			break;
-		}
-	}
-
-	if (it != NULL) {
-		return (Itdb_Track *)it->data;
-	} 
-
-	return NULL;
-}
 
 static void
 remove_track_from_db (Itdb_Track *track)
@@ -759,7 +738,7 @@
 		entry = (RhythmDBEntry *)tem->data;
 		uri = rhythmdb_entry_get_string (entry, 
 						 RHYTHMDB_PROP_LOCATION);
-		track = itdb_track_find_by_uri (priv->ipod_db, uri);
+		track = g_hash_table_lookup (priv->entry_map, entry);
 		if (track == NULL) {
 			g_warning ("Couldn't find track on ipod! (%s)", uri);
 			continue;
