Rename structures:

* FileOpContext -> file_op_context_t
* FileOpContextUI -> file_op_context_ui_t

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
Slava Zanko 2013-10-10 15:34:19 +03:00 committed by Andrew Borodin
parent 0ed4a91d7d
commit e351822191
10 changed files with 96 additions and 98 deletions

View File

@ -51,7 +51,7 @@
#include "lib/widget.h" /* message() */ #include "lib/widget.h" /* message() */
#include "lib/event-types.h" #include "lib/event-types.h"
#include "filemanager/fileopctx.h" /* FileOpContext */ #include "filemanager/fileopctx.h" /* file_op_context_t */
#include "background.h" #include "background.h"
@ -85,7 +85,7 @@ static int background_attention (int fd, void *closure);
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
static void static void
register_task_running (FileOpContext * ctx, pid_t pid, int fd, int to_child, char *info) register_task_running (file_op_context_t * ctx, pid_t pid, int fd, int to_child, char *info)
{ {
TaskList *new; TaskList *new;
@ -173,7 +173,7 @@ destroy_task_and_return_fd (pid_t pid)
static int static int
background_attention (int fd, void *closure) background_attention (int fd, void *closure)
{ {
FileOpContext *ctx; file_op_context_t *ctx;
int have_ctx; int have_ctx;
union union
{ {
@ -183,11 +183,11 @@ background_attention (int fd, void *closure)
int (*have_ctx3) (int, char *, char *, char *); int (*have_ctx3) (int, char *, char *, char *);
int (*have_ctx4) (int, char *, char *, char *, char *); int (*have_ctx4) (int, char *, char *, char *, char *);
int (*non_have_ctx0) (FileOpContext *, int); int (*non_have_ctx0) (file_op_context_t *, int);
int (*non_have_ctx1) (FileOpContext *, int, char *); int (*non_have_ctx1) (file_op_context_t *, int, char *);
int (*non_have_ctx2) (FileOpContext *, int, char *, char *); int (*non_have_ctx2) (file_op_context_t *, int, char *, char *);
int (*non_have_ctx3) (FileOpContext *, int, char *, char *, char *); int (*non_have_ctx3) (file_op_context_t *, int, char *, char *, char *);
int (*non_have_ctx4) (FileOpContext *, int, char *, char *, char *, char *); int (*non_have_ctx4) (file_op_context_t *, int, char *, char *, char *, char *);
char *(*ret_str0) (); char *(*ret_str0) ();
char *(*ret_str1) (char *); char *(*ret_str1) (char *);
@ -247,7 +247,7 @@ background_attention (int fd, void *closure)
if (have_ctx) if (have_ctx)
{ {
if (read (fd, ctx, sizeof (FileOpContext)) != sizeof (FileOpContext)) if (read (fd, ctx, sizeof (file_op_context_t)) != sizeof (file_op_context_t))
{ {
message (D_ERROR, _("Background protocol error"), _("Reading failed")); message (D_ERROR, _("Background protocol error"), _("Reading failed"));
return 0; return 0;
@ -332,7 +332,7 @@ background_attention (int fd, void *closure)
/* Send the result code and the value for shared variables */ /* Send the result code and the value for shared variables */
ret = write (to_child_fd, &result, sizeof (int)); ret = write (to_child_fd, &result, sizeof (int));
if (have_ctx && to_child_fd != -1) if (have_ctx && to_child_fd != -1)
ret = write (to_child_fd, ctx, sizeof (FileOpContext)); ret = write (to_child_fd, ctx, sizeof (file_op_context_t));
} }
else if (type == Return_String) else if (type == Return_String)
{ {
@ -396,7 +396,7 @@ background_attention (int fd, void *closure)
*/ */
static void static void
parent_call_header (void *routine, int argc, enum ReturnType type, FileOpContext * ctx) parent_call_header (void *routine, int argc, enum ReturnType type, file_op_context_t * ctx)
{ {
int have_ctx; int have_ctx;
ssize_t ret; ssize_t ret;
@ -409,7 +409,7 @@ parent_call_header (void *routine, int argc, enum ReturnType type, FileOpContext
ret = write (parent_fd, &have_ctx, sizeof (have_ctx)); ret = write (parent_fd, &have_ctx, sizeof (have_ctx));
if (have_ctx) if (have_ctx)
ret = write (parent_fd, ctx, sizeof (FileOpContext)); ret = write (parent_fd, ctx, sizeof (file_op_context_t));
(void) ret; (void) ret;
} }
@ -420,7 +420,7 @@ parent_va_call (void *routine, gpointer data, int argc, va_list ap)
{ {
int i; int i;
ssize_t ret; ssize_t ret;
struct FileOpContext *ctx = (struct FileOpContext *) data; file_op_context_t *ctx = (file_op_context_t *) data;
parent_call_header (routine, argc, Return_Integer, ctx); parent_call_header (routine, argc, Return_Integer, ctx);
for (i = 0; i < argc; i++) for (i = 0; i < argc; i++)
@ -436,7 +436,7 @@ parent_va_call (void *routine, gpointer data, int argc, va_list ap)
ret = read (from_parent_fd, &i, sizeof (int)); ret = read (from_parent_fd, &i, sizeof (int));
if (ctx) if (ctx)
ret = read (from_parent_fd, ctx, sizeof (FileOpContext)); ret = read (from_parent_fd, ctx, sizeof (file_op_context_t));
(void) ret; (void) ret;
return i; return i;
@ -511,7 +511,7 @@ unregister_task_with_pid (pid_t pid)
* -1 on failure * -1 on failure
*/ */
int int
do_background (struct FileOpContext *ctx, char *info) do_background (file_op_context_t * ctx, char *info)
{ {
int comm[2]; /* control connection stream */ int comm[2]; /* control connection stream */
int back_comm[2]; /* back connection */ int back_comm[2]; /* back connection */
@ -575,7 +575,7 @@ do_background (struct FileOpContext *ctx, char *info)
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
int int
parent_call (void *routine, struct FileOpContext *ctx, int argc, ...) parent_call (void *routine, file_op_context_t * ctx, int argc, ...)
{ {
int ret; int ret;
va_list ap; va_list ap;

View File

@ -6,7 +6,7 @@
#define MC__BACKGROUND_H #define MC__BACKGROUND_H
#include <sys/types.h> /* pid_t */ #include <sys/types.h> /* pid_t */
#include "filemanager/fileopctx.h"
/*** typedefs(not structures) and defined constants **********************************************/ /*** typedefs(not structures) and defined constants **********************************************/
enum TaskState enum TaskState
@ -25,8 +25,6 @@ typedef struct TaskList
struct TaskList *next; struct TaskList *next;
} TaskList; } TaskList;
struct FileOpContext;
/*** enums ***************************************************************************************/ /*** enums ***************************************************************************************/
/*** structures declarations (and typedefs of structures)*****************************************/ /*** structures declarations (and typedefs of structures)*****************************************/
@ -37,8 +35,8 @@ extern struct TaskList *task_list;
/*** declarations of public functions ************************************************************/ /*** declarations of public functions ************************************************************/
int do_background (struct FileOpContext *ctx, char *info); int do_background (file_op_context_t * ctx, char *info);
int parent_call (void *routine, struct FileOpContext *ctx, int argc, ...); int parent_call (void *routine, file_op_context_t * ctx, int argc, ...);
char *parent_call_string (void *routine, int argc, ...); char *parent_call_string (void *routine, int argc, ...);
void unregister_task_running (pid_t pid, int fd); void unregister_task_running (pid_t pid, int fd);

View File

@ -196,7 +196,7 @@ static FileProgressStatus transform_error = FILE_CONT;
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
static char * static char *
transform_source (FileOpContext * ctx, const vfs_path_t * source_vpath) transform_source (file_op_context_t * ctx, const vfs_path_t * source_vpath)
{ {
char *s, *q; char *s, *q;
char *fnsource; char *fnsource;
@ -354,7 +354,7 @@ check_hardlinks (const vfs_path_t * src_vpath, const vfs_path_t * dst_vpath, str
*/ */
static FileProgressStatus static FileProgressStatus
make_symlink (FileOpContext * ctx, const char *src_path, const char *dst_path) make_symlink (file_op_context_t * ctx, const char *src_path, const char *dst_path)
{ {
char link_target[MC_MAXPATHLEN]; char link_target[MC_MAXPATHLEN];
int len; int len;
@ -565,7 +565,7 @@ do_compute_dir_size (const vfs_path_t * dirname_vpath, void *ui,
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
static FileProgressStatus static FileProgressStatus
progress_update_one (FileOpTotalContext * tctx, FileOpContext * ctx, off_t add) progress_update_one (FileOpTotalContext * tctx, file_op_context_t * ctx, off_t add)
{ {
struct timeval tv_current; struct timeval tv_current;
static struct timeval tv_start = { }; static struct timeval tv_start = { };
@ -669,7 +669,7 @@ real_do_file_error (enum OperationMode mode, const char *error)
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
static FileProgressStatus static FileProgressStatus
real_query_recursive (FileOpContext * ctx, enum OperationMode mode, const char *s) real_query_recursive (file_op_context_t * ctx, enum OperationMode mode, const char *s)
{ {
if (ctx->recursive_result < RECURSIVE_ALWAYS) if (ctx->recursive_result < RECURSIVE_ALWAYS)
@ -733,12 +733,12 @@ do_file_error (const char *str)
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
static FileProgressStatus static FileProgressStatus
query_recursive (FileOpContext * ctx, const char *s) query_recursive (file_op_context_t * ctx, const char *s)
{ {
union union
{ {
void *p; void *p;
FileProgressStatus (*f) (FileOpContext *, enum OperationMode, const char *); FileProgressStatus (*f) (file_op_context_t *, enum OperationMode, const char *);
} pntr; } pntr;
pntr.f = real_query_recursive; pntr.f = real_query_recursive;
@ -751,13 +751,13 @@ query_recursive (FileOpContext * ctx, const char *s)
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
static FileProgressStatus static FileProgressStatus
query_replace (FileOpContext * ctx, const char *destname, struct stat *_s_stat, query_replace (file_op_context_t * ctx, const char *destname, struct stat *_s_stat,
struct stat *_d_stat) struct stat *_d_stat)
{ {
union union
{ {
void *p; void *p;
FileProgressStatus (*f) (FileOpContext *, enum OperationMode, const char *, FileProgressStatus (*f) (file_op_context_t *, enum OperationMode, const char *,
struct stat *, struct stat *); struct stat *, struct stat *);
} pntr; } pntr;
pntr.f = file_progress_real_query_replace; pntr.f = file_progress_real_query_replace;
@ -781,7 +781,7 @@ do_file_error (const char *str)
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
static FileProgressStatus static FileProgressStatus
query_recursive (FileOpContext * ctx, const char *s) query_recursive (file_op_context_t * ctx, const char *s)
{ {
return real_query_recursive (ctx, Foreground, s); return real_query_recursive (ctx, Foreground, s);
} }
@ -789,7 +789,7 @@ query_recursive (FileOpContext * ctx, const char *s)
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
static FileProgressStatus static FileProgressStatus
query_replace (FileOpContext * ctx, const char *destname, struct stat *_s_stat, query_replace (file_op_context_t * ctx, const char *destname, struct stat *_s_stat,
struct stat *_d_stat) struct stat *_d_stat)
{ {
return file_progress_real_query_replace (ctx, Foreground, destname, _s_stat, _d_stat); return file_progress_real_query_replace (ctx, Foreground, destname, _s_stat, _d_stat);
@ -820,7 +820,7 @@ files_error (const char *format, const char *file1, const char *file2)
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
static void static void
copy_file_file_display_progress (FileOpTotalContext * tctx, FileOpContext * ctx, copy_file_file_display_progress (FileOpTotalContext * tctx, file_op_context_t * ctx,
struct timeval tv_current, struct timeval tv_transfer_start, struct timeval tv_current, struct timeval tv_transfer_start,
off_t file_size, off_t n_read_total) off_t file_size, off_t n_read_total)
{ {
@ -875,7 +875,7 @@ copy_file_file_display_progress (FileOpTotalContext * tctx, FileOpContext * ctx,
/* {{{ Move routines */ /* {{{ Move routines */
static FileProgressStatus static FileProgressStatus
move_file_file (FileOpTotalContext * tctx, FileOpContext * ctx, const char *s, const char *d) move_file_file (FileOpTotalContext * tctx, file_op_context_t * ctx, const char *s, const char *d)
{ {
struct stat src_stats, dst_stats; struct stat src_stats, dst_stats;
FileProgressStatus return_status = FILE_CONT; FileProgressStatus return_status = FILE_CONT;
@ -1025,7 +1025,7 @@ move_file_file (FileOpTotalContext * tctx, FileOpContext * ctx, const char *s, c
/** Don't update progress status if progress_count==NULL */ /** Don't update progress status if progress_count==NULL */
static FileProgressStatus static FileProgressStatus
erase_file (FileOpTotalContext * tctx, FileOpContext * ctx, const vfs_path_t * vpath) erase_file (FileOpTotalContext * tctx, file_op_context_t * ctx, const vfs_path_t * vpath)
{ {
struct stat buf; struct stat buf;
@ -1071,7 +1071,7 @@ erase_file (FileOpTotalContext * tctx, FileOpContext * ctx, const vfs_path_t * v
skipall->remove as much as possible skipall->remove as much as possible
*/ */
static FileProgressStatus static FileProgressStatus
recursive_erase (FileOpTotalContext * tctx, FileOpContext * ctx, const vfs_path_t * vpath) recursive_erase (FileOpTotalContext * tctx, file_op_context_t * ctx, const vfs_path_t * vpath)
{ {
struct dirent *next; struct dirent *next;
DIR *reading; DIR *reading;
@ -1161,7 +1161,7 @@ check_dir_is_empty (const vfs_path_t * vpath)
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
static FileProgressStatus static FileProgressStatus
erase_dir_iff_empty (FileOpContext * ctx, const vfs_path_t * vpath, size_t count) erase_dir_iff_empty (file_op_context_t * ctx, const vfs_path_t * vpath, size_t count)
{ {
FileProgressStatus error = FILE_CONT; FileProgressStatus error = FILE_CONT;
const char *s; const char *s;
@ -1275,7 +1275,7 @@ panel_compute_totals (const WPanel * panel, void *ui, compute_dir_size_callback
/** Initialize variables for progress bars */ /** Initialize variables for progress bars */
static FileProgressStatus static FileProgressStatus
panel_operate_init_totals (const WPanel * panel, const char *source, FileOpContext * ctx, panel_operate_init_totals (const WPanel * panel, const char *source, file_op_context_t * ctx,
filegui_dialog_type_t dialog_type) filegui_dialog_type_t dialog_type)
{ {
FileProgressStatus status; FileProgressStatus status;
@ -1446,7 +1446,7 @@ panel_operate_generate_prompt (const WPanel * panel, FileOperation operation,
#ifdef ENABLE_BACKGROUND #ifdef ENABLE_BACKGROUND
static int static int
end_bg_process (FileOpContext * ctx, enum OperationMode mode) end_bg_process (file_op_context_t * ctx, enum OperationMode mode)
{ {
int pid = ctx->pid; int pid = ctx->pid;
@ -1465,7 +1465,7 @@ end_bg_process (FileOpContext * ctx, enum OperationMode mode)
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
FileProgressStatus FileProgressStatus
copy_file_file (FileOpTotalContext * tctx, FileOpContext * ctx, copy_file_file (FileOpTotalContext * tctx, file_op_context_t * ctx,
const char *src_path, const char *dst_path) const char *src_path, const char *dst_path)
{ {
uid_t src_uid = (uid_t) (-1); uid_t src_uid = (uid_t) (-1);
@ -2001,7 +2001,7 @@ copy_file_file (FileOpTotalContext * tctx, FileOpContext * ctx,
function calls */ function calls */
FileProgressStatus FileProgressStatus
copy_dir_dir (FileOpTotalContext * tctx, FileOpContext * ctx, const char *s, const char *d, copy_dir_dir (FileOpTotalContext * tctx, file_op_context_t * ctx, const char *s, const char *d,
gboolean toplevel, gboolean move_over, gboolean do_delete, GSList * parent_dirs) gboolean toplevel, gboolean move_over, gboolean do_delete, GSList * parent_dirs)
{ {
struct dirent *next; struct dirent *next;
@ -2271,7 +2271,7 @@ copy_dir_dir (FileOpTotalContext * tctx, FileOpContext * ctx, const char *s, con
/* {{{ Move routines */ /* {{{ Move routines */
FileProgressStatus FileProgressStatus
move_dir_dir (FileOpTotalContext * tctx, FileOpContext * ctx, const char *s, const char *d) move_dir_dir (FileOpTotalContext * tctx, file_op_context_t * ctx, const char *s, const char *d)
{ {
struct stat sbuf, dbuf, destbuf; struct stat sbuf, dbuf, destbuf;
FileProgressStatus return_status; FileProgressStatus return_status;
@ -2410,7 +2410,7 @@ move_dir_dir (FileOpTotalContext * tctx, FileOpContext * ctx, const char *s, con
/* {{{ Erase routines */ /* {{{ Erase routines */
FileProgressStatus FileProgressStatus
erase_dir (FileOpTotalContext * tctx, FileOpContext * ctx, const vfs_path_t * s_vpath) erase_dir (FileOpTotalContext * tctx, file_op_context_t * ctx, const vfs_path_t * s_vpath)
{ {
FileProgressStatus error; FileProgressStatus error;
@ -2611,7 +2611,7 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
gboolean ret_val = TRUE; gboolean ret_val = TRUE;
int i; int i;
FileProgressStatus value; FileProgressStatus value;
FileOpContext *ctx; file_op_context_t *ctx;
FileOpTotalContext *tctx; FileOpTotalContext *tctx;
vfs_path_t *tmp_vpath; vfs_path_t *tmp_vpath;
filegui_dialog_type_t dialog_type = FILEGUI_DIALOG_ONE_ITEM; filegui_dialog_type_t dialog_type = FILEGUI_DIALOG_ONE_ITEM;

View File

@ -34,15 +34,15 @@ typedef struct
/*** declarations of public functions ************************************************************/ /*** declarations of public functions ************************************************************/
FileProgressStatus copy_file_file (FileOpTotalContext * tctx, FileOpContext * ctx, FileProgressStatus copy_file_file (FileOpTotalContext * tctx, file_op_context_t * ctx,
const char *src_path, const char *dst_path); const char *src_path, const char *dst_path);
FileProgressStatus move_dir_dir (FileOpTotalContext * tctx, FileOpContext * ctx, FileProgressStatus move_dir_dir (FileOpTotalContext * tctx, file_op_context_t * ctx,
const char *s, const char *d); const char *s, const char *d);
FileProgressStatus copy_dir_dir (FileOpTotalContext * tctx, FileOpContext * ctx, FileProgressStatus copy_dir_dir (FileOpTotalContext * tctx, file_op_context_t * ctx,
const char *s, const char *d, const char *s, const char *d,
gboolean toplevel, gboolean move_over, gboolean do_delete, gboolean toplevel, gboolean move_over, gboolean do_delete,
GSList * parent_dirs); GSList * parent_dirs);
FileProgressStatus erase_dir (FileOpTotalContext * tctx, FileOpContext * ctx, FileProgressStatus erase_dir (FileOpTotalContext * tctx, file_op_context_t * ctx,
const vfs_path_t * vpath); const vfs_path_t * vpath);
gboolean panel_operate (void *source_panel, FileOperation op, gboolean force_single); gboolean panel_operate (void *source_panel, FileOperation op, gboolean force_single);

View File

@ -241,7 +241,7 @@ typedef struct
replace_action_t replace_result; replace_action_t replace_result;
struct stat *s_stat, *d_stat; struct stat *s_stat, *d_stat;
} FileOpContextUI; } file_op_context_ui_t;
/*** file scope variables ************************************************************************/ /*** file scope variables ************************************************************************/
@ -396,7 +396,7 @@ file_bps_prepare_for_show (char *buffer, long bps)
* alex * alex
*/ */
static replace_action_t static replace_action_t
overwrite_query_dialog (FileOpContext * ctx, enum OperationMode mode) overwrite_query_dialog (file_op_context_t * ctx, enum OperationMode mode)
{ {
#define ADD_RD_BUTTON(i, ypos) \ #define ADD_RD_BUTTON(i, ypos) \
add_widget_autopos (ui->replace_dlg, \ add_widget_autopos (ui->replace_dlg, \
@ -461,7 +461,7 @@ overwrite_query_dialog (FileOpContext * ctx, enum OperationMode mode)
const size_t num = G_N_ELEMENTS (rd_widgets); const size_t num = G_N_ELEMENTS (rd_widgets);
int *widgets_len; int *widgets_len;
FileOpContextUI *ui = ctx->ui; file_op_context_ui_t *ui = ctx->ui;
char buffer[BUF_SMALL]; char buffer[BUF_SMALL];
char fsize_buffer[BUF_SMALL]; char fsize_buffer[BUF_SMALL];
@ -658,11 +658,11 @@ progress_button_callback (WButton * button, int action)
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
FileProgressStatus FileProgressStatus
check_progress_buttons (FileOpContext * ctx) check_progress_buttons (file_op_context_t * ctx)
{ {
int c; int c;
Gpm_Event event; Gpm_Event event;
FileOpContextUI *ui; file_op_context_ui_t *ui;
if (ctx == NULL || ctx->ui == NULL) if (ctx == NULL || ctx->ui == NULL)
return FILE_CONT; return FILE_CONT;
@ -710,10 +710,10 @@ check_progress_buttons (FileOpContext * ctx)
/* {{{ File progress display routines */ /* {{{ File progress display routines */
void void
file_op_context_create_ui (FileOpContext * ctx, gboolean with_eta, file_op_context_create_ui (file_op_context_t * ctx, gboolean with_eta,
filegui_dialog_type_t dialog_type) filegui_dialog_type_t dialog_type)
{ {
FileOpContextUI *ui; file_op_context_ui_t *ui;
int buttons_width; int buttons_width;
int dlg_width = 58, dlg_height = 17; int dlg_width = 58, dlg_height = 17;
int y = 2, x = 3; int y = 2, x = 3;
@ -733,7 +733,7 @@ file_op_context_create_ui (FileOpContext * ctx, gboolean with_eta,
ctx->dialog_type = dialog_type; ctx->dialog_type = dialog_type;
ctx->recursive_result = RECURSIVE_YES; ctx->recursive_result = RECURSIVE_YES;
ctx->ui = g_new0 (FileOpContextUI, 1); ctx->ui = g_new0 (file_op_context_ui_t, 1);
ui = ctx->ui; ui = ctx->ui;
ui->replace_result = REPLACE_YES; ui->replace_result = REPLACE_YES;
@ -855,11 +855,11 @@ file_op_context_create_ui (FileOpContext * ctx, gboolean with_eta,
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
void void
file_op_context_destroy_ui (FileOpContext * ctx) file_op_context_destroy_ui (file_op_context_t * ctx)
{ {
if (ctx != NULL && ctx->ui != NULL) if (ctx != NULL && ctx->ui != NULL)
{ {
FileOpContextUI *ui = (FileOpContextUI *) ctx->ui; file_op_context_ui_t *ui = (file_op_context_ui_t *) ctx->ui;
dlg_run_done (ui->op_dlg); dlg_run_done (ui->op_dlg);
dlg_destroy (ui->op_dlg); dlg_destroy (ui->op_dlg);
@ -874,10 +874,10 @@ file_op_context_destroy_ui (FileOpContext * ctx)
*/ */
void void
file_progress_show (FileOpContext * ctx, off_t done, off_t total, file_progress_show (file_op_context_t * ctx, off_t done, off_t total,
const char *stalled_msg, gboolean force_update) const char *stalled_msg, gboolean force_update)
{ {
FileOpContextUI *ui; file_op_context_ui_t *ui;
char buffer[BUF_TINY]; char buffer[BUF_TINY];
if (!verbose || ctx == NULL || ctx->ui == NULL) if (!verbose || ctx == NULL || ctx->ui == NULL)
@ -923,10 +923,10 @@ file_progress_show (FileOpContext * ctx, off_t done, off_t total,
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
void void
file_progress_show_count (FileOpContext * ctx, size_t done, size_t total) file_progress_show_count (file_op_context_t * ctx, size_t done, size_t total)
{ {
char buffer[BUF_TINY]; char buffer[BUF_TINY];
FileOpContextUI *ui; file_op_context_ui_t *ui;
if (ctx == NULL || ctx->ui == NULL) if (ctx == NULL || ctx->ui == NULL)
return; return;
@ -945,13 +945,13 @@ file_progress_show_count (FileOpContext * ctx, size_t done, size_t total)
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
void void
file_progress_show_total (FileOpTotalContext * tctx, FileOpContext * ctx, uintmax_t copied_bytes, file_progress_show_total (FileOpTotalContext * tctx, file_op_context_t * ctx,
gboolean show_summary) uintmax_t copied_bytes, gboolean show_summary)
{ {
char buffer[BUF_TINY]; char buffer[BUF_TINY];
char buffer2[BUF_TINY]; char buffer2[BUF_TINY];
char buffer3[BUF_TINY]; char buffer3[BUF_TINY];
FileOpContextUI *ui; file_op_context_ui_t *ui;
if (ctx == NULL || ctx->ui == NULL) if (ctx == NULL || ctx->ui == NULL)
return; return;
@ -1027,9 +1027,9 @@ file_progress_show_total (FileOpTotalContext * tctx, FileOpContext * ctx, uintma
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
void void
file_progress_show_source (FileOpContext * ctx, const vfs_path_t * s_vpath) file_progress_show_source (file_op_context_t * ctx, const vfs_path_t * s_vpath)
{ {
FileOpContextUI *ui; file_op_context_ui_t *ui;
if (ctx == NULL || ctx->ui == NULL) if (ctx == NULL || ctx->ui == NULL)
return; return;
@ -1055,9 +1055,9 @@ file_progress_show_source (FileOpContext * ctx, const vfs_path_t * s_vpath)
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
void void
file_progress_show_target (FileOpContext * ctx, const vfs_path_t * s_vpath) file_progress_show_target (file_op_context_t * ctx, const vfs_path_t * s_vpath)
{ {
FileOpContextUI *ui; file_op_context_ui_t *ui;
if (ctx == NULL || ctx->ui == NULL) if (ctx == NULL || ctx->ui == NULL)
return; return;
@ -1080,9 +1080,9 @@ file_progress_show_target (FileOpContext * ctx, const vfs_path_t * s_vpath)
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
void void
file_progress_show_deleting (FileOpContext * ctx, const char *s, size_t * count) file_progress_show_deleting (file_op_context_t * ctx, const char *s, size_t * count)
{ {
FileOpContextUI *ui; file_op_context_ui_t *ui;
if (ctx == NULL || ctx->ui == NULL) if (ctx == NULL || ctx->ui == NULL)
return; return;
@ -1097,11 +1097,11 @@ file_progress_show_deleting (FileOpContext * ctx, const char *s, size_t * count)
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
FileProgressStatus FileProgressStatus
file_progress_real_query_replace (FileOpContext * ctx, file_progress_real_query_replace (file_op_context_t * ctx,
enum OperationMode mode, const char *destname, enum OperationMode mode, const char *destname,
struct stat *_s_stat, struct stat *_d_stat) struct stat *_s_stat, struct stat *_d_stat)
{ {
FileOpContextUI *ui; file_op_context_ui_t *ui;
if (ctx == NULL || ctx->ui == NULL) if (ctx == NULL || ctx->ui == NULL)
return FILE_CONT; return FILE_CONT;
@ -1156,7 +1156,7 @@ file_progress_real_query_replace (FileOpContext * ctx,
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
char * char *
file_mask_dialog (FileOpContext * ctx, FileOperation operation, file_mask_dialog (file_op_context_t * ctx, FileOperation operation,
gboolean only_one, gboolean only_one,
const char *format, const void *text, const char *def_text, gboolean * do_bg) const char *format, const void *text, const char *def_text, gboolean * do_bg)
{ {

View File

@ -18,25 +18,25 @@
/*** declarations of public functions ************************************************************/ /*** declarations of public functions ************************************************************/
void file_op_context_create_ui (FileOpContext * ctx, gboolean with_eta, void file_op_context_create_ui (file_op_context_t * ctx, gboolean with_eta,
filegui_dialog_type_t dialog_type); filegui_dialog_type_t dialog_type);
void file_op_context_destroy_ui (FileOpContext * ctx); void file_op_context_destroy_ui (file_op_context_t * ctx);
char *file_mask_dialog (FileOpContext * ctx, FileOperation operation, char *file_mask_dialog (file_op_context_t * ctx, FileOperation operation,
gboolean only_one, gboolean only_one,
const char *format, const void *text, const char *format, const void *text,
const char *def_text, gboolean * do_bg); const char *def_text, gboolean * do_bg);
FileProgressStatus check_progress_buttons (FileOpContext * ctx); FileProgressStatus check_progress_buttons (file_op_context_t * ctx);
void file_progress_show (FileOpContext * ctx, off_t done, off_t total, void file_progress_show (file_op_context_t * ctx, off_t done, off_t total,
const char *stalled_msg, gboolean force_update); const char *stalled_msg, gboolean force_update);
void file_progress_show_count (FileOpContext * ctx, size_t done, size_t total); void file_progress_show_count (file_op_context_t * ctx, size_t done, size_t total);
void file_progress_show_total (FileOpTotalContext * tctx, FileOpContext * ctx, void file_progress_show_total (FileOpTotalContext * tctx, file_op_context_t * ctx,
uintmax_t copied_bytes, gboolean show_summary); uintmax_t copied_bytes, gboolean show_summary);
void file_progress_show_source (FileOpContext * ctx, const vfs_path_t * s_vpath); void file_progress_show_source (file_op_context_t * ctx, const vfs_path_t * s_vpath);
void file_progress_show_target (FileOpContext * ctx, const vfs_path_t * path); void file_progress_show_target (file_op_context_t * ctx, const vfs_path_t * path);
void file_progress_show_deleting (FileOpContext * ctx, const char *path, size_t * count); void file_progress_show_deleting (file_op_context_t * ctx, const char *path, size_t * count);
/*** inline functions ****************************************************************************/ /*** inline functions ****************************************************************************/
#endif /* MC__FILEGUI_H */ #endif /* MC__FILEGUI_H */

View File

@ -57,7 +57,7 @@
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
/** /**
* \fn FileOpContext * file_op_context_new (FileOperation op) * \fn file_op_context_t * file_op_context_new (FileOperation op)
* \param op file operation struct * \param op file operation struct
* \return The newly-created context, filled with the default file mask values. * \return The newly-created context, filled with the default file mask values.
* *
@ -65,12 +65,12 @@
* to have a user interface for this, call file_op_context_create_ui(). * to have a user interface for this, call file_op_context_create_ui().
*/ */
FileOpContext * file_op_context_t *
file_op_context_new (FileOperation op) file_op_context_new (FileOperation op)
{ {
FileOpContext *ctx; file_op_context_t *ctx;
ctx = g_new0 (FileOpContext, 1); ctx = g_new0 (file_op_context_t, 1);
ctx->operation = op; ctx->operation = op;
ctx->eta_secs = 0.0; ctx->eta_secs = 0.0;
ctx->progress_bytes = 0; ctx->progress_bytes = 0;
@ -88,7 +88,7 @@ file_op_context_new (FileOperation op)
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
/** /**
* \fn void file_op_context_destroy (FileOpContext *ctx) * \fn void file_op_context_destroy (file_op_context_t *ctx)
* \param ctx The file operation context to destroy. * \param ctx The file operation context to destroy.
* *
* Destroys the specified file operation context and its associated UI data, if * Destroys the specified file operation context and its associated UI data, if
@ -96,7 +96,7 @@ file_op_context_new (FileOperation op)
*/ */
void void
file_op_context_destroy (FileOpContext * ctx) file_op_context_destroy (file_op_context_t * ctx)
{ {
if (ctx != NULL) if (ctx != NULL)
{ {

View File

@ -76,7 +76,7 @@ struct mc_search_struct;
/* This structure describes a context for file operations. It is used to update /* This structure describes a context for file operations. It is used to update
* the progress windows and pass around options. * the progress windows and pass around options.
*/ */
typedef struct FileOpContext typedef struct
{ {
/* Operation type (copy, move, delete) */ /* Operation type (copy, move, delete) */
FileOperation operation; FileOperation operation;
@ -166,7 +166,7 @@ typedef struct FileOpContext
/* User interface data goes here */ /* User interface data goes here */
void *ui; void *ui;
} FileOpContext; } file_op_context_t;
typedef struct typedef struct
{ {
@ -187,14 +187,14 @@ extern const char *op_names[3];
/*** declarations of public functions ************************************************************/ /*** declarations of public functions ************************************************************/
FileOpContext *file_op_context_new (FileOperation op); file_op_context_t *file_op_context_new (FileOperation op);
void file_op_context_destroy (FileOpContext * ctx); void file_op_context_destroy (file_op_context_t * ctx);
FileOpTotalContext *file_op_total_context_new (void); FileOpTotalContext *file_op_total_context_new (void);
void file_op_total_context_destroy (FileOpTotalContext * tctx); void file_op_total_context_destroy (FileOpTotalContext * tctx);
/* The following functions are implemented separately by each port */ /* The following functions are implemented separately by each port */
FileProgressStatus file_progress_real_query_replace (FileOpContext * ctx, FileProgressStatus file_progress_real_query_replace (file_op_context_t * ctx,
enum OperationMode mode, enum OperationMode mode,
const char *destname, const char *destname,
struct stat *_s_stat, struct stat *_d_stat); struct stat *_s_stat, struct stat *_d_stat);

View File

@ -776,7 +776,7 @@ tree_copy (WTree * tree, const char *default_dest)
if (dest != NULL && *dest != '\0') if (dest != NULL && *dest != '\0')
{ {
FileOpContext *ctx; file_op_context_t *ctx;
FileOpTotalContext *tctx; FileOpTotalContext *tctx;
ctx = file_op_context_new (OP_COPY); ctx = file_op_context_new (OP_COPY);
@ -800,7 +800,7 @@ tree_move (WTree * tree, const char *default_dest)
char msg[BUF_MEDIUM]; char msg[BUF_MEDIUM];
char *dest; char *dest;
struct stat buf; struct stat buf;
FileOpContext *ctx; file_op_context_t *ctx;
FileOpTotalContext *tctx; FileOpTotalContext *tctx;
if (tree->selected_ptr == NULL) if (tree->selected_ptr == NULL)
@ -865,7 +865,7 @@ static void
tree_rmdir (void *data) tree_rmdir (void *data)
{ {
WTree *tree = data; WTree *tree = data;
FileOpContext *ctx; file_op_context_t *ctx;
FileOpTotalContext *tctx; FileOpTotalContext *tctx;
if (!tree->selected_ptr) if (!tree->selected_ptr)

View File

@ -54,7 +54,7 @@ check_for_default (const vfs_path_t * default_file_vpath, const vfs_path_t * fil
{ {
if (!exist_file (vfs_path_as_str (file_vpath))) if (!exist_file (vfs_path_as_str (file_vpath)))
{ {
FileOpContext *ctx; file_op_context_t *ctx;
FileOpTotalContext *tctx; FileOpTotalContext *tctx;
if (!exist_file (vfs_path_as_str (default_file_vpath))) if (!exist_file (vfs_path_as_str (default_file_vpath)))