Ticket #3205: fix ETA calculation.

Check "verbose" before file_progress_show() call.

  * (file_progress_show): don't chech "verbose" here.
  * (move_file_file): call file_progress_show() if "verbose" is on.
  * (do_move_dir_dir): likewise.
  * (copy_file_file): likewise, join checks.
  * (panel_operate): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2024-08-10 11:11:35 +03:00
parent c5b8b69371
commit f911cf30cb
2 changed files with 33 additions and 20 deletions

View File

@ -1350,6 +1350,7 @@ move_file_file (const WPanel *panel, file_op_total_context_t *tctx, file_op_cont
if (panel == NULL) if (panel == NULL)
{ {
file_progress_show_source (ctx, NULL); file_progress_show_source (ctx, NULL);
if (verbose)
file_progress_show (ctx, 0, 0, "", FALSE); file_progress_show (ctx, 0, 0, "", FALSE);
return_status = check_progress_buttons (ctx); return_status = check_progress_buttons (ctx);
@ -1720,6 +1721,7 @@ do_move_dir_dir (const WPanel *panel, file_op_total_context_t *tctx, file_op_con
{ {
file_progress_show_source (ctx, NULL); file_progress_show_source (ctx, NULL);
file_progress_show_target (ctx, NULL); file_progress_show_target (ctx, NULL);
if (verbose)
file_progress_show (ctx, 0, 0, "", FALSE); file_progress_show (ctx, 0, 0, "", FALSE);
return_status = check_progress_buttons (ctx); return_status = check_progress_buttons (ctx);
@ -2662,10 +2664,14 @@ copy_file_file (file_op_total_context_t *tctx, file_op_context_t *ctx,
ctx->eta_secs = 0.0; ctx->eta_secs = 0.0;
ctx->bps = 0; ctx->bps = 0;
if (verbose)
{
if (tctx->bps == 0 || (file_size / tctx->bps) > FILEOP_UPDATE_INTERVAL) if (tctx->bps == 0 || (file_size / tctx->bps) > FILEOP_UPDATE_INTERVAL)
file_progress_show (ctx, 0, file_size, "", TRUE); file_progress_show (ctx, 0, file_size, "", TRUE);
else else
file_progress_show (ctx, 1, 1, "", TRUE); file_progress_show (ctx, 1, 1, "", TRUE);
}
return_status = check_progress_buttons (ctx); return_status = check_progress_buttons (ctx);
mc_refresh (); mc_refresh ();
@ -2771,7 +2777,9 @@ copy_file_file (file_op_total_context_t *tctx, file_op_context_t *ctx,
force_update = (tv_current - tctx->transfer_start) > FILEOP_UPDATE_INTERVAL_US; force_update = (tv_current - tctx->transfer_start) > FILEOP_UPDATE_INTERVAL_US;
if (verbose && ctx->dialog_type == FILEGUI_DIALOG_MULTI_ITEM) if (verbose)
{
if (ctx->dialog_type == FILEGUI_DIALOG_MULTI_ITEM)
{ {
file_progress_show_count (ctx, tctx->progress_count, ctx->progress_count); file_progress_show_count (ctx, tctx->progress_count, ctx->progress_count);
file_progress_show_total (tctx, ctx, tctx->copied_bytes, force_update); file_progress_show_total (tctx, ctx, tctx->copied_bytes, force_update);
@ -2779,7 +2787,9 @@ copy_file_file (file_op_total_context_t *tctx, file_op_context_t *ctx,
file_progress_show (ctx, file_part + ctx->do_reget, file_size, stalled_msg, file_progress_show (ctx, file_part + ctx->do_reget, file_size, stalled_msg,
force_update); force_update);
mc_refresh (); mc_refresh ();
}
return_status = check_progress_buttons (ctx); return_status = check_progress_buttons (ctx);
if (return_status != FILE_CONT) if (return_status != FILE_CONT)
@ -3641,7 +3651,9 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
if (value == FILE_CONT) if (value == FILE_CONT)
do_file_mark (panel, i, 0); do_file_mark (panel, i, 0);
if (verbose && ctx->dialog_type == FILEGUI_DIALOG_MULTI_ITEM) if (verbose)
{
if (ctx->dialog_type == FILEGUI_DIALOG_MULTI_ITEM)
{ {
file_progress_show_count (ctx, tctx->progress_count, ctx->progress_count); file_progress_show_count (ctx, tctx->progress_count, ctx->progress_count);
file_progress_show_total (tctx, ctx, tctx->progress_bytes, FALSE); file_progress_show_total (tctx, ctx, tctx->progress_bytes, FALSE);
@ -3649,6 +3661,7 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
if (operation != OP_DELETE) if (operation != OP_DELETE)
file_progress_show (ctx, 0, 0, "", FALSE); file_progress_show (ctx, 0, 0, "", FALSE);
}
if (check_progress_buttons (ctx) == FILE_ABORT) if (check_progress_buttons (ctx) == FILE_ABORT)
break; break;

View File

@ -989,7 +989,7 @@ file_progress_show (file_op_context_t *ctx, off_t done, off_t total,
{ {
file_op_context_ui_t *ui; file_op_context_ui_t *ui;
if (!verbose || ctx == NULL || ctx->ui == NULL) if (ctx == NULL || ctx->ui == NULL)
return; return;
ui = ctx->ui; ui = ctx->ui;