[Rhythmbox-devel] [PATCH] Use appropiate units for total time.



Hi,

The attached patch fixes a cosmetic issue with the 'total time' status 
text. If a large number (1+ Gigs) of tracks are selected, the display of 
hours:minutes:seconds is quite confusing / uninformative. The attached 
patch changes the display depending on the length of time the tracks 
run, and shows 'x.y days' if more than 24 hours are selected.

(I know it's quite trivial, but I just spotted it while having a look 
though the code and it seemed a nice addition :-)

Please apply

Regards

Dave Rigby



Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/net-rhythmbox/ChangeLog,v
retrieving revision 1.32
diff -u -b -d -r1.32 ChangeLog
--- ChangeLog	23 Apr 2003 09:06:29 -0000	1.32
+++ ChangeLog	23 Apr 2003 12:52:49 -0000
@@ -1,3 +1,8 @@
+2003-04-23  Dave Rigby  <dave@amunra.co.uk>
+
+	* lib/widgets/rb-node-view.c: (rb_node_view_get_status): Display 
+	'total time' in status view as days if sufficient songs are selected.
+
 2003-04-23  Colin Walters  <walters@debian.org>
 
 	* shell/rb-shell.c: Move NewStation command implementation here.
Index: lib/widgets/rb-node-view.c
===================================================================
RCS file: /cvs/gnome/net-rhythmbox/lib/widgets/rb-node-view.c,v
retrieving revision 1.5
diff -u -b -d -r1.5 rb-node-view.c
--- lib/widgets/rb-node-view.c	15 Apr 2003 17:48:34 -0000	1.5
+++ lib/widgets/rb-node-view.c	23 Apr 2003 12:52:54 -0000
@@ -1312,6 +1312,7 @@
 rb_node_view_get_status (RBNodeView *view)
 {
 	char *ret, *size;
+	float days;
 	long hours, minutes, seconds;
 	GnomeVFSFileSize n_bytes = 0;
 	long n_seconds = 0;
@@ -1344,12 +1345,21 @@
 
 	size = gnome_vfs_format_file_size_for_display (n_bytes);
 
+	days    = (float) n_seconds / (float) (60 * 60 * 24); 
 	hours   = n_seconds / (60 * 60);
 	minutes = n_seconds / 60 - hours * 60;
 	seconds = n_seconds % 60;
 
+	if ( days >= 1.0 ) {
+		ret = g_strdup_printf (_("%ld songs, %.1f days total time, %s"),
+				       n_songs, days, size);
+	} else if ( hours >= 1 ) {	
 	ret = g_strdup_printf (_("%ld songs, %ld:%02ld:%02ld total time, %s"),
 			       n_songs, hours, minutes, seconds, size);
+	} else {
+		ret = g_strdup_printf (_("%ld songs, %02ld:%02ld total time, %s"),
+				       n_songs, minutes, seconds, size);
+	}
 
 	g_free (size);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]