[totem/improve-time-period-stringification] properties: Improve how we print time periods
- From: Matthew Leeds <mwleeds src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem/improve-time-period-stringification] properties: Improve how we print time periods
- Date: Sat, 15 Feb 2020 00:44:26 +0000 (UTC)
commit f7b78c4e8d20ac501b55688be5c11c58e2eb02eb
Author: Matthew Leeds <matthew leeds endlessm com>
Date: Fri Feb 14 16:42:40 2020 -0800
properties: Improve how we print time periods
Print e.g. "2 minutes" instead of "2 minutes 0 seconds".
.../properties/bacon-video-widget-properties.c | 23 ++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
---
diff --git a/src/plugins/properties/bacon-video-widget-properties.c
b/src/plugins/properties/bacon-video-widget-properties.c
index cebf39450..382dccf5e 100644
--- a/src/plugins/properties/bacon-video-widget-properties.c
+++ b/src/plugins/properties/bacon-video-widget-properties.c
@@ -159,11 +159,26 @@ time_to_string_text (gint64 msecs)
if (hour > 0)
{
- /* 5 hours 2 minutes 12 seconds */
- string = g_strdup_printf (C_("time", "%s %s %s"), hours, mins, secs);
+ if (min > 0 && sec > 0)
+ {
+ /* 5 hours 2 minutes 12 seconds */
+ string = g_strdup_printf (C_("time", "%s %s %s"), hours, mins, secs);
+ } else if (min > 0) {
+ /* 5 hours 2 minutes */
+ string = g_strdup_printf (C_("time", "%s %s"), hours, mins);
+ } else {
+ /* 5 hours */
+ string = g_strdup_printf (C_("time", "%s"), hours);
+ }
} else if (min > 0) {
- /* 2 minutes 12 seconds */
- string = g_strdup_printf (C_("time", "%s %s"), mins, secs);
+ if (sec > 0)
+ {
+ /* 2 minutes 12 seconds */
+ string = g_strdup_printf (C_("time", "%s %s"), mins, secs);
+ } else {
+ /* 2 minutes */
+ string = g_strdup_printf (C_("time", "%s"), mins);
+ }
} else if (sec > 0) {
/* 10 seconds */
string = g_strdup (secs);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]