changeset 4519:599d350fce4e

[gaim-migrate @ 4797] This should work better when the speed is set sometime during a transfer rather than before it. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Tue, 04 Feb 2003 19:06:58 +0000
parents a6be92358df3
children 4fe661860577
files src/gtkft.c
diffstat 1 files changed, 10 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkft.c	Tue Feb 04 18:28:47 2003 +0000
+++ b/src/gtkft.c	Tue Feb 04 19:06:58 2003 +0000
@@ -515,18 +515,20 @@
 	int secs_remaining;
 
 	data = (struct gaim_gtkxfer_ui_data *)xfer->ui_data;
+	
+	now     = time(NULL);
+	kb_sent = gaim_xfer_get_bytes_sent(xfer) / 1024.0;
+	elapsed = (now - data->start_time);
+	kbps    = (elapsed > 0 ? (kb_sent / elapsed) : 0);
+
+	g_snprintf(speed_buf, sizeof(speed_buf),
+			   _("%.2f KB/s"), kbps);
 
 	if (gaim_xfer_get_size(xfer) == 0) {
-		*speed_buf = '\0';
 		strncpy(estimate_buf, _("Unknown"), sizeof(estimate_buf));
 	}
 	else {
-		now     = time(NULL);
-		kb_rem  = gaim_xfer_get_bytes_remaining(xfer) / 1024.0;
-		kb_sent = gaim_xfer_get_bytes_sent(xfer) / 1024.0;
-		elapsed = (now - data->start_time);
-		kbps    = (elapsed > 0 ? (kb_sent / elapsed) : 0);
-
+		kb_rem = gaim_xfer_get_bytes_remaining(xfer) / 1024.0;
 		secs_remaining = (int)(kb_rem / kbps);
 
 		if (secs_remaining <= 0) {
@@ -552,8 +554,6 @@
 
 			g_snprintf(estimate_buf, sizeof(estimate_buf),
 					   _("%d:%02d:%02d"), h, m, s);
-			g_snprintf(speed_buf, sizeof(speed_buf),
-					   _("%.2f KB/s"), kbps);
 		}
 	}
 
@@ -562,6 +562,7 @@
 					   COLUMN_PROGRESS, percent,
 					   COLUMN_ESTIMATE, estimate_buf,
 					   COLUMN_SPEED, speed_buf,
+					   COLUMN_SIZE, gaim_xfer_get_size(xfer),
 					   -1);
 }