[gnome-sound-recorder] row: move duration label on right
- From: Bilal Elmoussaoui <bilelmoussaoui src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-sound-recorder] row: move duration label on right
- Date: Fri, 29 May 2020 11:32:03 +0000 (UTC)
commit 515df8c119919f1bd095678f0b1fd290de4c5cd6
Author: Kavan Mevada <kavanmevada gmail com>
Date: Fri May 29 16:30:03 2020 +0530
row: move duration label on right
data/ui/row.ui | 11 +++++++++++
src/row.js | 6 +++---
src/utils.js | 11 ++---------
3 files changed, 16 insertions(+), 12 deletions(-)
---
diff --git a/data/ui/row.ui b/data/ui/row.ui
index 81d6052..fb193c8 100644
--- a/data/ui/row.ui
+++ b/data/ui/row.ui
@@ -72,6 +72,17 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
+ <child>
+ <object class="GtkLabel" id="duration">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="valign">start</property>
+ <property name="margin_top">8</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ </child>
<style>
<class name="header"/>
</style>
diff --git a/src/row.js b/src/row.js
index e846553..275ccf8 100644
--- a/src/row.js
+++ b/src/row.js
@@ -10,7 +10,7 @@ var RowState = {
var Row = GObject.registerClass({ // eslint-disable-line no-unused-vars
Template: 'resource:///org/gnome/SoundRecorder/ui/row.ui',
- InternalChildren: ['playbackStack', 'action_row', 'playButton', 'pauseButton'],
+ InternalChildren: ['playbackStack', 'action_row', 'playButton', 'pauseButton', 'duration'],
Signals: {
'play': { param_types: [GObject.TYPE_STRING] },
'pause': {},
@@ -21,11 +21,11 @@ var Row = GObject.registerClass({ // eslint-disable-line no-unused-vars
super._init({});
this._action_row.title = recording.name;
- const recordTime = Utils.Time.getDisplayTime(
+ this._action_row.subtitle = Utils.Time.getDisplayTime(
recording.timeCreated > 0 ? recording.timeCreated : recording.timeModified);
recording.connect('notify::duration', () => {
- this._action_row.subtitle = `${Utils.Time.formatTime(recording.duration)} • ${recordTime}`;
+ this._duration.label = Utils.Time.formatTime(recording.duration);
});
this._playButton.connect('clicked', () => {
diff --git a/src/utils.js b/src/utils.js
index 66529a9..912a5d4 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -28,17 +28,10 @@ var Time = { // eslint-disable-line no-unused-vars
formatTime: unformattedTime => {
this.unformattedTime = unformattedTime;
let seconds = Math.floor(this.unformattedTime);
- let hours = parseInt(seconds / Math.pow(_TIME_DIVISOR, 2));
- let hoursString = '';
-
- if (hours > 10)
- hoursString = `${hours}:`;
- else if (hours < 10 && hours > 0)
- hoursString = `0${hours}:`;
-
+ let hoursString = parseInt(seconds / Math.pow(_TIME_DIVISOR, 2));
let minuteString = parseInt(seconds / _TIME_DIVISOR) % _TIME_DIVISOR;
let secondString = parseInt(seconds % _TIME_DIVISOR);
- let timeString = `${hoursString + (minuteString < 10 ? `0${minuteString}` :
minuteString)}:${secondString < 10 ? `0${secondString}` : secondString}`;
+ let timeString = `${hoursString < 10 ? `0${hoursString}` : hoursString}:${minuteString < 10 ?
`0${minuteString}` : minuteString}:${secondString < 10 ? `0${secondString}` : secondString}`;
return timeString;
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]