[Rhythmbox-devel] Remaining time display / suggestion
- From: "Thomas Zander" <thomas e zander googlemail com>
- To: rhythmbox-devel gnome org
- Subject: [Rhythmbox-devel] Remaining time display / suggestion
- Date: Fri, 6 Jul 2007 14:58:40 +0800
Hi,
I couldn't find how to tell RB to display the remaining track time
instead of the elapsed time.
However, I noticed that rb_make_elapsed_time_string() in rb-util.c
contains already all code to construct both elapsed and remaining time
and return either of them.
I would like to ask what's wrong with displaying them both. It would
be nice to see both without switching a mode, something like the
attached diff.
Of course this renders the last argument of the function, gboolean
show_remaining, useless but this function is not really widely used,
so I assume it would not break a frozen API.
TIA,
Riggs
Index: lib/rb-util.c
===================================================================
--- lib/rb-util.c (revision 5240)
+++ lib/rb-util.c (working copy)
@@ -659,6 +659,7 @@
{
int seconds = 0, minutes = 0, hours = 0;
int seconds2 = 0, minutes2 = 0, hours2 = 0;
+ int remaining, remaining_hours, remaining_minutes, remaining_seconds;
if (duration == 0)
return rb_make_duration_string (elapsed);
@@ -675,32 +676,23 @@
seconds = elapsed % 60;
}
- if (show_remaining) {
- int remaining = duration - elapsed;
- int remaining_hours = remaining / (60 * 60);
- int remaining_minutes = (remaining - (remaining_hours * 60 * 60)) / 60;
- /* remaining could conceivably be negative. This would
- * be a bug, but the elapsed time will display right
- * with the abs(). */
- int remaining_seconds = abs (remaining % 60);
- if (hours2 == 0)
- return g_strdup_printf (_("%d:%02d of %d:%02d remaining"),
- remaining_minutes, remaining_seconds,
- minutes2, seconds2);
- else
- return g_strdup_printf (_("%d:%02d:%02d of %d:%02d:%02d remaining"),
- remaining_hours, remaining_minutes, remaining_seconds,
- hours2, minutes2, seconds2);
- } else {
- if (hours == 0 && hours2 == 0)
- return g_strdup_printf (_("%d:%02d of %d:%02d"),
- minutes, seconds,
- minutes2, seconds2);
- else
- return g_strdup_printf (_("%d:%02d:%02d of %d:%02d:%02d"),
- hours, minutes, seconds,
- hours2, minutes2, seconds2);
- }
+ remaining = duration - elapsed;
+ remaining_hours = remaining / (60 * 60);
+ remaining_minutes = (remaining - (remaining_hours * 60 * 60)) / 60;
+ /* remaining could conceivably be negative. This would
+ * be a bug, but the elapsed time will display right
+ * with the abs(). */
+ remaining_seconds = abs (remaining % 60);
+ if (hours == 0 && hours2 == 0)
+ return g_strdup_printf (_("%d:%02d (-%d:%02d) of %d:%02d"),
+ minutes, seconds,
+ remaining_minutes, remaining_seconds,
+ minutes2, seconds2);
+ else
+ return g_strdup_printf (_("%d:%02d:%02d (-%d:%02d:%02d) of %d:%02d:%02d"),
+ hours, minutes, seconds,
+ remaining_hours, remaining_minutes, remaining_seconds,
+ hours2, minutes2, seconds2);
}
gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]