Handle "Skip" button in directory scanning status dialog.

Don't show total size, number and time values of file operations
if directory scanning was skipped before.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2013-01-15 15:43:04 +04:00
parent f0d34a2500
commit ad2ca88bb9
2 changed files with 25 additions and 18 deletions

View File

@ -1211,7 +1211,7 @@ panel_compute_totals (const WPanel * panel, const void *ui,
vfs_path_free (p);
if (status != FILE_CONT)
return FILE_ABORT;
return status;
*ret_marked += subdir_count;
*ret_total += subdir_bytes;
@ -1230,11 +1230,16 @@ panel_compute_totals (const WPanel * panel, const void *ui,
/** Initialize variables for progress bars */
static FileProgressStatus
panel_operate_init_totals (FileOperation operation,
const WPanel * panel, const char *source, FileOpContext * ctx)
panel_operate_init_totals (FileOperation operation, const WPanel * panel, const char *source,
FileOpContext * ctx, filegui_dialog_type_t dialog_type)
{
FileProgressStatus status;
#ifdef ENABLE_BACKGROUND
if (mc_global.we_are_background)
return FILE_CONT;
#endif
if (operation != OP_MOVE && verbose && file_op_compute_totals)
{
ComputeDirSizeUI *ui;
@ -1259,6 +1264,9 @@ panel_operate_init_totals (FileOperation operation,
compute_dir_size_destroy_ui (ui);
ctx->progress_totals_computed = (status == FILE_CONT);
if (status == FILE_SKIP)
status = FILE_CONT;
}
else
{
@ -1268,6 +1276,8 @@ panel_operate_init_totals (FileOperation operation,
ctx->progress_totals_computed = FALSE;
}
file_op_context_create_ui (ctx, TRUE, dialog_type);
return status;
}
@ -2652,6 +2662,7 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
FileOpContext *ctx;
FileOpTotalContext *tctx;
vfs_path_t *tmp_vpath;
filegui_dialog_type_t dialog_type = FILEGUI_DIALOG_ONE_ITEM;
gboolean do_bg = FALSE; /* do background operation? */
@ -2796,7 +2807,6 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
tctx = file_op_total_context_new ();
gettimeofday (&tctx->transfer_start, (struct timezone *) NULL);
#ifdef ENABLE_BACKGROUND
/* Did the user select to do a background operation? */
if (do_bg)
@ -2825,8 +2835,6 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
else
#endif /* ENABLE_BACKGROUND */
{
filegui_dialog_type_t dialog_type;
if (operation == OP_DELETE)
dialog_type = FILEGUI_DIALOG_DELETE_ITEM;
else
@ -2837,8 +2845,6 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
if (single_entry && (operation == OP_COPY) && S_ISDIR (selection (panel)->st.st_mode))
dialog_type = FILEGUI_DIALOG_MULTI_ITEM;
}
file_op_context_create_ui (ctx, TRUE, dialog_type);
}
/* Initialize things */
@ -2884,7 +2890,8 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
source_with_vpath = vfs_path_append_new (panel->cwd_vpath, source, (char *) NULL);
source_with_path_str = vfs_path_to_str (source_with_vpath);
#endif /* WITH_FULL_PATHS */
if (panel_operate_init_totals (operation, panel, source_with_path_str, ctx) == FILE_CONT)
if (panel_operate_init_totals (operation, panel, source_with_path_str, ctx, dialog_type) ==
FILE_CONT)
{
if (operation == OP_DELETE)
{
@ -2969,7 +2976,7 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
goto clean_up;
}
if (panel_operate_init_totals (operation, panel, NULL, ctx) == FILE_CONT)
if (panel_operate_init_totals (operation, panel, NULL, ctx, dialog_type) == FILE_CONT)
{
/* Loop for every file, perform the actual copy operation */
for (i = 0; i < panel->count; i++)

View File

@ -11,7 +11,7 @@
in an interactive program.
Copyright (C) 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003,
2004, 2005, 2006, 2007, 2009, 2011, 2012
2004, 2005, 2006, 2007, 2009, 2011, 2012, 2013
The Free Software Foundation, Inc.
Written by:
@ -22,7 +22,7 @@
Norbert Warmuth, 1997
Pavel Machek, 1998
Slava Zanko, 2009-2012
Andrew Borodin, 2009-2012
Andrew Borodin <aborodin@vmail.ru>, 2009, 2010, 2011, 2012, 2013
This file is part of the Midnight Commander.
@ -716,7 +716,7 @@ file_op_context_create_ui (FileOpContext * ctx, gboolean with_eta,
ui = ctx->ui;
ui->replace_result = REPLACE_YES;
ui->showing_eta = with_eta && file_op_compute_totals;
ui->showing_eta = with_eta && ctx->progress_totals_computed;
ui->showing_bps = with_eta;
ui->op_dlg =
@ -748,7 +748,7 @@ file_op_context_create_ui (FileOpContext * ctx, gboolean with_eta,
ui->total_bytes_label = hline_new (y++, -1, -1);
add_widget (ui->op_dlg, ui->total_bytes_label);
if (file_op_compute_totals)
if (ctx->progress_totals_computed)
{
ui->progress_total_gauge =
gauge_new (y++, x + 3, dlg_width - (x + 3) * 2, FALSE, 100, 0);
@ -900,7 +900,7 @@ file_progress_show_count (FileOpContext * ctx, size_t done, size_t total)
g_return_if_fail (ctx->ui != NULL);
ui = ctx->ui;
if (file_op_compute_totals)
if (ctx->progress_totals_computed)
g_snprintf (buffer, BUF_TINY, _("Files processed: %zu/%zu"), done, total);
else
g_snprintf (buffer, BUF_TINY, _("Files processed: %zu"), done);
@ -925,7 +925,7 @@ file_progress_show_total (FileOpTotalContext * tctx, FileOpContext * ctx, uintma
ui = ctx->ui;
if (file_op_compute_totals)
if (ctx->progress_totals_computed)
{
if (ctx->progress_bytes == 0)
gauge_show (ui->progress_total_gauge, 0);
@ -943,7 +943,7 @@ file_progress_show_total (FileOpTotalContext * tctx, FileOpContext * ctx, uintma
gettimeofday (&tv_current, NULL);
file_frmt_time (buffer2, tv_current.tv_sec - tctx->transfer_start.tv_sec);
if (file_op_compute_totals)
if (ctx->progress_totals_computed)
{
file_eta_prepare_for_show (buffer3, tctx->eta_secs, TRUE);
if (tctx->bps == 0)
@ -968,7 +968,7 @@ file_progress_show_total (FileOpTotalContext * tctx, FileOpContext * ctx, uintma
label_set_text (ui->time_label, buffer);
size_trunc_len (buffer2, 5, tctx->copied_bytes, 0, panels_options.kilobyte_si);
if (!file_op_compute_totals)
if (!ctx->progress_totals_computed)
g_snprintf (buffer, BUF_TINY, _(" Total: %s "), buffer2);
else
{