summaryrefslogtreecommitdiff
path: root/src/gst
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
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')
-rw-r--r--src/gst/totem-time-helpers.c39
-rw-r--r--src/gst/totem-time-helpers.h4
2 files changed, 33 insertions, 10 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 */
diff --git a/src/gst/totem-time-helpers.h b/src/gst/totem-time-helpers.h
index fc3067edc..a5269b787 100644
--- a/src/gst/totem-time-helpers.h
+++ b/src/gst/totem-time-helpers.h
@@ -30,6 +30,8 @@
#include <glib.h>
-char *totem_time_to_string (gint64 msecs);
+char *totem_time_to_string (gint64 msecs,
+ gboolean remaining,
+ gboolean force_hour);
#endif /* _TOTEM_TIME_HELPERS_H_ */