mirror of https://github.com/MidnightCommander/mc
* fileopctx.h: Add "operation" filed to FileOpContext.
* fileopctx.c (file_op_context_new): Add "operation" argument. * filegui.c (file_op_context_create_ui): Remove "operation" argument, it's known already. Adjust all callers.
This commit is contained in:
parent
74647ce584
commit
efff2a4d4e
|
@ -1,3 +1,10 @@
|
|||
2004-01-23 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* fileopctx.h: Add "operation" filed to FileOpContext.
|
||||
* fileopctx.c (file_op_context_new): Add "operation" argument.
|
||||
* filegui.c (file_op_context_create_ui): Remove "operation"
|
||||
argument, it's known already. Adjust all callers.
|
||||
|
||||
2004-01-23 Andrew V. Samoilov <sav@bcs.zp.ua>
|
||||
|
||||
* user.c (execute_menu_command): Put /bin/sh in the beginning of
|
||||
|
|
|
@ -577,8 +577,8 @@ check_for_default(char *default_file, char *file)
|
|||
if (mc_stat (default_file, &s)){
|
||||
return -1;
|
||||
}
|
||||
ctx = file_op_context_new ();
|
||||
file_op_context_create_ui (ctx, OP_COPY, 0);
|
||||
ctx = file_op_context_new (OP_COPY);
|
||||
file_op_context_create_ui (ctx, 0);
|
||||
copy_file_file (ctx, default_file, file, 1, &count, &bytes, 1);
|
||||
file_op_context_destroy (ctx);
|
||||
}
|
||||
|
|
|
@ -1826,7 +1826,7 @@ panel_operate (void *source_panel, FileOperation operation,
|
|||
/* Generate confirmation prompt */
|
||||
panel_operate_generate_prompt (panel, operation, source, &src_stat);
|
||||
|
||||
ctx = file_op_context_new ();
|
||||
ctx = file_op_context_new (operation);
|
||||
|
||||
/* Show confirmation dialog */
|
||||
if (operation == OP_DELETE && confirm_delete) {
|
||||
|
@ -1905,7 +1905,7 @@ panel_operate (void *source_panel, FileOperation operation,
|
|||
if (do_bg)
|
||||
ctx->ui = NULL;
|
||||
else
|
||||
file_op_context_create_ui (ctx, operation, 1);
|
||||
file_op_context_create_ui (ctx, 1);
|
||||
|
||||
/* This code is only called by the tree and panel code */
|
||||
if (single_entry) {
|
||||
|
|
|
@ -165,8 +165,7 @@ check_progress_buttons (FileOpContext *ctx)
|
|||
/* {{{ File progress display routines */
|
||||
|
||||
void
|
||||
file_op_context_create_ui (FileOpContext *ctx, FileOperation op,
|
||||
int with_eta)
|
||||
file_op_context_create_ui (FileOpContext *ctx, int with_eta)
|
||||
{
|
||||
FileOpContextUI *ui;
|
||||
int x_size;
|
||||
|
@ -195,8 +194,10 @@ file_op_context_create_ui (FileOpContext *ctx, FileOperation op,
|
|||
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 + 4, x_size, dialog_colors,
|
||||
NULL, NULL, op_names[op], DLG_CENTER | DLG_REVERSE);
|
||||
ui->op_dlg =
|
||||
create_dlg (0, 0, WY - minus + 4, x_size, dialog_colors, NULL,
|
||||
NULL, op_names[ctx->operation],
|
||||
DLG_CENTER | DLG_REVERSE);
|
||||
|
||||
last_hint_line = the_hint->widget.y;
|
||||
if ((ui->op_dlg->y + ui->op_dlg->lines) > last_hint_line)
|
||||
|
@ -213,22 +214,19 @@ file_op_context_create_ui (FileOpContext *ctx, FileOperation op,
|
|||
gauge_new (7, FCOPY_GAUGE_X, 0, 100, 0));
|
||||
add_widget (ui->op_dlg, ui->progress_label[2] =
|
||||
label_new (7, FCOPY_LABEL_X, fifteen));
|
||||
add_widget (ui->op_dlg, ui->bps_label =
|
||||
label_new (7, WX, ""));
|
||||
add_widget (ui->op_dlg, ui->bps_label = label_new (7, WX, ""));
|
||||
|
||||
add_widget (ui->op_dlg, ui->progress_gauge[1] =
|
||||
gauge_new (8, FCOPY_GAUGE_X, 0, 100, 0));
|
||||
add_widget (ui->op_dlg, ui->progress_label[1] =
|
||||
label_new (8, FCOPY_LABEL_X, fifteen));
|
||||
add_widget (ui->op_dlg, ui->stalled_label =
|
||||
label_new (8, 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->eta_label = label_new (6, WX, ""));
|
||||
|
||||
add_widget (ui->op_dlg, ui->file_string[1] =
|
||||
label_new (4, FCOPY_GAUGE_X, sixty));
|
||||
|
|
|
@ -36,11 +36,12 @@
|
|||
* Return value: The newly-created context, filled with the default file mask values.
|
||||
**/
|
||||
FileOpContext *
|
||||
file_op_context_new (void)
|
||||
file_op_context_new (FileOperation op)
|
||||
{
|
||||
FileOpContext *ctx;
|
||||
|
||||
ctx = g_new0 (FileOpContext, 1);
|
||||
ctx->operation = op;
|
||||
ctx->eta_secs = 0.0;
|
||||
ctx->progress_bytes = 0.0;
|
||||
ctx->op_preserve = TRUE;
|
||||
|
|
|
@ -13,6 +13,11 @@
|
|||
#include <sys/types.h>
|
||||
#include "eregex.h"
|
||||
|
||||
typedef enum {
|
||||
OP_COPY,
|
||||
OP_MOVE,
|
||||
OP_DELETE
|
||||
} FileOperation;
|
||||
|
||||
typedef int (*mc_stat_fn) (char *filename, struct stat *buf);
|
||||
|
||||
|
@ -20,6 +25,9 @@ typedef int (*mc_stat_fn) (char *filename, struct stat *buf);
|
|||
* the progress windows and pass around options.
|
||||
*/
|
||||
typedef struct FileOpContext {
|
||||
/* Operation type (copy, move, delete) */
|
||||
FileOperation operation;
|
||||
|
||||
/* The estimated time of arrival in seconds */
|
||||
double eta_secs;
|
||||
|
||||
|
@ -103,16 +111,10 @@ typedef struct FileOpContext {
|
|||
} FileOpContext;
|
||||
|
||||
|
||||
FileOpContext *file_op_context_new (void);
|
||||
FileOpContext *file_op_context_new (FileOperation op);
|
||||
void file_op_context_destroy (FileOpContext *ctx);
|
||||
|
||||
|
||||
typedef enum {
|
||||
OP_COPY,
|
||||
OP_MOVE,
|
||||
OP_DELETE
|
||||
} FileOperation;
|
||||
|
||||
extern char *op_names [3];
|
||||
|
||||
typedef enum {
|
||||
|
@ -138,7 +140,7 @@ enum OperationMode {
|
|||
|
||||
/* The following functions are implemented separately by each port */
|
||||
|
||||
void file_op_context_create_ui (FileOpContext *ctx, FileOperation op, int with_eta);
|
||||
void file_op_context_create_ui (FileOpContext *ctx, int with_eta);
|
||||
void file_op_context_destroy_ui (FileOpContext *ctx);
|
||||
|
||||
FileProgressStatus file_progress_show (FileOpContext *ctx, off_t done, off_t total);
|
||||
|
|
12
src/tree.c
12
src/tree.c
|
@ -600,8 +600,8 @@ static void tree_copy (WTree *tree, char *default_dest)
|
|||
return;
|
||||
}
|
||||
|
||||
ctx = file_op_context_new ();
|
||||
file_op_context_create_ui (ctx, OP_COPY, FALSE);
|
||||
ctx = file_op_context_new (OP_COPY);
|
||||
file_op_context_create_ui (ctx, FALSE);
|
||||
copy_dir_dir (ctx, tree->selected_ptr->name, dest, 1, 0, 0, 0, &count, &bytes);
|
||||
file_op_context_destroy (ctx);
|
||||
|
||||
|
@ -651,8 +651,8 @@ static void tree_move (WTree *tree, char *default_dest)
|
|||
return;
|
||||
}
|
||||
|
||||
ctx = file_op_context_new ();
|
||||
file_op_context_create_ui (ctx, OP_MOVE, FALSE);
|
||||
ctx = file_op_context_new (OP_MOVE);
|
||||
file_op_context_create_ui (ctx, FALSE);
|
||||
move_dir_dir (ctx, tree->selected_ptr->name, dest, &count, &bytes);
|
||||
file_op_context_destroy (ctx);
|
||||
|
||||
|
@ -711,8 +711,8 @@ tree_rmdir_cmd (WTree *tree)
|
|||
return;
|
||||
}
|
||||
|
||||
ctx = file_op_context_new ();
|
||||
file_op_context_create_ui (ctx, OP_DELETE, FALSE);
|
||||
ctx = file_op_context_new (OP_DELETE);
|
||||
file_op_context_create_ui (ctx, FALSE);
|
||||
if (erase_dir (ctx, tree->selected_ptr->name, &count, &bytes) ==
|
||||
FILE_CONT)
|
||||
tree_forget_cmd (tree);
|
||||
|
|
Loading…
Reference in New Issue