changeset 22616:bcc355f38ba4

Show better status text for file transfers.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 09 Apr 2008 19:06:18 +0000
parents 8469385cfb73
children cdc9bb97a88a
files finch/gntft.c
diffstat 1 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/finch/gntft.c	Sat Apr 05 19:37:26 2008 +0000
+++ b/finch/gntft.c	Wed Apr 09 19:06:18 2008 +0000
@@ -403,6 +403,7 @@
 	double kbps = 0.0;
 	time_t elapsed, now;
 	char *kbsec;
+	gboolean send;
 
 	if ((now = purple_xfer_get_end_time(xfer)) == 0)
 		now = time(NULL);
@@ -429,6 +430,7 @@
 	}
 	data->last_updated_time = current_time;
 
+	send = (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND);
 	size_str      = purple_str_size_to_units(purple_xfer_get_size(xfer));
 	remaining_str = purple_str_size_to_units(purple_xfer_get_bytes_remaining(xfer));
 	kbsec = g_strdup_printf(_("%.2f KiB/s"), kbps);
@@ -442,14 +444,17 @@
 	g_free(remaining_str);
 	g_free(kbsec);
 	if (purple_xfer_is_completed(xfer)) {
-		char *msg = g_strdup_printf(_("The file was saved as %s."), purple_xfer_get_local_filename(xfer));
-		gnt_tree_change_text(GNT_TREE(xfer_dialog->tree), xfer, COLUMN_STATUS, _("Finished"));
+		gnt_tree_change_text(GNT_TREE(xfer_dialog->tree), xfer, COLUMN_STATUS, send ? _("Sent") : _("Received"));
 		gnt_tree_change_text(GNT_TREE(xfer_dialog->tree), xfer, COLUMN_REMAINING, _("Finished"));
-		purple_xfer_conversation_write(xfer, msg, FALSE);
-		g_free(msg);
+		if (!send) {
+			char *msg = g_strdup_printf(_("The file was saved as %s."), purple_xfer_get_local_filename(xfer));
+			purple_xfer_conversation_write(xfer, msg, FALSE);
+			g_free(msg);
+		}
 		data->notified = TRUE;
 	} else {
-		gnt_tree_change_text(GNT_TREE(xfer_dialog->tree), xfer, COLUMN_STATUS, _("Transferring"));
+		gnt_tree_change_text(GNT_TREE(xfer_dialog->tree), xfer, COLUMN_STATUS,
+				send ? _("Sending") : _("Receiving"));
 	}
 
 	update_title_progress();