From 23ed903814bc8bbf0482ea163753fd3f77deeb05 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Sun, 11 Aug 2024 15:04:42 +0300 Subject: [PATCH] (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 --- src/filemanager/file.c | 40 ++++++++++++++++++------------------- src/filemanager/filegui.c | 16 +++++++-------- src/filemanager/fileopctx.h | 8 ++++---- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/filemanager/file.c b/src/filemanager/file.c index fd4761dd3..635a18b94 100644 --- a/src/filemanager/file.c +++ b/src/filemanager/file.c @@ -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, dirsize_status_update_cb, dirsize_status_deinit_cb); - ctx->progress_count = 0; - ctx->progress_bytes = 0; + ctx->total_count = 0; + ctx->total_bytes = 0; 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); else if (S_ISDIR (source_stat->st_mode) || (ctx->follow_links @@ -778,19 +778,19 @@ panel_operate_init_totals (const WPanel *panel, const vfs_path_t *source, { size_t dir_count = 0; - status = do_compute_dir_size (source, &dsm, &dir_count, &ctx->progress_count, - &ctx->progress_bytes, ctx->stat_func); + status = do_compute_dir_size (source, &dsm, &dir_count, &ctx->total_count, + &ctx->total_bytes, ctx->stat_func); } else { - ctx->progress_count++; - ctx->progress_bytes += (uintmax_t) source_stat->st_size; + ctx->total_count++; + ctx->total_bytes += (uintmax_t) source_stat->st_size; status = FILE_CONT; } status_msg_deinit (STATUS_MSG (&dsm)); - ctx->progress_totals_computed = (status == FILE_CONT); + ctx->totals_computed = (status == FILE_CONT); if (status == FILE_SKIP) status = FILE_CONT; @@ -798,9 +798,9 @@ panel_operate_init_totals (const WPanel *panel, const vfs_path_t *source, else { status = FILE_CONT; - ctx->progress_count = panel->marked; - ctx->progress_bytes = panel->total; - ctx->progress_totals_computed = verbose && dialog_type == FILEGUI_DIALOG_ONE_ITEM; + ctx->total_count = panel->marked; + ctx->total_bytes = panel->total; + ctx->totals_computed = verbose && dialog_type == FILEGUI_DIALOG_ONE_ITEM; } /* 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) { - 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); } @@ -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; /* Compute total ETA and BPS */ - if (ctx->progress_bytes != 0) + if (ctx->total_bytes != 0) { uintmax_t remain_bytes; - remain_bytes = ctx->progress_bytes - tctx->copied_bytes; + remain_bytes = ctx->total_bytes - tctx->copied_bytes; #if 1 { 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 */ 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) 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; 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) 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) { 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) 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) { - 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); } @@ -3302,7 +3302,7 @@ FileProgressStatus 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_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) 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) { - 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); } diff --git a/src/filemanager/filegui.c b/src/filemanager/filegui.c index b77bb2e3d..a9f0046f1 100644 --- a/src/filemanager/filegui.c +++ b/src/filemanager/filegui.c @@ -855,7 +855,7 @@ file_progress_ui_create (file_op_context_t *ctx, gboolean with_eta, 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->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); group_add_widget (g, ui->total_bytes_label); - if (ctx->progress_totals_computed) + if (ctx->totals_computed) { ui->progress_total_gauge = 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) return; - if (ctx->progress_totals_computed) + if (ctx->totals_computed) label_set_textv (ui->total_files_processed_label, _("Files processed: %zu / %zu"), done, total); 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 (ctx->progress_bytes == 0) + if (ctx->total_bytes == 0) gauge_show (ui->progress_total_gauge, FALSE); else { 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); } } @@ -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 (); 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); 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); - if (!ctx->progress_totals_computed) + if (!ctx->totals_computed) hline_set_textv (ui->total_bytes_label, _(" Total: %s "), buffer2); 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); } } diff --git a/src/filemanager/fileopctx.h b/src/filemanager/fileopctx.h index ada0e286f..1c4062a91 100644 --- a/src/filemanager/fileopctx.h +++ b/src/filemanager/fileopctx.h @@ -88,13 +88,13 @@ typedef struct /* Transferred seconds */ long bps_time; - /* Whether the panel total has been computed */ - gboolean progress_totals_computed; filegui_dialog_type_t dialog_type; /* Counters for progress indicators */ - size_t progress_count; - uintmax_t progress_bytes; + size_t total_count; + uintmax_t total_bytes; + /* Whether the panel total has been computed */ + gboolean totals_computed; /* Result from the recursive query */ FileCopyMode recursive_result;