summaryrefslogtreecommitdiff
path: root/src/gst/totem-time-helpers.c
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2013-03-28 17:20:20 +0100
committerBastien Nocera <hadess@hadess.net>2013-04-04 09:10:05 +0200
commit52a8a194507b1bfe811cc4e17b90d19e08713cbc (patch)
treef301b8f96fd7e6a926ff3def63b39db1f768a2b5 /src/gst/totem-time-helpers.c
parent061a4eeaf30337c4034f2e6f78802f7b08cfac4b (diff)
downloadtotem-52a8a194507b1bfe811cc4e17b90d19e08713cbc.tar.gz
gst: Add more time display options
Add options to force the hour to be shown, and whether to show the time as "remaining" time.
Diffstat (limited to 'src/gst/totem-time-helpers.c')
-rw-r--r--src/gst/totem-time-helpers.c39
1 files changed, 30 insertions, 9 deletions
diff --git a/src/gst/totem-time-helpers.c b/src/gst/totem-time-helpers.c
index 71e9e82e2..0e2cfb2c0 100644
--- a/src/gst/totem-time-helpers.c
+++ b/src/gst/totem-time-helpers.c
@@ -34,7 +34,9 @@
/* FIXME: Remove
* See https://bugzilla.gnome.org/show_bug.cgi?id=679850 */
char *
-totem_time_to_string (gint64 msecs)
+totem_time_to_string (gint64 msecs,
+ gboolean remaining,
+ gboolean force_hour)
{
int sec, min, hour, _time;
@@ -45,15 +47,34 @@ totem_time_to_string (gint64 msecs)
_time = _time - (min * 60);
hour = _time / (60*60);
- if (hour > 0)
- {
- /* hour:minutes:seconds */
- /* Translators: This is a time format, like "9:05:02" for 9
- * hours, 5 minutes, and 2 seconds. You may change ":" to
- * the separator that your locale uses or use "%Id" instead
- * of "%d" if your locale uses localized digits.
+ if (hour > 0 || force_hour) {
+ if (!remaining) {
+ /* hour:minutes:seconds */
+ /* Translators: This is a time format, like "-9:05:02" for 9
+ * hours, 5 minutes, and 2 seconds. You may change ":" to
+ * the separator that your locale uses or use "%Id" instead
+ * of "%d" if your locale uses localized digits.
+ */
+ return g_strdup_printf (C_("long time format", "%d:%02d:%02d"), hour, min, sec);
+ } else {
+ /* -hour:minutes:seconds */
+ /* Translators: This is a time format, like "-9:05:02" for 9
+ * hours, 5 minutes, and 2 seconds playback remaining. You may
+ * change ":" to the separator that your locale uses or use
+ * "%Id" instead of "%d" if your locale uses localized digits.
+ */
+ return g_strdup_printf (C_("long time format", "-%d:%02d:%02d"), hour, min, sec);
+ }
+ }
+
+ if (remaining) {
+ /* -minutes:seconds */
+ /* Translators: This is a time format, like "-5:02" for 5
+ * minutes and 2 seconds playback remaining. You may change
+ * ":" to the separator that your locale uses or use "%Id"
+ * instead of "%d" if your locale uses localized digits.
*/
- return g_strdup_printf (C_("long time format", "%d:%02d:%02d"), hour, min, sec);
+ return g_strdup_printf (C_("short time format", "-%d:%02d"), min, sec);
}
/* minutes:seconds */