Change progressbar dialog.

* Minimizing dialog;
 * Optimizations of Copy/move progress dialog creation;
 * Added enum for specify dialog type (for copy/move or for delete)
 * Little optimization.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
This commit is contained in:
Slava Zanko 2010-02-23 17:24:08 +02:00
parent 88a374a432
commit e1d1e9254d
6 changed files with 189 additions and 236 deletions

View File

@ -49,6 +49,7 @@
#include "lib/vfs/mc-vfs/vfs.h"
#include "lib/strutil.h"
#include "src/filegui.h"
#include "src/file.h" /* copy_file_file() */
#ifndef HAVE_CHARSET
#include "src/main.h" /* eight_bit_clean */
@ -1445,7 +1446,7 @@ save_file_position (const char *filename, long line, long column, off_t offset)
/* put the new record */
if (line != 1 || column != 0) {
if (fprintf (f, "%s %ld;%ld;%li\n", filename, line, column, offset) < 0)
if (fprintf (f, "%s %ld;%ld;%llu\n", filename, line, column, offset) < 0)
goto write_position_error;
}

View File

@ -85,6 +85,9 @@
/* Hack: the vfs code should not rely on this */
#define WITH_FULL_PATHS 1
#define FILEOP_UPDATE_INTERVAL 2
#define FILEOP_STALLING_INTERVAL 4
int verbose = 1;
/*
@ -347,15 +350,23 @@ make_symlink (FileOpContext *ctx, const char *src_path, const char *dst_path)
static FileProgressStatus
progress_update_one (FileOpTotalContext *tctx, FileOpContext *ctx, off_t add, gboolean is_toplevel_file)
{
struct timeval tv_current;
static struct timeval tv_start = {};
if (is_toplevel_file || ctx->progress_totals_computed) {
tctx->progress_count++;
tctx->progress_bytes += add;
}
/* Apply some heuristic here to not call the update stuff very often */
file_progress_show_count (ctx, tctx->progress_count, ctx->progress_count);
file_progress_show_bytes (ctx, tctx->progress_bytes, ctx->progress_bytes);
if (tv_start.tv_sec == 0) {
gettimeofday (&tv_start, (struct timezone *) NULL);
}
gettimeofday (&tv_current, (struct timezone *) NULL);
if ((tv_current.tv_sec - tv_start.tv_sec) > FILEOP_UPDATE_INTERVAL)
{
file_progress_show_count (ctx, tctx->progress_count, ctx->progress_count);
file_progress_show_total (tctx, ctx, tctx->progress_bytes, TRUE);
tv_start.tv_sec = tv_current.tv_sec;
}
return check_progress_buttons (ctx);
}
@ -414,8 +425,6 @@ warn_same_file (const char *fmt, const char *a, const char *b)
}
#endif
#define FILEOP_UPDATE_INTERVAL 2
#define FILEOP_STALLING_INTERVAL 4
static void
copy_file_file_display_progress (FileOpTotalContext *tctx, FileOpContext *ctx,
struct timeval tv_current, struct timeval tv_transfer_start,
@ -648,9 +657,9 @@ copy_file_file (FileOpTotalContext *tctx, FileOpContext *ctx,
ctx->bps = 0;
if (tctx->bps == 0 || (file_size/(tctx->bps)) > FILEOP_UPDATE_INTERVAL) {
file_progress_show (ctx, 0, file_size);
file_progress_show (ctx, 0, file_size, "", TRUE);
} else {
file_progress_show (ctx, 1, 1);
file_progress_show (ctx, 1, 1, "", TRUE);
}
return_status = check_progress_buttons (ctx);
mc_refresh ();
@ -728,18 +737,17 @@ copy_file_file (FileOpTotalContext *tctx, FileOpContext *ctx,
if (update_secs > FILEOP_STALLING_INTERVAL) {
stalled_msg = _("(stalled)");
}
file_progress_set_stalled_label (ctx, stalled_msg);
{
gboolean force_update =
(tv_current.tv_sec - tctx->transfer_start.tv_sec) > FILEOP_UPDATE_INTERVAL;
file_progress_show_count (ctx, tctx->progress_count, ctx->progress_count);
file_progress_show_bytes (ctx, tctx->progress_bytes + n_read_total + ctx->do_reget,
ctx->progress_bytes);
file_progress_show_total (tctx, ctx, tctx->progress_bytes + n_read_total + ctx->do_reget,
force_update);
if ((ctx->progress_bytes != 0) && (tv_current.tv_sec - tctx->transfer_start.tv_sec) > FILEOP_UPDATE_INTERVAL) {
file_progress_show_total (tctx, ctx);
file_progress_show (ctx, n_read_total + ctx->do_reget, file_size, stalled_msg,
force_update);
}
file_progress_show (ctx, n_read_total + ctx->do_reget, file_size);
mc_refresh ();
return_status = check_progress_buttons (ctx);
@ -819,7 +827,6 @@ copy_file_file (FileOpTotalContext *tctx, FileOpContext *ctx,
return return_status;
}
#undef FILEOP_UPDATE_INTERVAL
/*
* I think these copy_*_* functions should have a return type.
* anyway, this function *must* have two directories as arguments.
@ -1121,7 +1128,7 @@ move_file_file (FileOpTotalContext *tctx, FileOpContext *ctx, const char *s, con
copy_done = TRUE;
file_progress_show_source (ctx, NULL);
file_progress_show (ctx, 0, 0);
file_progress_show (ctx, 0, 0, "", FALSE);
return_status = check_progress_buttons (ctx);
if (return_status != FILE_CONT)
@ -1225,7 +1232,7 @@ move_dir_dir (FileOpTotalContext *tctx, FileOpContext *ctx, const char *s, const
goto ret;
oktoret:
file_progress_show_source (ctx, NULL);
file_progress_show (ctx, 0, 0);
file_progress_show (ctx, 0, 0, "", FALSE);
return_status = check_progress_buttons (ctx);
if (return_status != FILE_CONT)
@ -2011,15 +2018,24 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
}
{
gboolean show_total = !((operation != OP_COPY) || (single_entry) || (force_single));
filegui_dialog_type_t dialog_type;
if (operation == OP_DELETE) {
dialog_type = FILEGUI_DIALOG_DELETE_ITEM;
} else {
dialog_type = !((operation != OP_COPY) || (single_entry) || (force_single))
? FILEGUI_DIALOG_MULTI_ITEM
: FILEGUI_DIALOG_ONE_ITEM;
if ((single_entry) && (operation == OP_COPY) && S_ISDIR (selection (panel)->st.st_mode))
dialog_type = FILEGUI_DIALOG_MULTI_ITEM;
}
if ((single_entry) && (operation == OP_COPY) && S_ISDIR (selection (panel)->st.st_mode))
show_total = TRUE;
/* Background also need ctx->ui, but not full */
if (do_bg)
file_op_context_create_ui_without_init (ctx, 1, show_total);
file_op_context_create_ui_without_init (ctx, 1, dialog_type);
else
file_op_context_create_ui (ctx, 1, show_total);
file_op_context_create_ui (ctx, 1, dialog_type);
}
#ifdef WITH_BACKGROUND
@ -2214,12 +2230,11 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
file_progress_show_count (ctx, tctx->progress_count, ctx->progress_count);
if (verbose) {
file_progress_show_bytes (ctx, tctx->progress_bytes, ctx->progress_bytes);
file_progress_show_total (tctx, ctx, tctx->progress_bytes, FALSE);
if (operation != OP_DELETE)
file_progress_show (ctx, 0, 0);
file_progress_show (ctx, 0, 0, "", FALSE);
}
if (check_progress_buttons (ctx) == FILE_ABORT)

View File

@ -129,17 +129,15 @@ typedef struct {
/* ETA and bps */
gboolean showing_eta;
gboolean showing_bps;
int eta_extra;
/* Dialog and widgets for the operation progress window */
Dlg_head *op_dlg;
WLabel *file_label[2];
WLabel *file_string[2];
WLabel *progress_label[2];
WGauge *progress_gauge[2];
WLabel *eta_label;
WLabel *bps_label;
WLabel *stalled_label;
WLabel *file_label[2];
WGauge *progress_file_gauge;
WLabel *progress_file_label;
WGauge *progress_total_gauge;
WLabel *total_files_processed_label;
WLabel *time_label;
@ -158,13 +156,9 @@ typedef struct {
static int last_hint_line;
/* File operate window sizes */
#define WX 62
#define WY 12
#define BY 12
#define WX_ETA_EXTRA 12
#define FCOPY_GAUGE_X 14
#define FCOPY_LABEL_X 5
#define WX 58
#define WY 11
#define FCOPY_LABEL_X 3
static gboolean
filegui__check_attrs_on_fs (const char *fs_path)
@ -248,42 +242,56 @@ check_progress_buttons (FileOpContext *ctx)
/* {{{ File progress display routines */
void
file_op_context_create_ui_without_init (FileOpContext *ctx, gboolean with_eta, gboolean show_total)
file_op_context_create_ui_without_init (FileOpContext *ctx, gboolean with_eta, filegui_dialog_type_t dialog_type)
{
FileOpContextUI *ui;
int x_size;
int minus, total_reserve=0;
int eta_offset;
const char *sixty;
const char *fifteen;
const char *abort_button_label = N_("&Abort");
const char *skip_button_label = N_("&Skip");
int abort_button_width, skip_button_width, buttons_width;
int dlg_width;
g_return_if_fail (ctx != NULL);
g_return_if_fail (ctx->ui == NULL);
#ifdef ENABLE_NLS
abort_button_label = _(abort_button_label);
skip_button_label = _(skip_button_label);
#endif
abort_button_width = str_term_width1 (abort_button_label) + 3;
skip_button_width = str_term_width1 (skip_button_label) + 3;
buttons_width = abort_button_width + skip_button_width + 2;
dlg_width = max (WX, buttons_width + 6);
ui = g_new0 (FileOpContextUI, 1);
ctx->ui = ui;
ctx->show_total = show_total;
ctx->dialog_type = dialog_type;
minus = verbose ? 0 : 3;
eta_offset = with_eta ? (WX_ETA_EXTRA) / 2 : 0;
if (show_total)
total_reserve = 3;
sixty = "";
fifteen = "";
switch (dialog_type) {
case FILEGUI_DIALOG_ONE_ITEM:
total_reserve = 0;
break;
case FILEGUI_DIALOG_MULTI_ITEM:
total_reserve = 5;
break;
case FILEGUI_DIALOG_DELETE_ITEM:
total_reserve = -5;
break;
}
ctx->recursive_result = RECURSIVE_YES;
ui->replace_result = REPLACE_YES;
ui->showing_eta = with_eta;
ui->showing_bps = with_eta;
ui->eta_extra = with_eta ? WX_ETA_EXTRA : 0;
x_size = (WX + 4) + ui->eta_extra;
ui->op_dlg =
create_dlg (0, 0, WY - minus + 1 + total_reserve, x_size, dialog_colors, NULL,
NULL, op_names[ctx->operation],
create_dlg (0, 0, WY - minus + 1 + total_reserve, dlg_width,
dialog_colors, NULL, NULL, op_names[ctx->operation],
DLG_CENTER | DLG_REVERSE);
last_hint_line = the_hint->widget.y;
@ -291,67 +299,65 @@ file_op_context_create_ui_without_init (FileOpContext *ctx, gboolean with_eta, g
the_hint->widget.y = ui->op_dlg->y + ui->op_dlg->lines + 1;
add_widget (ui->op_dlg,
button_new (BY - minus - 2 + total_reserve, WX - 19 + eta_offset, FILE_ABORT,
NORMAL_BUTTON, _("&Abort"), 0));
button_new (WY - minus - 2 + total_reserve,
dlg_width/2 + 1, FILE_ABORT,
NORMAL_BUTTON, abort_button_label, NULL));
add_widget (ui->op_dlg,
button_new (BY - minus - 2 + total_reserve, 14 + eta_offset, FILE_SKIP,
NORMAL_BUTTON, _("&Skip"), 0));
button_new (WY - minus - 2 + total_reserve,
dlg_width/2 - 1 - skip_button_width, FILE_SKIP,
NORMAL_BUTTON, skip_button_label, NULL));
if (show_total) {
add_widget (ui->op_dlg, ui->total_files_processed_label =
label_new (9, FCOPY_LABEL_X, ""));
if (dialog_type == FILEGUI_DIALOG_MULTI_ITEM) {
add_widget (ui->op_dlg, hline_new (8, 1, dlg_width - 2));
add_widget (ui->op_dlg, ui->total_bytes_label =
label_new (10, FCOPY_LABEL_X, ""));
label_new (8, FCOPY_LABEL_X + 15, ""));
add_widget (ui->op_dlg, ui->time_label =
add_widget (ui->op_dlg, ui->progress_total_gauge =
gauge_new (9, FCOPY_LABEL_X + 3, 0, 100, 0));
add_widget (ui->op_dlg, ui->total_files_processed_label =
label_new (11, FCOPY_LABEL_X, ""));
add_widget (ui->op_dlg, hline_new (8, 0, -1));
add_widget (ui->op_dlg, ui->time_label =
label_new (12, FCOPY_LABEL_X, ""));
}
add_widget (ui->op_dlg, ui->progress_gauge[1] =
gauge_new (7, FCOPY_GAUGE_X, 0, 100, 0));
add_widget (ui->op_dlg, ui->progress_label[1] =
label_new (7, FCOPY_LABEL_X, fifteen));
add_widget (ui->op_dlg, ui->progress_file_label =
label_new (7, FCOPY_LABEL_X, ""));
add_widget (ui->op_dlg, ui->bps_label = label_new (7, WX, ""));
add_widget (ui->op_dlg, ui->stalled_label = label_new (8, WX, ""));
add_widget (ui->op_dlg, ui->progress_gauge[0] =
gauge_new (6, FCOPY_GAUGE_X, 0, 100, 0));
add_widget (ui->op_dlg, ui->progress_label[0] =
label_new (6, FCOPY_LABEL_X, fifteen));
add_widget (ui->op_dlg, ui->eta_label = label_new (6, WX, ""));
add_widget (ui->op_dlg, ui->progress_file_gauge =
gauge_new (6, FCOPY_LABEL_X + 3, 0, 100, 0));
add_widget (ui->op_dlg, ui->file_string[1] =
label_new (4, FCOPY_GAUGE_X, sixty));
add_widget (ui->op_dlg, ui->file_label[1] =
label_new (4, FCOPY_LABEL_X, fifteen));
add_widget (ui->op_dlg, ui->file_string[0] =
label_new (3, FCOPY_GAUGE_X, sixty));
add_widget (ui->op_dlg, ui->file_label[0] =
label_new (3, FCOPY_LABEL_X, fifteen));
label_new (5, FCOPY_LABEL_X, ""));
if (
! mc_config_get_bool (mc_main_config,"Layout", "progressbar_always_left2right", TRUE) &&
right_panel == current_panel
) {
ui->progress_gauge[0]->from_left_to_right = FALSE;
ui->progress_gauge[1]->from_left_to_right = FALSE;
add_widget (ui->op_dlg, ui->file_label[1] =
label_new (4, FCOPY_LABEL_X, ""));
add_widget (ui->op_dlg, ui->file_string[0] =
label_new (3, FCOPY_LABEL_X, ""));
add_widget (ui->op_dlg, ui->file_label[0] =
label_new (2, FCOPY_LABEL_X, ""));
if ((right_panel == current_panel)
&& !mc_config_get_bool (mc_main_config,"Layout",
"progressbar_always_left2right", TRUE)) {
ui->progress_file_gauge->from_left_to_right = FALSE;
if (dialog_type == FILEGUI_DIALOG_MULTI_ITEM)
ui->progress_total_gauge->from_left_to_right = FALSE;
}
}
void
file_op_context_create_ui (FileOpContext *ctx, gboolean with_eta, gboolean show_total)
file_op_context_create_ui (FileOpContext *ctx, gboolean with_eta, filegui_dialog_type_t dialog_type)
{
FileOpContextUI *ui;
g_return_if_fail (ctx != NULL);
g_return_if_fail (ctx->ui == NULL);
file_op_context_create_ui_without_init (ctx, with_eta, show_total);
file_op_context_create_ui_without_init (ctx, with_eta, dialog_type);
ui = ctx->ui;
/* We will manage the dialog without any help, that's why
@ -380,41 +386,6 @@ file_op_context_destroy_ui (FileOpContext *ctx)
ctx->ui = NULL;
}
static void
show_no_bar (FileOpContext *ctx, int n)
{
FileOpContextUI *ui;
if (ctx->ui == NULL)
return;
ui = ctx->ui;
if (n >= 0) {
label_set_text (ui->progress_label[n], "");
gauge_show (ui->progress_gauge[n], 0);
}
}
static void
show_bar (FileOpContext *ctx, int n, double done, double total)
{
FileOpContextUI *ui;
if (ctx->ui == NULL)
return;
ui = ctx->ui;
/*
* Gauge needs integers, so give it with integers between 0 and 1023.
* This precision should be quite reasonable.
*/
gauge_set_value (ui->progress_gauge[n], 1024,
(int) (1024 * done / total));
gauge_show (ui->progress_gauge[n], 1);
}
static void
file_frmt_time (char *buffer, double eta_secs)
{
@ -438,23 +409,6 @@ file_eta_prepare_for_show (char *buffer, double eta_secs, gboolean always_show)
file_frmt_time (_fmt_buff, eta_secs);
g_snprintf (buffer, BUF_TINY, _("ETA %s"), _fmt_buff);
}
static void
file_eta_show (FileOpContext *ctx)
{
char eta_buffer[BUF_TINY];
FileOpContextUI *ui;
if (ctx->ui == NULL)
return;
ui = ctx->ui;
if (!ui->showing_eta)
return;
file_eta_prepare_for_show (eta_buffer, ctx->eta_secs, FALSE);
label_set_text (ui->eta_label, eta_buffer);
}
static void
file_bps_prepare_for_show (char *buffer, long bps)
@ -472,29 +426,17 @@ file_bps_prepare_for_show (char *buffer, long bps)
*buffer = 0;
}
static void
file_bps_show (FileOpContext *ctx)
{
char bps_buffer[BUF_TINY];
FileOpContextUI *ui;
if (ctx->ui == NULL)
return;
ui = ctx->ui;
if (!ui->showing_bps)
return;
file_bps_prepare_for_show (bps_buffer, ctx->bps);
label_set_text (ui->bps_label, bps_buffer);
}
/*
show progressbar for file
*/
void
file_progress_show (FileOpContext *ctx, off_t done, off_t total)
file_progress_show (FileOpContext *ctx, off_t done, off_t total,
const char *stalled_msg, gboolean force_update)
{
FileOpContextUI *ui;
char buffer[BUF_TINY];
char buffer2[BUF_TINY];
char buffer3[BUF_TINY];
g_return_if_fail (ctx != NULL);
@ -506,13 +448,26 @@ file_progress_show (FileOpContext *ctx, off_t done, off_t total)
if (!verbose)
return;
if (total > 0) {
label_set_text (ui->progress_label[0], _("File"));
file_eta_show (ctx);
file_bps_show (ctx);
show_bar (ctx, 0, done, total);
} else
show_no_bar (ctx, 0);
if (total == 0) {
gauge_show (ui->progress_file_gauge, 0);
return;
}
gauge_set_value (ui->progress_file_gauge, 1024, (int) (1024 * done / total));
gauge_show (ui->progress_file_gauge, 1);
if (!force_update)
return;
if (ui->showing_eta && ctx->eta_secs > 0.5) {
file_eta_prepare_for_show (buffer2, ctx->eta_secs, FALSE);
file_bps_prepare_for_show (buffer3, ctx->bps);
g_snprintf (buffer, BUF_TINY, "%s (%s) %s", buffer2, buffer3, stalled_msg);
} else {
g_snprintf (buffer, BUF_TINY, "%s",stalled_msg);
}
label_set_text (ui->progress_file_label, buffer);
}
void
@ -523,7 +478,7 @@ file_progress_show_count (FileOpContext *ctx, off_t done, off_t total)
g_return_if_fail (ctx != NULL);
if (!ctx->show_total || ctx->ui == NULL)
if (ctx->dialog_type != FILEGUI_DIALOG_MULTI_ITEM || ctx->ui == NULL)
return;
ui = ctx->ui;
@ -537,29 +492,8 @@ file_progress_show_count (FileOpContext *ctx, off_t done, off_t total)
}
void
file_progress_show_bytes (FileOpContext *ctx, double done, double total)
{
FileOpContextUI *ui;
g_return_if_fail (ctx != NULL);
if (ctx->ui == NULL)
return;
ui = ctx->ui;
if (!verbose)
return;
if (total > 0) {
label_set_text (ui->progress_label[1], _("Bytes"));
show_bar (ctx, 1, done, total);
} else
show_no_bar (ctx, 1);
}
void
file_progress_show_total (FileOpTotalContext *tctx, FileOpContext *ctx)
file_progress_show_total (FileOpTotalContext *tctx, FileOpContext *ctx, double copyed_bytes,
gboolean need_show_total_summary)
{
char buffer[BUF_TINY];
char buffer2[BUF_TINY];
@ -568,35 +502,44 @@ file_progress_show_total (FileOpTotalContext *tctx, FileOpContext *ctx)
struct timeval tv_current;
FileOpContextUI *ui;
if (!ctx->show_total || ctx->ui == NULL || tctx->bps == 0)
if (ctx->dialog_type != FILEGUI_DIALOG_MULTI_ITEM || ctx->ui == NULL)
return;
ui = ctx->ui;
if (!verbose)
return;
if (ctx->progress_bytes > 0 ){
gauge_set_value (ui->progress_total_gauge, 1024, (int) (1024 * copyed_bytes/ ctx->progress_bytes));
gauge_show (ui->progress_total_gauge, 1);
} else
gauge_show (ui->progress_total_gauge, 0);
if (!need_show_total_summary && tctx->bps == 0)
return;
gettimeofday (&tv_current, NULL);
file_frmt_time (buffer2, tv_current.tv_sec - tctx->transfer_start.tv_sec);
file_eta_prepare_for_show (buffer3, tctx->eta_secs, TRUE);
file_bps_prepare_for_show (buffer4, (long) tctx->bps);
g_snprintf (buffer, BUF_TINY, _("Time: %s ; %s"), buffer2, buffer3);
g_snprintf (buffer, BUF_TINY, _("Time: %s %s (%s)"), buffer2, buffer3, buffer4);
label_set_text (ui->time_label, buffer);
file_bps_prepare_for_show (buffer2, (long) tctx->bps);
size_trunc_len (buffer3, 5, tctx->copyed_bytes, 0);
size_trunc_len (buffer4, 5, ctx->progress_bytes, 0);
size_trunc_len (buffer2, 5, tctx->copyed_bytes, 0);
size_trunc_len (buffer3, 5, ctx->progress_bytes, 0);
g_snprintf (buffer, BUF_TINY, _("Total: %s of %s (%s)"), buffer3, buffer4, buffer2);
g_snprintf (buffer, BUF_TINY, _(" Total: %s of %s "), buffer2, buffer3);
label_set_text (ui->total_bytes_label, buffer);
}
/* }}} */
#define truncFileString(ui, s) str_trunc (s, ui->eta_extra + 47)
#define truncFileStringSecure(ui, s) path_trunc (s, ui->eta_extra + 47)
#define truncFileString(ui, s) str_trunc (s, 52)
#define truncFileStringSecure(ui, s) path_trunc (s, 52)
void
file_progress_show_source (FileOpContext *ctx, const char *s)
@ -661,7 +604,6 @@ file_progress_show_deleting (FileOpContext *ctx, const char *s)
return;
ui = ctx->ui;
label_set_text (ui->file_label[0], _("Deleting"));
label_set_text (ui->file_label[0], truncFileStringSecure (ui, s));
}
@ -841,18 +783,6 @@ overwrite_query_dialog (FileOpContext *ctx, enum OperationMode mode)
#undef ADD_RD_BUTTON
}
void
file_progress_set_stalled_label (FileOpContext *ctx, const char *stalled_msg)
{
FileOpContextUI *ui;
g_return_if_fail (ctx != NULL);
g_return_if_fail (ctx->ui != NULL);
ui = ctx->ui;
label_set_text (ui->stalled_label, stalled_msg);
}
FileProgressStatus
file_progress_real_query_replace (FileOpContext *ctx,
enum OperationMode mode, const char *destname,

View File

@ -9,6 +9,17 @@
#include "lib/global.h"
#include "fileopctx.h"
typedef enum {
FILEGUI_DIALOG_ONE_ITEM,
FILEGUI_DIALOG_MULTI_ITEM,
FILEGUI_DIALOG_DELETE_ITEM
} filegui_dialog_type_t;
void file_op_context_create_ui (FileOpContext *ctx, gboolean with_eta, filegui_dialog_type_t dialog_type);
void file_op_context_create_ui_without_init (FileOpContext *ctx, gboolean with_eta, filegui_dialog_type_t dialog_type);
void file_op_context_destroy_ui (FileOpContext *ctx);
char *file_mask_dialog (FileOpContext *ctx, FileOperation operation,
gboolean only_one,
const char *format, const void *text,
@ -16,10 +27,11 @@ char *file_mask_dialog (FileOpContext *ctx, FileOperation operation,
FileProgressStatus check_progress_buttons (FileOpContext *ctx);
void file_progress_show (FileOpContext *ctx, off_t done, off_t total);
void file_progress_show (FileOpContext *ctx, off_t done, off_t total,
const char *stalled_msg, gboolean force_update);
void file_progress_show_count (FileOpContext *ctx, off_t done, off_t total);
void file_progress_show_bytes (FileOpContext *ctx, double done, double total);
void file_progress_show_total (FileOpTotalContext *tctx, FileOpContext *ctx);
void file_progress_show_total (FileOpTotalContext *tctx, FileOpContext *ctx,
double copyed_bytes, gboolean need_show_total_summary);
void file_progress_show_source (FileOpContext *ctx, const char *path);
void file_progress_show_target (FileOpContext *ctx, const char *path);
void file_progress_show_deleting (FileOpContext *ctx, const char *path);

View File

@ -57,7 +57,7 @@ typedef struct FileOpContext {
/* Whether the panel total has been computed */
gboolean progress_totals_computed;
gboolean show_total;
int dialog_type;
/* Counters for progress indicators */
off_t progress_count;
@ -166,12 +166,6 @@ enum OperationMode {
/* The following functions are implemented separately by each port */
void file_op_context_create_ui (FileOpContext *ctx, gboolean with_eta, gboolean show_total);
void file_op_context_create_ui_without_init (FileOpContext *ctx, gboolean with_eta, gboolean show_total);
void file_op_context_destroy_ui (FileOpContext *ctx);
void file_progress_set_stalled_label (FileOpContext *ctx, const char *stalled_msg);
FileProgressStatus file_progress_real_query_replace (FileOpContext *ctx,
enum OperationMode mode,
const char *destname,

View File

@ -66,6 +66,7 @@
#include "keybind.h"
#include "history.h"
#include "tree.h"
#include "filegui.h"
const global_keymap_t *tree_map;
@ -649,7 +650,7 @@ tree_copy (WTree *tree, const char *default_dest)
ctx = file_op_context_new (OP_COPY);
tctx = file_op_total_context_new ();
file_op_context_create_ui (ctx, FALSE, TRUE);
file_op_context_create_ui (ctx, FALSE, FILEGUI_DIALOG_MULTI_ITEM);
tctx->ask_overwrite = FALSE;
tctx->is_toplevel_file = FALSE;
copy_dir_dir (tctx, ctx, tree->selected_ptr->name, dest, TRUE, FALSE, FALSE, NULL);
@ -697,7 +698,7 @@ tree_move (WTree *tree, const char *default_dest)
ctx = file_op_context_new (OP_MOVE);
tctx = file_op_total_context_new ();
file_op_context_create_ui (ctx, FALSE, FALSE);
file_op_context_create_ui (ctx, FALSE, FILEGUI_DIALOG_ONE_ITEM);
move_dir_dir (tctx, ctx, tree->selected_ptr->name, dest);
file_op_total_context_destroy (tctx);
file_op_context_destroy (ctx);
@ -752,7 +753,7 @@ tree_rmdir (void *data)
ctx = file_op_context_new (OP_DELETE);
tctx = file_op_total_context_new ();
file_op_context_create_ui (ctx, FALSE, FALSE);
file_op_context_create_ui (ctx, FALSE, FILEGUI_DIALOG_ONE_ITEM);
if (erase_dir (tctx, ctx, tree->selected_ptr->name) == FILE_CONT)
tree_forget (tree);
file_op_total_context_destroy (tctx);