[Banshee-List] Track dictionary in TrackListDatabaseModel
- From: LCID Fire <lcid-fire gmx net>
- To: banshee-list gnome org
- Subject: [Banshee-List] Track dictionary in TrackListDatabaseModel
- Date: Sat, 05 Jan 2008 12:33:22 +0100
I was looking into TrackListDatabaseModel and wondered why the tracks
are managed in a Dictionary?
Currently it's defined like:
private Dictionary<int, LibraryTrackInfo> tracks = new Dictionary<int,
LibraryTrackInfo>();
the key is used to determine whether a certain index is already read:
if(tracks.ContainsKey(index)) {
I'd say it would make more sense to have this as a list:
private List<LibraryTrackInfo> tracks = new List<LibraryTrackInfo>();
determining would then work like:
if(index < tracks.Count && tracks[index] != null) {
and of course instead of adding the read TrackInfos have to be
inserted/replaced.
That should do the trick, make the code easier to understand and more
performant.
BTW: Are you sure the locking works fine this way?
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]