banshee r4385 - in trunk/banshee: . src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs src/Libraries/Hyena/Hyena
- From: ahixon svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r4385 - in trunk/banshee: . src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs src/Libraries/Hyena/Hyena
- Date: Fri, 15 Aug 2008 22:30:23 +0000 (UTC)
Author: ahixon
Date: Fri Aug 15 22:30:23 2008
New Revision: 4385
URL: http://svn.gnome.org/viewvc/banshee?rev=4385&view=rev
Log:
2008-08-16 Alexander Hixon <hixon alexander mediati org>
* src/Libraries/Hyena/Hyena/DateTimeUtil.cs:
* src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/TrackEditor.cs: Enable
the track editor to display the duration of tracks one hour or longer
correctly. Adds some overloaded FormatDuration methods. Fixes BGO #537774.
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/TrackEditor.cs
trunk/banshee/src/Libraries/Hyena/Hyena/DateTimeUtil.cs
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/TrackEditor.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/TrackEditor.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/TrackEditor.cs Fri Aug 15 22:30:23 2008
@@ -44,6 +44,7 @@
using Banshee.Sources;
using Banshee.Collection.Database;
+using Hyena;
using Hyena.Gui;
using Hyena.Widgets;
@@ -311,8 +312,7 @@
(Glade["Title"] as Entry).Text = track.TrackTitle;
(Glade["Genre"] as ComboBoxEntry).Entry.Text = track.Genre;
- (Glade["DurationLabel"] as Label).Text = String.Format ("{0}:{1}",
- track.Track.Duration.Minutes, (track.Track.Duration.Seconds).ToString ("00"));
+ (Glade["DurationLabel"] as Label).Text = DateTimeUtil.FormatDuration (track.Track.Duration);
(Glade["PlayCountLabel"] as Label).Text = track.Track.PlayCount.ToString ();
(Glade["LastPlayedLabel"] as Label).Text = track.Track.LastPlayed == DateTime.MinValue ?
Catalog.GetString ("Never played") : track.Track.LastPlayed.ToString ();
Modified: trunk/banshee/src/Libraries/Hyena/Hyena/DateTimeUtil.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena/Hyena/DateTimeUtil.cs (original)
+++ trunk/banshee/src/Libraries/Hyena/Hyena/DateTimeUtil.cs Fri Aug 15 22:30:23 2008
@@ -56,9 +56,17 @@
}
public static string FormatDuration (long time) {
- return (time > 3600 ?
- String.Format ("{0}:{1:00}:{2:00}", time / 3600, (time / 60) % 60, time % 60) :
- String.Format ("{0}:{1:00}", time / 60, time % 60));
+ return FormatDuration (TimeSpan.FromSeconds (time));
+ }
+
+ public static string FormatDuration (TimeSpan time) {
+ return FormatDuration (time.Hours, time.Minutes, time.Seconds);
+ }
+
+ public static string FormatDuration (int hours, int minutes, int seconds) {
+ return (hours > 0 ?
+ String.Format ("{0}:{1:00}:{2:00}", hours, minutes, seconds) :
+ String.Format ("{0}:{1:00}", minutes, seconds));
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]