[gnome-music] Do not pad minutes with zeroes in duration
- From: Vadim Rutkovsky <vrutkovsky src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music] Do not pad minutes with zeroes in duration
- Date: Wed, 8 May 2013 11:09:34 +0000 (UTC)
commit 809b2c60e3f8dcabf34b5e10ebcaf951a31d3f97
Author: Guillaume Quintard <guillaume quintard gmail com>
Date: Wed May 8 13:09:04 2013 +0200
Do not pad minutes with zeroes in duration
Fixes bug 699616
src/player.js | 2 +-
src/widgets.js | 12 +++---------
2 files changed, 4 insertions(+), 10 deletions(-)
---
diff --git a/src/player.js b/src/player.js
index 2da9197..496c17a 100644
--- a/src/player.js
+++ b/src/player.js
@@ -305,7 +305,7 @@ const Player = new Lang.Class({
var minutes = parseInt( duration / 60 ) % 60;
var seconds = duration % 60;
- return (minutes < 10 ? "0" + minutes : minutes) + ":" + (seconds < 10 ? "0" + seconds : seconds);
+ return minutes + ":" + (seconds < 10 ? "0" + seconds : seconds);
},
_onPlayBtnClicked: function(btn) {
diff --git a/src/widgets.js b/src/widgets.js
index 106ad83..56a0fc2 100644
--- a/src/widgets.js
+++ b/src/widgets.js
@@ -131,15 +131,9 @@ const AlbumWidget = new Lang.Class({
function(col, cell, model, iter) {
let item = model.get_value(iter, 5);
let duration = item.get_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;
+ if (!item)
+ return;
+ durationRenderer.text = this.player.secondsToString(duration);
}));
},
update: function (artist, album, item) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]