(file_op_context_t): rename members.

progress_count -> total_count
progress_bytes -> total_bytes
progress_totals_computed -> totals_computed

No functional changes.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2024-08-11 15:04:42 +03:00
parent 31771bd332
commit 23ed903814
3 changed files with 32 additions and 32 deletions

View File

@ -765,11 +765,11 @@ panel_operate_init_totals (const WPanel *panel, const vfs_path_t *source,
status_msg_init (STATUS_MSG (&dsm), _("Directory scanning"), 0, dirsize_status_init_cb, status_msg_init (STATUS_MSG (&dsm), _("Directory scanning"), 0, dirsize_status_init_cb,
dirsize_status_update_cb, dirsize_status_deinit_cb); dirsize_status_update_cb, dirsize_status_deinit_cb);
ctx->progress_count = 0; ctx->total_count = 0;
ctx->progress_bytes = 0; ctx->total_bytes = 0;
if (source == NULL) if (source == NULL)
status = panel_compute_totals (panel, &dsm, &ctx->progress_count, &ctx->progress_bytes, status = panel_compute_totals (panel, &dsm, &ctx->total_count, &ctx->total_bytes,
ctx->follow_links); ctx->follow_links);
else if (S_ISDIR (source_stat->st_mode) else if (S_ISDIR (source_stat->st_mode)
|| (ctx->follow_links || (ctx->follow_links
@ -778,19 +778,19 @@ panel_operate_init_totals (const WPanel *panel, const vfs_path_t *source,
{ {
size_t dir_count = 0; size_t dir_count = 0;
status = do_compute_dir_size (source, &dsm, &dir_count, &ctx->progress_count, status = do_compute_dir_size (source, &dsm, &dir_count, &ctx->total_count,
&ctx->progress_bytes, ctx->stat_func); &ctx->total_bytes, ctx->stat_func);
} }
else else
{ {
ctx->progress_count++; ctx->total_count++;
ctx->progress_bytes += (uintmax_t) source_stat->st_size; ctx->total_bytes += (uintmax_t) source_stat->st_size;
status = FILE_CONT; status = FILE_CONT;
} }
status_msg_deinit (STATUS_MSG (&dsm)); status_msg_deinit (STATUS_MSG (&dsm));
ctx->progress_totals_computed = (status == FILE_CONT); ctx->totals_computed = (status == FILE_CONT);
if (status == FILE_SKIP) if (status == FILE_SKIP)
status = FILE_CONT; status = FILE_CONT;
@ -798,9 +798,9 @@ panel_operate_init_totals (const WPanel *panel, const vfs_path_t *source,
else else
{ {
status = FILE_CONT; status = FILE_CONT;
ctx->progress_count = panel->marked; ctx->total_count = panel->marked;
ctx->progress_bytes = panel->total; ctx->total_bytes = panel->total;
ctx->progress_totals_computed = verbose && dialog_type == FILEGUI_DIALOG_ONE_ITEM; ctx->totals_computed = verbose && dialog_type == FILEGUI_DIALOG_ONE_ITEM;
} }
/* destroy already created UI for single file rename operation */ /* destroy already created UI for single file rename operation */
@ -831,7 +831,7 @@ progress_update_one (file_op_total_context_t *tctx, file_op_context_t *ctx, off_
{ {
if (verbose && ctx->dialog_type == FILEGUI_DIALOG_MULTI_ITEM) if (verbose && 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->total_count);
file_progress_show_total (tctx, ctx, tctx->progress_bytes, TRUE); file_progress_show_total (tctx, ctx, tctx->progress_bytes, TRUE);
} }
@ -1152,11 +1152,11 @@ copy_file_file_display_progress (file_op_total_context_t *tctx, file_op_context_
ctx->bps = file_part / ctx->bps_time; ctx->bps = file_part / ctx->bps_time;
/* Compute total ETA and BPS */ /* Compute total ETA and BPS */
if (ctx->progress_bytes != 0) if (ctx->total_bytes != 0)
{ {
uintmax_t remain_bytes; uintmax_t remain_bytes;
remain_bytes = ctx->progress_bytes - tctx->copied_bytes; remain_bytes = ctx->total_bytes - tctx->copied_bytes;
#if 1 #if 1
{ {
gint64 total_secs; gint64 total_secs;
@ -1388,7 +1388,7 @@ erase_file (file_op_total_context_t *tctx, file_op_context_t *ctx, const vfs_pat
/* check buttons if deleting info was changed */ /* check buttons if deleting info was changed */
if (file_progress_show_deleting (ctx, vpath, &tctx->progress_count)) if (file_progress_show_deleting (ctx, vpath, &tctx->progress_count))
{ {
file_progress_show_count (ctx, tctx->progress_count, ctx->progress_count); file_progress_show_count (ctx, tctx->progress_count, ctx->total_count);
if (file_progress_check_buttons (ctx) == FILE_ABORT) if (file_progress_check_buttons (ctx) == FILE_ABORT)
return FILE_ABORT; return FILE_ABORT;
@ -1478,7 +1478,7 @@ recursive_erase (file_op_total_context_t *tctx, file_op_context_t *ctx, const vf
return FILE_ABORT; return FILE_ABORT;
file_progress_show_deleting (ctx, vpath, NULL); file_progress_show_deleting (ctx, vpath, NULL);
file_progress_show_count (ctx, tctx->progress_count, ctx->progress_count); file_progress_show_count (ctx, tctx->progress_count, ctx->total_count);
if (file_progress_check_buttons (ctx) == FILE_ABORT) if (file_progress_check_buttons (ctx) == FILE_ABORT)
return FILE_ABORT; return FILE_ABORT;
@ -1529,7 +1529,7 @@ static FileProgressStatus
erase_dir_iff_empty (file_op_context_t *ctx, const vfs_path_t *vpath, size_t count) erase_dir_iff_empty (file_op_context_t *ctx, const vfs_path_t *vpath, size_t count)
{ {
file_progress_show_deleting (ctx, vpath, NULL); file_progress_show_deleting (ctx, vpath, NULL);
file_progress_show_count (ctx, count, ctx->progress_count); file_progress_show_count (ctx, count, ctx->total_count);
if (file_progress_check_buttons (ctx) == FILE_ABORT) if (file_progress_check_buttons (ctx) == FILE_ABORT)
return FILE_ABORT; return FILE_ABORT;
@ -2779,7 +2779,7 @@ copy_file_file (file_op_total_context_t *tctx, file_op_context_t *ctx,
{ {
if (ctx->dialog_type == FILEGUI_DIALOG_MULTI_ITEM) 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->total_count);
file_progress_show_total (tctx, ctx, tctx->copied_bytes, force_update); file_progress_show_total (tctx, ctx, tctx->copied_bytes, force_update);
} }
@ -3302,7 +3302,7 @@ FileProgressStatus
erase_dir (file_op_total_context_t *tctx, file_op_context_t *ctx, const vfs_path_t *vpath) erase_dir (file_op_total_context_t *tctx, file_op_context_t *ctx, const vfs_path_t *vpath)
{ {
file_progress_show_deleting (ctx, vpath, NULL); file_progress_show_deleting (ctx, vpath, NULL);
file_progress_show_count (ctx, tctx->progress_count, ctx->progress_count); file_progress_show_count (ctx, tctx->progress_count, ctx->total_count);
if (file_progress_check_buttons (ctx) == FILE_ABORT) if (file_progress_check_buttons (ctx) == FILE_ABORT)
return FILE_ABORT; return FILE_ABORT;
@ -3653,7 +3653,7 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
{ {
if (ctx->dialog_type == FILEGUI_DIALOG_MULTI_ITEM) 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->total_count);
file_progress_show_total (tctx, ctx, tctx->progress_bytes, FALSE); file_progress_show_total (tctx, ctx, tctx->progress_bytes, FALSE);
} }

View File

@ -855,7 +855,7 @@ file_progress_ui_create (file_op_context_t *ctx, gboolean with_eta,
if (dialog_type != FILEGUI_DIALOG_DELETE_ITEM) if (dialog_type != FILEGUI_DIALOG_DELETE_ITEM)
{ {
ui->showing_eta = with_eta && ctx->progress_totals_computed; ui->showing_eta = with_eta && ctx->totals_computed;
ui->showing_bps = with_eta; ui->showing_bps = with_eta;
ui->src_file_label = label_new (y++, x, NULL); ui->src_file_label = label_new (y++, x, NULL);
@ -883,7 +883,7 @@ file_progress_ui_create (file_op_context_t *ctx, gboolean with_eta,
ui->total_bytes_label = hline_new (y++, -1, -1); ui->total_bytes_label = hline_new (y++, -1, -1);
group_add_widget (g, ui->total_bytes_label); group_add_widget (g, ui->total_bytes_label);
if (ctx->progress_totals_computed) if (ctx->totals_computed)
{ {
ui->progress_total_gauge = ui->progress_total_gauge =
gauge_new (y++, x + 3, dlg_width - (x + 3) * 2, FALSE, 100, 0); gauge_new (y++, x + 3, dlg_width - (x + 3) * 2, FALSE, 100, 0);
@ -1042,7 +1042,7 @@ file_progress_show_count (file_op_context_t *ctx, size_t done, size_t total)
if (ui->total_files_processed_label == NULL) if (ui->total_files_processed_label == NULL)
return; return;
if (ctx->progress_totals_computed) if (ctx->totals_computed)
label_set_textv (ui->total_files_processed_label, _("Files processed: %zu / %zu"), done, label_set_textv (ui->total_files_processed_label, _("Files processed: %zu / %zu"), done,
total); total);
else else
@ -1066,12 +1066,12 @@ file_progress_show_total (file_op_total_context_t *tctx, file_op_context_t *ctx,
if (ui->progress_total_gauge != NULL) if (ui->progress_total_gauge != NULL)
{ {
if (ctx->progress_bytes == 0) if (ctx->total_bytes == 0)
gauge_show (ui->progress_total_gauge, FALSE); gauge_show (ui->progress_total_gauge, FALSE);
else else
{ {
gauge_set_value (ui->progress_total_gauge, 1024, gauge_set_value (ui->progress_total_gauge, 1024,
(int) (1024 * copied_bytes / ctx->progress_bytes)); (int) (1024 * copied_bytes / ctx->total_bytes));
gauge_show (ui->progress_total_gauge, TRUE); gauge_show (ui->progress_total_gauge, TRUE);
} }
} }
@ -1087,7 +1087,7 @@ file_progress_show_total (file_op_total_context_t *tctx, file_op_context_t *ctx,
tv_current = g_get_monotonic_time (); tv_current = g_get_monotonic_time ();
file_frmt_time (buffer2, (tv_current - tctx->transfer_start) / G_USEC_PER_SEC); file_frmt_time (buffer2, (tv_current - tctx->transfer_start) / G_USEC_PER_SEC);
if (ctx->progress_totals_computed) if (ctx->totals_computed)
{ {
file_eta_prepare_for_show (buffer3, tctx->eta_secs, TRUE); file_eta_prepare_for_show (buffer3, tctx->eta_secs, TRUE);
if (tctx->bps == 0) if (tctx->bps == 0)
@ -1114,11 +1114,11 @@ file_progress_show_total (file_op_total_context_t *tctx, file_op_context_t *ctx,
{ {
size_trunc_len (buffer2, 5, tctx->copied_bytes, 0, panels_options.kilobyte_si); size_trunc_len (buffer2, 5, tctx->copied_bytes, 0, panels_options.kilobyte_si);
if (!ctx->progress_totals_computed) if (!ctx->totals_computed)
hline_set_textv (ui->total_bytes_label, _(" Total: %s "), buffer2); hline_set_textv (ui->total_bytes_label, _(" Total: %s "), buffer2);
else else
{ {
size_trunc_len (buffer3, 5, ctx->progress_bytes, 0, panels_options.kilobyte_si); size_trunc_len (buffer3, 5, ctx->total_bytes, 0, panels_options.kilobyte_si);
hline_set_textv (ui->total_bytes_label, _(" Total: %s / %s "), buffer2, buffer3); hline_set_textv (ui->total_bytes_label, _(" Total: %s / %s "), buffer2, buffer3);
} }
} }

View File

@ -88,13 +88,13 @@ typedef struct
/* Transferred seconds */ /* Transferred seconds */
long bps_time; long bps_time;
/* Whether the panel total has been computed */
gboolean progress_totals_computed;
filegui_dialog_type_t dialog_type; filegui_dialog_type_t dialog_type;
/* Counters for progress indicators */ /* Counters for progress indicators */
size_t progress_count; size_t total_count;
uintmax_t progress_bytes; uintmax_t total_bytes;
/* Whether the panel total has been computed */
gboolean totals_computed;
/* Result from the recursive query */ /* Result from the recursive query */
FileCopyMode recursive_result; FileCopyMode recursive_result;