[banshee] [PlayQueue] Fix items count, size and duration
- From: Alexander Kojevnikov <alexk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] [PlayQueue] Fix items count, size and duration
- Date: Mon, 8 Mar 2010 10:23:34 +0000 (UTC)
commit ff17b5e7b845eba18e1bbaf604134a0f4eee449a
Author: Alex Launi <alex launi gmail com>
Date: Mon Mar 8 21:18:11 2010 +1100
[PlayQueue] Fix items count, size and duration
The source view and the status bar now ignore already played
(greyed out) tracks when showing aggregated info (bgo#612153)
Signed-off-by: Alexander Kojevnikov <alexander kojevnikov com>
.../DatabaseTrackListModel.cs | 4 +-
.../Banshee.Services/Banshee.Sources/Source.cs | 4 +++
.../Banshee.Sources.Gui/SourceRowRenderer.cs | 4 +-
.../Banshee.PlayQueue/PlayQueueSource.cs | 12 +++++++++
.../Banshee.PlayQueue/PlayQueueTrackListModel.cs | 26 ++++++++++++++++++++
5 files changed, 46 insertions(+), 4 deletions(-)
---
diff --git a/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackListModel.cs b/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackListModel.cs
index b5bfd80..617c373 100644
--- a/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackListModel.cs
+++ b/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackListModel.cs
@@ -398,11 +398,11 @@ namespace Banshee.Collection.Database
get { return (int) filtered_count; }
}
- public TimeSpan Duration {
+ public virtual TimeSpan Duration {
get { return filtered_duration; }
}
- public long FileSize {
+ public virtual long FileSize {
get { return filtered_filesize; }
}
diff --git a/src/Core/Banshee.Services/Banshee.Sources/Source.cs b/src/Core/Banshee.Services/Banshee.Sources/Source.cs
index efccba7..6705973 100644
--- a/src/Core/Banshee.Services/Banshee.Sources/Source.cs
+++ b/src/Core/Banshee.Services/Banshee.Sources/Source.cs
@@ -636,6 +636,10 @@ namespace Banshee.Sources
get { return 0; }
}
+ public virtual int EnabledCount {
+ get { return Count; }
+ }
+
private string parent_conf_id;
public string ParentConfigurationId {
get {
diff --git a/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceRowRenderer.cs b/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceRowRenderer.cs
index 2c048be..c578c36 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceRowRenderer.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceRowRenderer.cs
@@ -149,7 +149,7 @@ namespace Banshee.Sources.Gui
int count_layout_width = 0, count_layout_height = 0;
int max_title_layout_width;
- bool hide_counts = source.Count <= 0;
+ bool hide_counts = source.EnabledCount <= 0;
Pixbuf icon = SourceIconResolver.ResolveIcon (source, RowHeight);
@@ -185,7 +185,7 @@ namespace Banshee.Sources.Gui
if (!hide_counts) {
count_layout = new Pango.Layout (widget.PangoContext);
count_layout.FontDescription = fd;
- count_layout.SetMarkup (String.Format ("<span size=\"small\">{0}</span>", source.Count));
+ count_layout.SetMarkup (String.Format ("<span size=\"small\">{0}</span>", source.EnabledCount));
count_layout.GetPixelSize (out count_layout_width, out count_layout_height);
}
diff --git a/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs b/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs
index 641d9da..9a9a78b 100644
--- a/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs
+++ b/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs
@@ -754,6 +754,18 @@ namespace Banshee.PlayQueue
}
}
+ public override int EnabledCount {
+ get {
+ return current_track == null ? 0 : Count - TrackModel.IndexOf (current_track);
+ }
+ }
+
+ public override int FilteredCount {
+ get {
+ return EnabledCount;
+ }
+ }
+
public override bool CanRename {
get { return false; }
}
diff --git a/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueTrackListModel.cs b/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueTrackListModel.cs
index 8bf70a0..90e2e32 100644
--- a/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueTrackListModel.cs
+++ b/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueTrackListModel.cs
@@ -46,6 +46,32 @@ namespace Banshee.PlayQueue
this.source = source;
}
+ public override TimeSpan Duration {
+ get {
+ TimeSpan duration = new TimeSpan (0);
+ for (int i = 0; i < this.Count; i++) {
+ TrackInfo track = this[i];
+ if (track != null && track.Enabled) {
+ duration += track.Duration;
+ }
+ }
+ return duration;
+ }
+ }
+
+ public override long FileSize {
+ get {
+ long filesize = 0;
+ for (int i = 0; i < this.Count; i++) {
+ TrackInfo track = this[i];
+ if (track != null && track.Enabled) {
+ filesize += track.FileSize;
+ }
+ }
+ return filesize;
+ }
+ }
+
public override TrackInfo this[int index] {
get {
lock (this) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]