[gnome-music] The initial 0 is redundant when a track is less than 10 minutes long, so it should be stripped.



commit 3e783ce47a780515bddb56f898a6084b94924922
Author: Seif Lotfy <seif lotfy com>
Date:   Wed May 8 12:49:07 2013 +0200

    The initial 0 is redundant when a track is less than 10 minutes long,
    so it should be stripped.
    
    fixes #699616

 src/widgets.js |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/src/widgets.js b/src/widgets.js
index 56a0fc2..106ad83 100644
--- a/src/widgets.js
+++ b/src/widgets.js
@@ -131,9 +131,15 @@ const AlbumWidget = new Lang.Class({
             function(col, cell, model, iter) {
                 let item = model.get_value(iter, 5);
                 let duration = item.get_duration ();
-                if (!item)
-                    return;
-                durationRenderer.text = this.player.secondsToString(duration);
+                var minutes = parseInt(duration / 60);
+                var seconds = duration % 60;
+                var time = null
+                if (seconds < 10)
+                    time =  minutes + ":0" + seconds;
+                else
+                    time = minutes + ":" + seconds;
+                durationRenderer.set_property("xalign", 1.0);
+                durationRenderer.text = time;
             }));
     },
     update: function (artist, album, item) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]