[totem/wip/hadess/precise-stepping: 5/7] gst: Move unknown time special-case to helper function
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem/wip/hadess/precise-stepping: 5/7] gst: Move unknown time special-case to helper function
- Date: Thu, 17 Feb 2022 20:49:07 +0000 (UTC)
commit b19e09c76232ca9f03e14a765306e3af40a8c280
Author: Bastien Nocera <hadess hadess net>
Date: Thu Feb 17 21:37:46 2022 +0100
gst: Move unknown time special-case to helper function
This way, no translations left to be done in the time label widget.
po/POTFILES.in | 1 -
src/backend/bacon-time-label.c | 13 +++----------
src/gst/totem-time-helpers.c | 5 ++++-
3 files changed, 7 insertions(+), 12 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index db9973a19..d60bb7510 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -8,7 +8,6 @@ data/totem-preferences-dialog.ui
data/shortcuts.ui
data/totem.ui
data/uri.ui
-src/backend/bacon-time-label.c
src/backend/bacon-video-widget.c
src/backend/bacon-video-widget-gst-missing-plugins.c
src/gst/totem-time-helpers.c
diff --git a/src/backend/bacon-time-label.c b/src/backend/bacon-time-label.c
index a10e4da78..310a86181 100644
--- a/src/backend/bacon-time-label.c
+++ b/src/backend/bacon-time-label.c
@@ -110,17 +110,10 @@ update_label_text (BaconTimeLabel *label)
if (length > 60 * 60 * 1000)
flags |= TOTEM_TIME_FLAG_FORCE_HOUR;
- if (length <= 0 ||
- _time > length) {
- if (!label->remaining) {
- label_str = totem_time_to_string (_time, flags);
- } else {
- /* translators: Unknown remaining time */
- label_str = g_strdup (_("--:--"));
- }
- } else {
+ if (length <= 0 || _time > length)
+ label_str = totem_time_to_string (label->remaining ? -1 : _time, flags);
+ else
label_str = totem_time_to_string (label->remaining ? length - _time : _time, flags);
- }
gtk_label_set_text (GTK_LABEL (label), label_str);
}
diff --git a/src/gst/totem-time-helpers.c b/src/gst/totem-time-helpers.c
index 3af9dd0e0..7e6e68461 100644
--- a/src/gst/totem-time-helpers.c
+++ b/src/gst/totem-time-helpers.c
@@ -40,7 +40,10 @@ totem_time_to_string (gint64 msecs,
int sec, min, hour, _time;
double time_f;
- g_return_val_if_fail (msecs >= 0, NULL);
+ if (msecs <= 0) {
+ /* translators: Unknown time */
+ return g_strdup (_("--:--"));
+ }
/* When calculating the remaining time,
* we want to make sure that:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]