Index: src/HipoMainWindow.cs
===================================================================
--- src/HipoMainWindow.cs	(revision 115)
+++ src/HipoMainWindow.cs	(working copy)
@@ -861,41 +861,113 @@
 		
 		private void OnTrackProperties (object o, EventArgs args)
 		{
-			if (tracksView.Selection.CountSelectedRows() > 1)
-				return;
-
 			Glade.XML xml = new Glade.XML (null, "hipo.glade", "trackProperties", null);
 			xml.Autoconnect (this);
 
 			bool modified = false;
-			Track track = null;
-			TreeIter iter;
 			TreeModel model;
 			Gdk.Pixbuf newCover = null;
+			string artist = "";
+			string album = "";
+			string title = "";
+			string genre = "";
+			int trackNumber = 0;
+			Gdk.Pixbuf image = null;
 			
-			Array treePaths = tracksView.Selection.GetSelectedRows (out model);
-
-			if (model.GetIter (out iter, (Gtk.TreePath) treePaths.GetValue(0)))
+			/*
+			This way of doing things seems rather ugly to me (bgarret), as the conversion
+			TreeIter -> trackId -> track is done every time I iterate over the treePaths ArrayList.
+			*/
+			
+			ArrayList treePaths = ArrayList.Adapter (tracksView.Selection.GetSelectedRows (out model));
+			ArrayList treeIters = new ArrayList ();
+			
+			foreach (TreePath treePath in treePaths)
 			{
-				long trackId = (long) model.GetValue (iter, 4);
+				TreeIter iter;
+				if (model.GetIter (out iter, treePath))
+				{
+					treeIters.Add (iter);
+				}
+			}
+			
+			if (treeIters.Count > 0)
+			{
+				foreach (TreeIter iter in treeIters)
+				{
+					long trackId = (long) model.GetValue (iter, 4);
+					Track track = tracks.GetTrackbyId (this.db, trackId);
 				
-				track = tracks.GetTrackbyId (this.db, trackId);
-				/* artist name and track title properties */
-				trackProperties.Title = String.Format (Catalog.GetString ("{0} {1} Properties"),
-								       track.Artist, track.Title);
-				artistEntry.Text = track.Artist;
-				albumEntry.Text = track.Album;
-				titleEntry.Text = track.Title;
-				genreEntry.Text = track.Genre;
-				numberSpin.Value = track.TrackNumber;
-				
-				foreach (ArtworkFormat format in this.device.LookupArtworkFormats (ArtworkUsage.Cover)) {
+					/*
+					The values are filled in with the properties of the first track of the list.
+					A comparison is made with the subsequent tracks,
+					if the values are the same, nothing is changed,
+					if they are different, a blank value is put
+					*/
+					
+					if (treeIters.IndexOf (iter) == 0)
+					{
+						artist = track.Artist;
+						album = track.Album;
+						title = track.Title;
+						genre = track.Genre;
+						trackNumber = track.TrackNumber;
+						
+						foreach (ArtworkFormat format in this.device.LookupArtworkFormats (ArtworkUsage.Cover)) {
 
-					if (format != null) {
-						if (track.HasCoverArt (format)) 
-							artwork.FromPixbuf = ArtworkHelpers.ToPixbuf (format, track.GetCoverArt (format));
+							if (format != null) {
+								if (track.HasCoverArt (format)) 
+									image = ArtworkHelpers.ToPixbuf (format, track.GetCoverArt (format));
+							}
+						}
+						
+						if (treeIters.Count == 1)
+						{
+							/* artist name and track title properties */
+							trackProperties.Title = String.Format (Catalog.GetString ("{0} {1} Properties"),
+											       track.Artist, track.Title);
+						}
+						else
+						{
+							trackProperties.Title = Catalog.GetString ("Multiple tracks properties");
+						}
 					}
+					else
+					{
+						if (!artist.Equals("") && !artist.Equals (track.Artist))
+							artist = "";
+						
+						if (!album.Equals("") && !album.Equals (track.Album))
+							album = "";
+						
+						if (!title.Equals("") && !title.Equals (track.Title))
+							title = "";
+						
+						if (!genre.Equals("") && !genre.Equals (track.Genre))
+							genre = "";
+						
+						if ((trackNumber != 0) && (trackNumber != track.TrackNumber))
+							trackNumber = 0;
+						
+						if (image != null)
+						{
+							foreach (ArtworkFormat format in this.device.LookupArtworkFormats (ArtworkUsage.Cover)) {
+
+								if (format != null) {
+									if (track.HasCoverArt (format) && !(image.Equals (ArtworkHelpers.ToPixbuf (format, track.GetCoverArt (format))))) 
+										image = null;
+								}
+							}
+						}
+					}
 				}
+				
+				artistEntry.Text = artist;
+				albumEntry.Text = album;
+				titleEntry.Text = title;
+				genreEntry.Text = genre;
+				numberSpin.Value = trackNumber;
+				artwork.FromPixbuf = image;
 			}
 
 			openArtwork.Clicked += delegate {
@@ -932,30 +1004,55 @@
 			ResponseType response = (ResponseType) trackProperties.Run ();
 				
 			if (response == ResponseType.Ok)
-			{			
-				if (artistEntry.Text != track.Artist) {
+			{
+				if (artistEntry.Text != artist) {
 					modified = true;
-					track.Artist = artistEntry.Text;
+					foreach (TreeIter iter in treeIters)
+					{
+						long trackId = (long) model.GetValue (iter, 4);
+						Track track = tracks.GetTrackbyId (this.db, trackId);
+						track.Artist = artistEntry.Text;
+					}
 				}
 
-				if (albumEntry.Text != track.Album) {
+				if (albumEntry.Text != album) {
 					modified = true;
-					track.Album = albumEntry.Text;
+					foreach (TreeIter iter in treeIters)
+					{
+						long trackId = (long) model.GetValue (iter, 4);
+						Track track = tracks.GetTrackbyId (this.db, trackId);
+						track.Album = albumEntry.Text;
+					}
 				}
 
-				if (titleEntry.Text != track.Title) {
+				if (titleEntry.Text != title) {
 					modified = true;
-					track.Title = titleEntry.Text;
+					foreach (TreeIter iter in treeIters)
+					{
+						long trackId = (long) model.GetValue (iter, 4);
+						Track track = tracks.GetTrackbyId (this.db, trackId);
+						track.Title = titleEntry.Text;
+					}
 				}
 
-				if (genreEntry.Text != track.Genre) {
+				if (genreEntry.Text != genre) {
 					modified = true;
-					track.Genre = genreEntry.Text;
+					foreach (TreeIter iter in treeIters)
+					{
+						long trackId = (long) model.GetValue (iter, 4);
+						Track track = tracks.GetTrackbyId (this.db, trackId);
+						track.Genre = genreEntry.Text;
+					}
 				}
 
-				if (numberSpin.Value != track.TrackNumber) {
+				if (numberSpin.Value != trackNumber) {
 					modified = true;
-					track.TrackNumber = (int) numberSpin.Value;
+					foreach (TreeIter iter in treeIters)
+					{
+						long trackId = (long) model.GetValue (iter, 4);
+						Track track = tracks.GetTrackbyId (this.db, trackId);
+						track.TrackNumber = (int) numberSpin.Value;
+					}
 				}
 
 				if (newCover != null) {
@@ -965,7 +1062,12 @@
 						// maybe is a good idea to set all the album of the current selected track with the new cover.
 						// we can set this on a gconf key.
 						
-						track.SetCoverArt (format, ArtworkHelpers.ToBytes (format, newCover));
+						foreach (TreeIter iter in treeIters)
+						{
+							long trackId = (long) model.GetValue (iter, 4);
+							Track track = tracks.GetTrackbyId (this.db, trackId);
+							track.SetCoverArt (format, ArtworkHelpers.ToBytes (format, newCover));
+						}
 					}
 					
 					modified = true;
@@ -973,7 +1075,12 @@
 			}
 
 			if (modified) {
-				tracks.UpdateStore (track, iter);
+				foreach (TreeIter iter in treeIters)
+					{
+						long trackId = (long) model.GetValue (iter, 4);
+						Track track = tracks.GetTrackbyId (this.db, trackId);
+						tracks.UpdateStore (track, iter);
+				}
 				
 				Thread thr = new Thread (new ThreadStart (SaveDB));
 				thr.Start ();
