comparison finch/gntft.c @ 15964:8a54f74fecdf

plug some leaks
author Richard Nelson <wabz@pidgin.im>
date Thu, 29 Mar 2007 02:35:54 +0000
parents ee397e53d9ce
children 0f0832c13fcb
comparison
equal deleted inserted replaced
15963:26a5869b3165 15964:8a54f74fecdf
390 kb_sent = purple_xfer_get_bytes_sent(xfer) / 1024.0; 390 kb_sent = purple_xfer_get_bytes_sent(xfer) / 1024.0;
391 kb_rem = purple_xfer_get_bytes_remaining(xfer) / 1024.0; 391 kb_rem = purple_xfer_get_bytes_remaining(xfer) / 1024.0;
392 elapsed = (xfer->start_time > 0 ? now - xfer->start_time : 0); 392 elapsed = (xfer->start_time > 0 ? now - xfer->start_time : 0);
393 kbps = (elapsed > 0 ? (kb_sent / elapsed) : 0); 393 kbps = (elapsed > 0 ? (kb_sent / elapsed) : 0);
394 394
395 kbsec = g_strdup_printf(_("%.2f KB/s"), kbps);
396
397 g_return_if_fail(xfer_dialog != NULL); 395 g_return_if_fail(xfer_dialog != NULL);
398 g_return_if_fail(xfer != NULL); 396 g_return_if_fail(xfer != NULL);
399 397
400 if ((data = FINCHXFER(xfer)) == NULL) 398 if ((data = FINCHXFER(xfer)) == NULL)
401 return; 399 return;
411 } 409 }
412 data->last_updated_time = current_time; 410 data->last_updated_time = current_time;
413 411
414 size_str = purple_str_size_to_units(purple_xfer_get_size(xfer)); 412 size_str = purple_str_size_to_units(purple_xfer_get_size(xfer));
415 remaining_str = purple_str_size_to_units(purple_xfer_get_bytes_remaining(xfer)); 413 remaining_str = purple_str_size_to_units(purple_xfer_get_bytes_remaining(xfer));
414 kbsec = g_strdup_printf(_("%.2f KB/s"), kbps);
416 415
417 gnt_tree_change_text(GNT_TREE(xfer_dialog->tree), xfer, COLUMN_PROGRESS, 416 gnt_tree_change_text(GNT_TREE(xfer_dialog->tree), xfer, COLUMN_PROGRESS,
418 g_ascii_dtostr(prog_str, sizeof(prog_str), purple_xfer_get_progress(xfer) * 100.)); 417 g_ascii_dtostr(prog_str, sizeof(prog_str), purple_xfer_get_progress(xfer) * 100.));
419 gnt_tree_change_text(GNT_TREE(xfer_dialog->tree), xfer, COLUMN_SIZE, size_str); 418 gnt_tree_change_text(GNT_TREE(xfer_dialog->tree), xfer, COLUMN_SIZE, size_str);
420 gnt_tree_change_text(GNT_TREE(xfer_dialog->tree), xfer, COLUMN_REMAINING, remaining_str); 419 gnt_tree_change_text(GNT_TREE(xfer_dialog->tree), xfer, COLUMN_REMAINING, remaining_str);
421 gnt_tree_change_text(GNT_TREE(xfer_dialog->tree), xfer, COLUMN_SPEED, kbsec); 420 gnt_tree_change_text(GNT_TREE(xfer_dialog->tree), xfer, COLUMN_SPEED, kbsec);
422 g_free(size_str); 421 g_free(size_str);
423 g_free(remaining_str); 422 g_free(remaining_str);
423 g_free(kbsec);
424 if (purple_xfer_is_completed(xfer)) { 424 if (purple_xfer_is_completed(xfer)) {
425 gnt_tree_change_text(GNT_TREE(xfer_dialog->tree), xfer, COLUMN_STATUS, _("Finished")); 425 gnt_tree_change_text(GNT_TREE(xfer_dialog->tree), xfer, COLUMN_STATUS, _("Finished"));
426 gnt_tree_change_text(GNT_TREE(xfer_dialog->tree), xfer, COLUMN_REMAINING, _("Finished")); 426 gnt_tree_change_text(GNT_TREE(xfer_dialog->tree), xfer, COLUMN_REMAINING, _("Finished"));
427 } else { 427 } else {
428 gnt_tree_change_text(GNT_TREE(xfer_dialog->tree), xfer, COLUMN_STATUS, _("Transferring")); 428 gnt_tree_change_text(GNT_TREE(xfer_dialog->tree), xfer, COLUMN_STATUS, _("Transferring"));