* 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.
Этот коммит содержится в:
родитель
74647ce584
Коммит
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>
|
2004-01-23 Andrew V. Samoilov <sav@bcs.zp.ua>
|
||||||
|
|
||||||
* user.c (execute_menu_command): Put /bin/sh in the beginning of
|
* 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)){
|
if (mc_stat (default_file, &s)){
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
ctx = file_op_context_new ();
|
ctx = file_op_context_new (OP_COPY);
|
||||||
file_op_context_create_ui (ctx, OP_COPY, 0);
|
file_op_context_create_ui (ctx, 0);
|
||||||
copy_file_file (ctx, default_file, file, 1, &count, &bytes, 1);
|
copy_file_file (ctx, default_file, file, 1, &count, &bytes, 1);
|
||||||
file_op_context_destroy (ctx);
|
file_op_context_destroy (ctx);
|
||||||
}
|
}
|
||||||
|
@ -1826,7 +1826,7 @@ panel_operate (void *source_panel, FileOperation operation,
|
|||||||
/* Generate confirmation prompt */
|
/* Generate confirmation prompt */
|
||||||
panel_operate_generate_prompt (panel, operation, source, &src_stat);
|
panel_operate_generate_prompt (panel, operation, source, &src_stat);
|
||||||
|
|
||||||
ctx = file_op_context_new ();
|
ctx = file_op_context_new (operation);
|
||||||
|
|
||||||
/* Show confirmation dialog */
|
/* Show confirmation dialog */
|
||||||
if (operation == OP_DELETE && confirm_delete) {
|
if (operation == OP_DELETE && confirm_delete) {
|
||||||
@ -1905,7 +1905,7 @@ panel_operate (void *source_panel, FileOperation operation,
|
|||||||
if (do_bg)
|
if (do_bg)
|
||||||
ctx->ui = NULL;
|
ctx->ui = NULL;
|
||||||
else
|
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 */
|
/* This code is only called by the tree and panel code */
|
||||||
if (single_entry) {
|
if (single_entry) {
|
||||||
|
@ -165,8 +165,7 @@ check_progress_buttons (FileOpContext *ctx)
|
|||||||
/* {{{ File progress display routines */
|
/* {{{ File progress display routines */
|
||||||
|
|
||||||
void
|
void
|
||||||
file_op_context_create_ui (FileOpContext *ctx, FileOperation op,
|
file_op_context_create_ui (FileOpContext *ctx, int with_eta)
|
||||||
int with_eta)
|
|
||||||
{
|
{
|
||||||
FileOpContextUI *ui;
|
FileOpContextUI *ui;
|
||||||
int x_size;
|
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;
|
ui->eta_extra = with_eta ? WX_ETA_EXTRA : 0;
|
||||||
x_size = (WX + 4) + ui->eta_extra;
|
x_size = (WX + 4) + ui->eta_extra;
|
||||||
|
|
||||||
ui->op_dlg = create_dlg (0, 0, WY - minus + 4, x_size, dialog_colors,
|
ui->op_dlg =
|
||||||
NULL, NULL, op_names[op], DLG_CENTER | DLG_REVERSE);
|
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;
|
last_hint_line = the_hint->widget.y;
|
||||||
if ((ui->op_dlg->y + ui->op_dlg->lines) > last_hint_line)
|
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));
|
gauge_new (7, FCOPY_GAUGE_X, 0, 100, 0));
|
||||||
add_widget (ui->op_dlg, ui->progress_label[2] =
|
add_widget (ui->op_dlg, ui->progress_label[2] =
|
||||||
label_new (7, FCOPY_LABEL_X, fifteen));
|
label_new (7, FCOPY_LABEL_X, fifteen));
|
||||||
add_widget (ui->op_dlg, ui->bps_label =
|
add_widget (ui->op_dlg, ui->bps_label = label_new (7, WX, ""));
|
||||||
label_new (7, WX, ""));
|
|
||||||
|
|
||||||
add_widget (ui->op_dlg, ui->progress_gauge[1] =
|
add_widget (ui->op_dlg, ui->progress_gauge[1] =
|
||||||
gauge_new (8, FCOPY_GAUGE_X, 0, 100, 0));
|
gauge_new (8, FCOPY_GAUGE_X, 0, 100, 0));
|
||||||
add_widget (ui->op_dlg, ui->progress_label[1] =
|
add_widget (ui->op_dlg, ui->progress_label[1] =
|
||||||
label_new (8, FCOPY_LABEL_X, fifteen));
|
label_new (8, FCOPY_LABEL_X, fifteen));
|
||||||
add_widget (ui->op_dlg, ui->stalled_label =
|
add_widget (ui->op_dlg, ui->stalled_label = label_new (8, WX, ""));
|
||||||
label_new (8, WX, ""));
|
|
||||||
|
|
||||||
add_widget (ui->op_dlg, ui->progress_gauge[0] =
|
add_widget (ui->op_dlg, ui->progress_gauge[0] =
|
||||||
gauge_new (6, FCOPY_GAUGE_X, 0, 100, 0));
|
gauge_new (6, FCOPY_GAUGE_X, 0, 100, 0));
|
||||||
add_widget (ui->op_dlg, ui->progress_label[0] =
|
add_widget (ui->op_dlg, ui->progress_label[0] =
|
||||||
label_new (6, FCOPY_LABEL_X, fifteen));
|
label_new (6, FCOPY_LABEL_X, fifteen));
|
||||||
add_widget (ui->op_dlg, ui->eta_label =
|
add_widget (ui->op_dlg, ui->eta_label = label_new (6, WX, ""));
|
||||||
label_new (6, WX, ""));
|
|
||||||
|
|
||||||
add_widget (ui->op_dlg, ui->file_string[1] =
|
add_widget (ui->op_dlg, ui->file_string[1] =
|
||||||
label_new (4, FCOPY_GAUGE_X, sixty));
|
label_new (4, FCOPY_GAUGE_X, sixty));
|
||||||
|
@ -36,11 +36,12 @@
|
|||||||
* Return value: The newly-created context, filled with the default file mask values.
|
* Return value: The newly-created context, filled with the default file mask values.
|
||||||
**/
|
**/
|
||||||
FileOpContext *
|
FileOpContext *
|
||||||
file_op_context_new (void)
|
file_op_context_new (FileOperation op)
|
||||||
{
|
{
|
||||||
FileOpContext *ctx;
|
FileOpContext *ctx;
|
||||||
|
|
||||||
ctx = g_new0 (FileOpContext, 1);
|
ctx = g_new0 (FileOpContext, 1);
|
||||||
|
ctx->operation = op;
|
||||||
ctx->eta_secs = 0.0;
|
ctx->eta_secs = 0.0;
|
||||||
ctx->progress_bytes = 0.0;
|
ctx->progress_bytes = 0.0;
|
||||||
ctx->op_preserve = TRUE;
|
ctx->op_preserve = TRUE;
|
||||||
|
@ -13,6 +13,11 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include "eregex.h"
|
#include "eregex.h"
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
OP_COPY,
|
||||||
|
OP_MOVE,
|
||||||
|
OP_DELETE
|
||||||
|
} FileOperation;
|
||||||
|
|
||||||
typedef int (*mc_stat_fn) (char *filename, struct stat *buf);
|
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.
|
* the progress windows and pass around options.
|
||||||
*/
|
*/
|
||||||
typedef struct FileOpContext {
|
typedef struct FileOpContext {
|
||||||
|
/* Operation type (copy, move, delete) */
|
||||||
|
FileOperation operation;
|
||||||
|
|
||||||
/* The estimated time of arrival in seconds */
|
/* The estimated time of arrival in seconds */
|
||||||
double eta_secs;
|
double eta_secs;
|
||||||
|
|
||||||
@ -103,16 +111,10 @@ typedef struct FileOpContext {
|
|||||||
} FileOpContext;
|
} FileOpContext;
|
||||||
|
|
||||||
|
|
||||||
FileOpContext *file_op_context_new (void);
|
FileOpContext *file_op_context_new (FileOperation op);
|
||||||
void file_op_context_destroy (FileOpContext *ctx);
|
void file_op_context_destroy (FileOpContext *ctx);
|
||||||
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
OP_COPY,
|
|
||||||
OP_MOVE,
|
|
||||||
OP_DELETE
|
|
||||||
} FileOperation;
|
|
||||||
|
|
||||||
extern char *op_names [3];
|
extern char *op_names [3];
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@ -138,7 +140,7 @@ enum OperationMode {
|
|||||||
|
|
||||||
/* The following functions are implemented separately by each port */
|
/* 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);
|
void file_op_context_destroy_ui (FileOpContext *ctx);
|
||||||
|
|
||||||
FileProgressStatus file_progress_show (FileOpContext *ctx, off_t done, off_t total);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx = file_op_context_new ();
|
ctx = file_op_context_new (OP_COPY);
|
||||||
file_op_context_create_ui (ctx, OP_COPY, FALSE);
|
file_op_context_create_ui (ctx, FALSE);
|
||||||
copy_dir_dir (ctx, tree->selected_ptr->name, dest, 1, 0, 0, 0, &count, &bytes);
|
copy_dir_dir (ctx, tree->selected_ptr->name, dest, 1, 0, 0, 0, &count, &bytes);
|
||||||
file_op_context_destroy (ctx);
|
file_op_context_destroy (ctx);
|
||||||
|
|
||||||
@ -651,8 +651,8 @@ static void tree_move (WTree *tree, char *default_dest)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx = file_op_context_new ();
|
ctx = file_op_context_new (OP_MOVE);
|
||||||
file_op_context_create_ui (ctx, OP_MOVE, FALSE);
|
file_op_context_create_ui (ctx, FALSE);
|
||||||
move_dir_dir (ctx, tree->selected_ptr->name, dest, &count, &bytes);
|
move_dir_dir (ctx, tree->selected_ptr->name, dest, &count, &bytes);
|
||||||
file_op_context_destroy (ctx);
|
file_op_context_destroy (ctx);
|
||||||
|
|
||||||
@ -711,8 +711,8 @@ tree_rmdir_cmd (WTree *tree)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx = file_op_context_new ();
|
ctx = file_op_context_new (OP_DELETE);
|
||||||
file_op_context_create_ui (ctx, OP_DELETE, FALSE);
|
file_op_context_create_ui (ctx, FALSE);
|
||||||
if (erase_dir (ctx, tree->selected_ptr->name, &count, &bytes) ==
|
if (erase_dir (ctx, tree->selected_ptr->name, &count, &bytes) ==
|
||||||
FILE_CONT)
|
FILE_CONT)
|
||||||
tree_forget_cmd (tree);
|
tree_forget_cmd (tree);
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user