Ticket #3958: speed up of large directory structures delete.

(file_progress_show_deleting): reduce update rate of delete status
window. Use the way as in c31e413b2a.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2019-03-11 16:01:26 +03:00
parent 5389e3fc8e
commit 19fa75f7a2
3 changed files with 31 additions and 15 deletions

View File

@ -1357,12 +1357,15 @@ erase_file (file_op_total_context_t * tctx, file_op_context_t * ctx, const vfs_p
struct stat buf;
FileProgressStatus return_status;
file_progress_show_deleting (ctx, vfs_path_as_str (vpath), &tctx->progress_count);
file_progress_show_count (ctx, tctx->progress_count, ctx->progress_count);
if (check_progress_buttons (ctx) == FILE_ABORT)
return FILE_ABORT;
/* check buttons if deleting info was changed */
if (file_progress_show_deleting (ctx, vfs_path_as_str (vpath), &tctx->progress_count))
{
file_progress_show_count (ctx, tctx->progress_count, ctx->progress_count);
if (check_progress_buttons (ctx) == FILE_ABORT)
return FILE_ABORT;
mc_refresh ();
mc_refresh ();
}
if (tctx->progress_count != 0 && mc_lstat (vpath, &buf) != 0)
{

View File

@ -1160,31 +1160,44 @@ file_progress_show_target (file_op_context_t * ctx, const vfs_path_t * vpath)
/* --------------------------------------------------------------------------------------------- */
void
gboolean
file_progress_show_deleting (file_op_context_t * ctx, const char *s, size_t * count)
{
file_op_context_ui_t *ui;
static guint64 timestamp = 0;
/* update with 25 FPS rate */
static const guint64 delay = G_USEC_PER_SEC / 25;
gboolean ret;
if (ctx == NULL || ctx->ui == NULL)
return;
return FALSE;
ui = ctx->ui;
ret = mc_time_elapsed (&timestamp, delay);
if (ui->src_file_label != NULL)
label_set_text (ui->src_file_label, _("Deleting"));
if (ret)
{
file_op_context_ui_t *ui;
label_set_text (ui->src_file, truncFileStringSecure (ui->op_dlg, s));
ui = ctx->ui;
if (ui->src_file_label != NULL)
label_set_text (ui->src_file_label, _("Deleting"));
label_set_text (ui->src_file, truncFileStringSecure (ui->op_dlg, s));
}
if (count != NULL)
(*count)++;
return ret;
}
/* --------------------------------------------------------------------------------------------- */
FileProgressStatus
file_progress_real_query_replace (file_op_context_t * ctx, enum OperationMode mode,
const char *src, struct stat *src_stat,
const char *dst, struct stat *dst_stat)
const char *src, struct stat * src_stat,
const char *dst, struct stat * dst_stat)
{
file_op_context_ui_t *ui;
FileProgressStatus replace_with_zero;

View File

@ -36,7 +36,7 @@ void file_progress_show_total (file_op_total_context_t * tctx, file_op_context_t
uintmax_t copied_bytes, gboolean show_summary);
void file_progress_show_source (file_op_context_t * ctx, const vfs_path_t * vpath);
void file_progress_show_target (file_op_context_t * ctx, const vfs_path_t * vpath);
void file_progress_show_deleting (file_op_context_t * ctx, const char *path, size_t * count);
gboolean file_progress_show_deleting (file_op_context_t * ctx, const char *path, size_t * count);
/*** inline functions ****************************************************************************/
#endif /* MC__FILEGUI_H */