mc/src/fileopctx.h

166 lines
4.3 KiB
C
Raw Normal View History

/** \file fileopctx.h
* \brief Header: file operation contexts
* \date 1998
* \author Federico Mena <federico@nuclecu.unam.mx>
* \author Miguel de Icaza <miguel@nuclecu.unam.mx>
*/
1999-01-06 Federico Mena Quintero <federico@nuclecu.unam.mx> * fileopctx.h: New file with declarations for the file operation context structure. * fileopctx.c (file_op_context_new): New function to create a file operation context with the default file mask values. (file_op_context_destroy): New function to destroy a file operation context and its associated UI, if appropriate. * filegui.h: Use complete prototype for fmd_init_i18n(). * filegui.c (FileOpContextUI): New structure that describes the UI and internal data for file operation contexts in the text mode version. (file_op_context_create_ui): Renamed from create_op_win() and made it use a context instead of global variables. (file_op_context_destroy_ui): Likewise, renamed from destroy_op_win(). (fmd_widgets): Removed an #ifdef HAVE_XVIEW bit and moved the initialization of the result pointers to file_mask_dialog(), as we need to use the pointers to the fields inside the file op context now. Made all the functions use a file operation context. (file_mask_dialog): Always call fmd_init_i18n(); it will take care of idempotence by itself. (fmd_init_i18n): Now the code that makes sure this function is only called once is here. * cmd.c (check_for_default): Make it use a file operation context. * tree.c (tree_copy): Likewise. (tree_move): Likewise. (tree_rmdir_cmd): Likewise. * file.c: Removed file_progress_replace_progress and file_progress_replace_filename -- they are only used in filegui.c as part of the UI for the file operation context. (panel_operate_generate_prompt): Made static. (panel_operate_generate_prompt): Always call fmd_init_i18n(); it will take care of idempotence by itself. (panel_operate): Removed the panel_operate_def() function, and made panel_operate() take an extra "ask_user" argument. (query_recursive): Made static. * background.c (background_attention): Made static. (register_task_running): Made static. (do_background): Now takes a file operation context as an argument. It stores the pid of the child there. * Makefile.in: Added fileopctx.[ch].
1999-01-07 04:14:50 +03:00
/* File operation contexts for the Midnight Commander
*
* Copyright (C) 1998 Free Software Foundation, Inc.
1999-01-06 Federico Mena Quintero <federico@nuclecu.unam.mx> * fileopctx.h: New file with declarations for the file operation context structure. * fileopctx.c (file_op_context_new): New function to create a file operation context with the default file mask values. (file_op_context_destroy): New function to destroy a file operation context and its associated UI, if appropriate. * filegui.h: Use complete prototype for fmd_init_i18n(). * filegui.c (FileOpContextUI): New structure that describes the UI and internal data for file operation contexts in the text mode version. (file_op_context_create_ui): Renamed from create_op_win() and made it use a context instead of global variables. (file_op_context_destroy_ui): Likewise, renamed from destroy_op_win(). (fmd_widgets): Removed an #ifdef HAVE_XVIEW bit and moved the initialization of the result pointers to file_mask_dialog(), as we need to use the pointers to the fields inside the file op context now. Made all the functions use a file operation context. (file_mask_dialog): Always call fmd_init_i18n(); it will take care of idempotence by itself. (fmd_init_i18n): Now the code that makes sure this function is only called once is here. * cmd.c (check_for_default): Make it use a file operation context. * tree.c (tree_copy): Likewise. (tree_move): Likewise. (tree_rmdir_cmd): Likewise. * file.c: Removed file_progress_replace_progress and file_progress_replace_filename -- they are only used in filegui.c as part of the UI for the file operation context. (panel_operate_generate_prompt): Made static. (panel_operate_generate_prompt): Always call fmd_init_i18n(); it will take care of idempotence by itself. (panel_operate): Removed the panel_operate_def() function, and made panel_operate() take an extra "ask_user" argument. (query_recursive): Made static. * background.c (background_attention): Made static. (register_task_running): Made static. (do_background): Now takes a file operation context as an argument. It stores the pid of the child there. * Makefile.in: Added fileopctx.[ch].
1999-01-07 04:14:50 +03:00
*
*/
#ifndef FILEOPCTX_H
#define FILEOPCTX_H
#include <sys/stat.h>
#include <sys/types.h>
struct mc_search_struct;
typedef enum {
OP_COPY,
OP_MOVE,
OP_DELETE
} FileOperation;
1999-01-06 Federico Mena Quintero <federico@nuclecu.unam.mx> * fileopctx.h: New file with declarations for the file operation context structure. * fileopctx.c (file_op_context_new): New function to create a file operation context with the default file mask values. (file_op_context_destroy): New function to destroy a file operation context and its associated UI, if appropriate. * filegui.h: Use complete prototype for fmd_init_i18n(). * filegui.c (FileOpContextUI): New structure that describes the UI and internal data for file operation contexts in the text mode version. (file_op_context_create_ui): Renamed from create_op_win() and made it use a context instead of global variables. (file_op_context_destroy_ui): Likewise, renamed from destroy_op_win(). (fmd_widgets): Removed an #ifdef HAVE_XVIEW bit and moved the initialization of the result pointers to file_mask_dialog(), as we need to use the pointers to the fields inside the file op context now. Made all the functions use a file operation context. (file_mask_dialog): Always call fmd_init_i18n(); it will take care of idempotence by itself. (fmd_init_i18n): Now the code that makes sure this function is only called once is here. * cmd.c (check_for_default): Make it use a file operation context. * tree.c (tree_copy): Likewise. (tree_move): Likewise. (tree_rmdir_cmd): Likewise. * file.c: Removed file_progress_replace_progress and file_progress_replace_filename -- they are only used in filegui.c as part of the UI for the file operation context. (panel_operate_generate_prompt): Made static. (panel_operate_generate_prompt): Always call fmd_init_i18n(); it will take care of idempotence by itself. (panel_operate): Removed the panel_operate_def() function, and made panel_operate() take an extra "ask_user" argument. (query_recursive): Made static. * background.c (background_attention): Made static. (register_task_running): Made static. (do_background): Now takes a file operation context as an argument. It stores the pid of the child there. * Makefile.in: Added fileopctx.[ch].
1999-01-07 04:14:50 +03:00
typedef int (*mc_stat_fn) (const char *filename, struct stat *buf);
1999-01-06 Federico Mena Quintero <federico@nuclecu.unam.mx> * fileopctx.h: New file with declarations for the file operation context structure. * fileopctx.c (file_op_context_new): New function to create a file operation context with the default file mask values. (file_op_context_destroy): New function to destroy a file operation context and its associated UI, if appropriate. * filegui.h: Use complete prototype for fmd_init_i18n(). * filegui.c (FileOpContextUI): New structure that describes the UI and internal data for file operation contexts in the text mode version. (file_op_context_create_ui): Renamed from create_op_win() and made it use a context instead of global variables. (file_op_context_destroy_ui): Likewise, renamed from destroy_op_win(). (fmd_widgets): Removed an #ifdef HAVE_XVIEW bit and moved the initialization of the result pointers to file_mask_dialog(), as we need to use the pointers to the fields inside the file op context now. Made all the functions use a file operation context. (file_mask_dialog): Always call fmd_init_i18n(); it will take care of idempotence by itself. (fmd_init_i18n): Now the code that makes sure this function is only called once is here. * cmd.c (check_for_default): Make it use a file operation context. * tree.c (tree_copy): Likewise. (tree_move): Likewise. (tree_rmdir_cmd): Likewise. * file.c: Removed file_progress_replace_progress and file_progress_replace_filename -- they are only used in filegui.c as part of the UI for the file operation context. (panel_operate_generate_prompt): Made static. (panel_operate_generate_prompt): Always call fmd_init_i18n(); it will take care of idempotence by itself. (panel_operate): Removed the panel_operate_def() function, and made panel_operate() take an extra "ask_user" argument. (query_recursive): Made static. * background.c (background_attention): Made static. (register_task_running): Made static. (do_background): Now takes a file operation context as an argument. It stores the pid of the child there. * Makefile.in: Added fileopctx.[ch].
1999-01-07 04:14:50 +03:00
/* This structure describes a context for file operations. It is used to update
* the progress windows and pass around options.
*/
typedef struct FileOpContext {
/* Operation type (copy, move, delete) */
FileOperation operation;
1999-01-06 Federico Mena Quintero <federico@nuclecu.unam.mx> * fileopctx.h: New file with declarations for the file operation context structure. * fileopctx.c (file_op_context_new): New function to create a file operation context with the default file mask values. (file_op_context_destroy): New function to destroy a file operation context and its associated UI, if appropriate. * filegui.h: Use complete prototype for fmd_init_i18n(). * filegui.c (FileOpContextUI): New structure that describes the UI and internal data for file operation contexts in the text mode version. (file_op_context_create_ui): Renamed from create_op_win() and made it use a context instead of global variables. (file_op_context_destroy_ui): Likewise, renamed from destroy_op_win(). (fmd_widgets): Removed an #ifdef HAVE_XVIEW bit and moved the initialization of the result pointers to file_mask_dialog(), as we need to use the pointers to the fields inside the file op context now. Made all the functions use a file operation context. (file_mask_dialog): Always call fmd_init_i18n(); it will take care of idempotence by itself. (fmd_init_i18n): Now the code that makes sure this function is only called once is here. * cmd.c (check_for_default): Make it use a file operation context. * tree.c (tree_copy): Likewise. (tree_move): Likewise. (tree_rmdir_cmd): Likewise. * file.c: Removed file_progress_replace_progress and file_progress_replace_filename -- they are only used in filegui.c as part of the UI for the file operation context. (panel_operate_generate_prompt): Made static. (panel_operate_generate_prompt): Always call fmd_init_i18n(); it will take care of idempotence by itself. (panel_operate): Removed the panel_operate_def() function, and made panel_operate() take an extra "ask_user" argument. (query_recursive): Made static. * background.c (background_attention): Made static. (register_task_running): Made static. (do_background): Now takes a file operation context as an argument. It stores the pid of the child there. * Makefile.in: Added fileopctx.[ch].
1999-01-07 04:14:50 +03:00
/* The estimated time of arrival in seconds */
double eta_secs;
/* Transferred bytes per second */
long bps;
/* Transferred seconds */
long bps_time;
/* Whether the panel total has been computed */
int progress_totals_computed;
/* Counters for progress indicators */
off_t progress_count;
1999-01-06 Federico Mena Quintero <federico@nuclecu.unam.mx> * fileopctx.h: New file with declarations for the file operation context structure. * fileopctx.c (file_op_context_new): New function to create a file operation context with the default file mask values. (file_op_context_destroy): New function to destroy a file operation context and its associated UI, if appropriate. * filegui.h: Use complete prototype for fmd_init_i18n(). * filegui.c (FileOpContextUI): New structure that describes the UI and internal data for file operation contexts in the text mode version. (file_op_context_create_ui): Renamed from create_op_win() and made it use a context instead of global variables. (file_op_context_destroy_ui): Likewise, renamed from destroy_op_win(). (fmd_widgets): Removed an #ifdef HAVE_XVIEW bit and moved the initialization of the result pointers to file_mask_dialog(), as we need to use the pointers to the fields inside the file op context now. Made all the functions use a file operation context. (file_mask_dialog): Always call fmd_init_i18n(); it will take care of idempotence by itself. (fmd_init_i18n): Now the code that makes sure this function is only called once is here. * cmd.c (check_for_default): Make it use a file operation context. * tree.c (tree_copy): Likewise. (tree_move): Likewise. (tree_rmdir_cmd): Likewise. * file.c: Removed file_progress_replace_progress and file_progress_replace_filename -- they are only used in filegui.c as part of the UI for the file operation context. (panel_operate_generate_prompt): Made static. (panel_operate_generate_prompt): Always call fmd_init_i18n(); it will take care of idempotence by itself. (panel_operate): Removed the panel_operate_def() function, and made panel_operate() take an extra "ask_user" argument. (query_recursive): Made static. * background.c (background_attention): Made static. (register_task_running): Made static. (do_background): Now takes a file operation context as an argument. It stores the pid of the child there. * Makefile.in: Added fileopctx.[ch].
1999-01-07 04:14:50 +03:00
double progress_bytes;
/* The value of the "preserve Attributes" checkbox in the copy file dialog.
* We can't use the value of "ctx->preserve" because it can change in order
* to preserve file attributs when moving files across filesystem boundaries
* (we want to keep the value of the checkbox between copy operations).
*/
int op_preserve;
1999-01-06 Federico Mena Quintero <federico@nuclecu.unam.mx> * fileopctx.h: New file with declarations for the file operation context structure. * fileopctx.c (file_op_context_new): New function to create a file operation context with the default file mask values. (file_op_context_destroy): New function to destroy a file operation context and its associated UI, if appropriate. * filegui.h: Use complete prototype for fmd_init_i18n(). * filegui.c (FileOpContextUI): New structure that describes the UI and internal data for file operation contexts in the text mode version. (file_op_context_create_ui): Renamed from create_op_win() and made it use a context instead of global variables. (file_op_context_destroy_ui): Likewise, renamed from destroy_op_win(). (fmd_widgets): Removed an #ifdef HAVE_XVIEW bit and moved the initialization of the result pointers to file_mask_dialog(), as we need to use the pointers to the fields inside the file op context now. Made all the functions use a file operation context. (file_mask_dialog): Always call fmd_init_i18n(); it will take care of idempotence by itself. (fmd_init_i18n): Now the code that makes sure this function is only called once is here. * cmd.c (check_for_default): Make it use a file operation context. * tree.c (tree_copy): Likewise. (tree_move): Likewise. (tree_rmdir_cmd): Likewise. * file.c: Removed file_progress_replace_progress and file_progress_replace_filename -- they are only used in filegui.c as part of the UI for the file operation context. (panel_operate_generate_prompt): Made static. (panel_operate_generate_prompt): Always call fmd_init_i18n(); it will take care of idempotence by itself. (panel_operate): Removed the panel_operate_def() function, and made panel_operate() take an extra "ask_user" argument. (query_recursive): Made static. * background.c (background_attention): Made static. (register_task_running): Made static. (do_background): Now takes a file operation context as an argument. It stores the pid of the child there. * Makefile.in: Added fileopctx.[ch].
1999-01-07 04:14:50 +03:00
/* Result from the recursive query */
int recursive_result;
/* Whether to do a reget */
off_t do_reget;
1999-01-06 Federico Mena Quintero <federico@nuclecu.unam.mx> * fileopctx.h: New file with declarations for the file operation context structure. * fileopctx.c (file_op_context_new): New function to create a file operation context with the default file mask values. (file_op_context_destroy): New function to destroy a file operation context and its associated UI, if appropriate. * filegui.h: Use complete prototype for fmd_init_i18n(). * filegui.c (FileOpContextUI): New structure that describes the UI and internal data for file operation contexts in the text mode version. (file_op_context_create_ui): Renamed from create_op_win() and made it use a context instead of global variables. (file_op_context_destroy_ui): Likewise, renamed from destroy_op_win(). (fmd_widgets): Removed an #ifdef HAVE_XVIEW bit and moved the initialization of the result pointers to file_mask_dialog(), as we need to use the pointers to the fields inside the file op context now. Made all the functions use a file operation context. (file_mask_dialog): Always call fmd_init_i18n(); it will take care of idempotence by itself. (fmd_init_i18n): Now the code that makes sure this function is only called once is here. * cmd.c (check_for_default): Make it use a file operation context. * tree.c (tree_copy): Likewise. (tree_move): Likewise. (tree_rmdir_cmd): Likewise. * file.c: Removed file_progress_replace_progress and file_progress_replace_filename -- they are only used in filegui.c as part of the UI for the file operation context. (panel_operate_generate_prompt): Made static. (panel_operate_generate_prompt): Always call fmd_init_i18n(); it will take care of idempotence by itself. (panel_operate): Removed the panel_operate_def() function, and made panel_operate() take an extra "ask_user" argument. (query_recursive): Made static. * background.c (background_attention): Made static. (register_task_running): Made static. (do_background): Now takes a file operation context as an argument. It stores the pid of the child there. * Makefile.in: Added fileopctx.[ch].
1999-01-07 04:14:50 +03:00
/* Controls appending to files */
int do_append;
/* Whether to stat or lstat */
int follow_links;
/* Pointer to the stat function we will use */
mc_stat_fn stat_func;
1999-01-06 Federico Mena Quintero <federico@nuclecu.unam.mx> * fileopctx.h: New file with declarations for the file operation context structure. * fileopctx.c (file_op_context_new): New function to create a file operation context with the default file mask values. (file_op_context_destroy): New function to destroy a file operation context and its associated UI, if appropriate. * filegui.h: Use complete prototype for fmd_init_i18n(). * filegui.c (FileOpContextUI): New structure that describes the UI and internal data for file operation contexts in the text mode version. (file_op_context_create_ui): Renamed from create_op_win() and made it use a context instead of global variables. (file_op_context_destroy_ui): Likewise, renamed from destroy_op_win(). (fmd_widgets): Removed an #ifdef HAVE_XVIEW bit and moved the initialization of the result pointers to file_mask_dialog(), as we need to use the pointers to the fields inside the file op context now. Made all the functions use a file operation context. (file_mask_dialog): Always call fmd_init_i18n(); it will take care of idempotence by itself. (fmd_init_i18n): Now the code that makes sure this function is only called once is here. * cmd.c (check_for_default): Make it use a file operation context. * tree.c (tree_copy): Likewise. (tree_move): Likewise. (tree_rmdir_cmd): Likewise. * file.c: Removed file_progress_replace_progress and file_progress_replace_filename -- they are only used in filegui.c as part of the UI for the file operation context. (panel_operate_generate_prompt): Made static. (panel_operate_generate_prompt): Always call fmd_init_i18n(); it will take care of idempotence by itself. (panel_operate): Removed the panel_operate_def() function, and made panel_operate() take an extra "ask_user" argument. (query_recursive): Made static. * background.c (background_attention): Made static. (register_task_running): Made static. (do_background): Now takes a file operation context as an argument. It stores the pid of the child there. * Makefile.in: Added fileopctx.[ch].
1999-01-07 04:14:50 +03:00
/* Whether to recompute symlinks */
int stable_symlinks;
/* Preserve the original files' owner, group, permissions, and
* timestamps (owner, group only as root).
*/
int preserve;
/* If running as root, preserve the original uid/gid (we don't want to
2002-10-23 12:26:16 +04:00
* try chown for non root) preserve_uidgid = preserve && uid == 0
1999-01-06 Federico Mena Quintero <federico@nuclecu.unam.mx> * fileopctx.h: New file with declarations for the file operation context structure. * fileopctx.c (file_op_context_new): New function to create a file operation context with the default file mask values. (file_op_context_destroy): New function to destroy a file operation context and its associated UI, if appropriate. * filegui.h: Use complete prototype for fmd_init_i18n(). * filegui.c (FileOpContextUI): New structure that describes the UI and internal data for file operation contexts in the text mode version. (file_op_context_create_ui): Renamed from create_op_win() and made it use a context instead of global variables. (file_op_context_destroy_ui): Likewise, renamed from destroy_op_win(). (fmd_widgets): Removed an #ifdef HAVE_XVIEW bit and moved the initialization of the result pointers to file_mask_dialog(), as we need to use the pointers to the fields inside the file op context now. Made all the functions use a file operation context. (file_mask_dialog): Always call fmd_init_i18n(); it will take care of idempotence by itself. (fmd_init_i18n): Now the code that makes sure this function is only called once is here. * cmd.c (check_for_default): Make it use a file operation context. * tree.c (tree_copy): Likewise. (tree_move): Likewise. (tree_rmdir_cmd): Likewise. * file.c: Removed file_progress_replace_progress and file_progress_replace_filename -- they are only used in filegui.c as part of the UI for the file operation context. (panel_operate_generate_prompt): Made static. (panel_operate_generate_prompt): Always call fmd_init_i18n(); it will take care of idempotence by itself. (panel_operate): Removed the panel_operate_def() function, and made panel_operate() take an extra "ask_user" argument. (query_recursive): Made static. * background.c (background_attention): Made static. (register_task_running): Made static. (do_background): Now takes a file operation context as an argument. It stores the pid of the child there. * Makefile.in: Added fileopctx.[ch].
1999-01-07 04:14:50 +03:00
*/
int preserve_uidgid;
/* The bits to preserve in created files' modes on file copy */
int umask_kill;
/* The mask of files to actually operate on */
char *dest_mask;
struct mc_search_struct *search_handle;
1999-01-06 Federico Mena Quintero <federico@nuclecu.unam.mx> * fileopctx.h: New file with declarations for the file operation context structure. * fileopctx.c (file_op_context_new): New function to create a file operation context with the default file mask values. (file_op_context_destroy): New function to destroy a file operation context and its associated UI, if appropriate. * filegui.h: Use complete prototype for fmd_init_i18n(). * filegui.c (FileOpContextUI): New structure that describes the UI and internal data for file operation contexts in the text mode version. (file_op_context_create_ui): Renamed from create_op_win() and made it use a context instead of global variables. (file_op_context_destroy_ui): Likewise, renamed from destroy_op_win(). (fmd_widgets): Removed an #ifdef HAVE_XVIEW bit and moved the initialization of the result pointers to file_mask_dialog(), as we need to use the pointers to the fields inside the file op context now. Made all the functions use a file operation context. (file_mask_dialog): Always call fmd_init_i18n(); it will take care of idempotence by itself. (fmd_init_i18n): Now the code that makes sure this function is only called once is here. * cmd.c (check_for_default): Make it use a file operation context. * tree.c (tree_copy): Likewise. (tree_move): Likewise. (tree_rmdir_cmd): Likewise. * file.c: Removed file_progress_replace_progress and file_progress_replace_filename -- they are only used in filegui.c as part of the UI for the file operation context. (panel_operate_generate_prompt): Made static. (panel_operate_generate_prompt): Always call fmd_init_i18n(); it will take care of idempotence by itself. (panel_operate): Removed the panel_operate_def() function, and made panel_operate() take an extra "ask_user" argument. (query_recursive): Made static. * background.c (background_attention): Made static. (register_task_running): Made static. (do_background): Now takes a file operation context as an argument. It stores the pid of the child there. * Makefile.in: Added fileopctx.[ch].
1999-01-07 04:14:50 +03:00
/* Whether to dive into subdirectories for recursive operations */
int dive_into_subdirs;
/* When moving directories cross filesystem boundaries delete the
2003-06-02 23:26:55 +04:00
* successfully copied files when all files below the directory and its
1999-01-06 Federico Mena Quintero <federico@nuclecu.unam.mx> * fileopctx.h: New file with declarations for the file operation context structure. * fileopctx.c (file_op_context_new): New function to create a file operation context with the default file mask values. (file_op_context_destroy): New function to destroy a file operation context and its associated UI, if appropriate. * filegui.h: Use complete prototype for fmd_init_i18n(). * filegui.c (FileOpContextUI): New structure that describes the UI and internal data for file operation contexts in the text mode version. (file_op_context_create_ui): Renamed from create_op_win() and made it use a context instead of global variables. (file_op_context_destroy_ui): Likewise, renamed from destroy_op_win(). (fmd_widgets): Removed an #ifdef HAVE_XVIEW bit and moved the initialization of the result pointers to file_mask_dialog(), as we need to use the pointers to the fields inside the file op context now. Made all the functions use a file operation context. (file_mask_dialog): Always call fmd_init_i18n(); it will take care of idempotence by itself. (fmd_init_i18n): Now the code that makes sure this function is only called once is here. * cmd.c (check_for_default): Make it use a file operation context. * tree.c (tree_copy): Likewise. (tree_move): Likewise. (tree_rmdir_cmd): Likewise. * file.c: Removed file_progress_replace_progress and file_progress_replace_filename -- they are only used in filegui.c as part of the UI for the file operation context. (panel_operate_generate_prompt): Made static. (panel_operate_generate_prompt): Always call fmd_init_i18n(); it will take care of idempotence by itself. (panel_operate): Removed the panel_operate_def() function, and made panel_operate() take an extra "ask_user" argument. (query_recursive): Made static. * background.c (background_attention): Made static. (register_task_running): Made static. (do_background): Now takes a file operation context as an argument. It stores the pid of the child there. * Makefile.in: Added fileopctx.[ch].
1999-01-07 04:14:50 +03:00
* subdirectories were processed.
*
* If erase_at_end is zero files will be deleted immediately after their
2003-06-02 22:13:42 +04:00
* successful copy (Note: this behavior is not tested and at the moment
1999-01-06 Federico Mena Quintero <federico@nuclecu.unam.mx> * fileopctx.h: New file with declarations for the file operation context structure. * fileopctx.c (file_op_context_new): New function to create a file operation context with the default file mask values. (file_op_context_destroy): New function to destroy a file operation context and its associated UI, if appropriate. * filegui.h: Use complete prototype for fmd_init_i18n(). * filegui.c (FileOpContextUI): New structure that describes the UI and internal data for file operation contexts in the text mode version. (file_op_context_create_ui): Renamed from create_op_win() and made it use a context instead of global variables. (file_op_context_destroy_ui): Likewise, renamed from destroy_op_win(). (fmd_widgets): Removed an #ifdef HAVE_XVIEW bit and moved the initialization of the result pointers to file_mask_dialog(), as we need to use the pointers to the fields inside the file op context now. Made all the functions use a file operation context. (file_mask_dialog): Always call fmd_init_i18n(); it will take care of idempotence by itself. (fmd_init_i18n): Now the code that makes sure this function is only called once is here. * cmd.c (check_for_default): Make it use a file operation context. * tree.c (tree_copy): Likewise. (tree_move): Likewise. (tree_rmdir_cmd): Likewise. * file.c: Removed file_progress_replace_progress and file_progress_replace_filename -- they are only used in filegui.c as part of the UI for the file operation context. (panel_operate_generate_prompt): Made static. (panel_operate_generate_prompt): Always call fmd_init_i18n(); it will take care of idempotence by itself. (panel_operate): Removed the panel_operate_def() function, and made panel_operate() take an extra "ask_user" argument. (query_recursive): Made static. * background.c (background_attention): Made static. (register_task_running): Made static. (do_background): Now takes a file operation context as an argument. It stores the pid of the child there. * Makefile.in: Added fileopctx.[ch].
1999-01-07 04:14:50 +03:00
* it can't be changed at runtime).
*/
int erase_at_end;
/* PID of the child for background operations */
pid_t pid;
/* User interface data goes here */
void *ui;
} FileOpContext;
FileOpContext *file_op_context_new (FileOperation op);
1999-01-06 Federico Mena Quintero <federico@nuclecu.unam.mx> * fileopctx.h: New file with declarations for the file operation context structure. * fileopctx.c (file_op_context_new): New function to create a file operation context with the default file mask values. (file_op_context_destroy): New function to destroy a file operation context and its associated UI, if appropriate. * filegui.h: Use complete prototype for fmd_init_i18n(). * filegui.c (FileOpContextUI): New structure that describes the UI and internal data for file operation contexts in the text mode version. (file_op_context_create_ui): Renamed from create_op_win() and made it use a context instead of global variables. (file_op_context_destroy_ui): Likewise, renamed from destroy_op_win(). (fmd_widgets): Removed an #ifdef HAVE_XVIEW bit and moved the initialization of the result pointers to file_mask_dialog(), as we need to use the pointers to the fields inside the file op context now. Made all the functions use a file operation context. (file_mask_dialog): Always call fmd_init_i18n(); it will take care of idempotence by itself. (fmd_init_i18n): Now the code that makes sure this function is only called once is here. * cmd.c (check_for_default): Make it use a file operation context. * tree.c (tree_copy): Likewise. (tree_move): Likewise. (tree_rmdir_cmd): Likewise. * file.c: Removed file_progress_replace_progress and file_progress_replace_filename -- they are only used in filegui.c as part of the UI for the file operation context. (panel_operate_generate_prompt): Made static. (panel_operate_generate_prompt): Always call fmd_init_i18n(); it will take care of idempotence by itself. (panel_operate): Removed the panel_operate_def() function, and made panel_operate() take an extra "ask_user" argument. (query_recursive): Made static. * background.c (background_attention): Made static. (register_task_running): Made static. (do_background): Now takes a file operation context as an argument. It stores the pid of the child there. * Makefile.in: Added fileopctx.[ch].
1999-01-07 04:14:50 +03:00
void file_op_context_destroy (FileOpContext *ctx);
extern const char *op_names [3];
1999-01-06 Federico Mena Quintero <federico@nuclecu.unam.mx> * fileopctx.h: New file with declarations for the file operation context structure. * fileopctx.c (file_op_context_new): New function to create a file operation context with the default file mask values. (file_op_context_destroy): New function to destroy a file operation context and its associated UI, if appropriate. * filegui.h: Use complete prototype for fmd_init_i18n(). * filegui.c (FileOpContextUI): New structure that describes the UI and internal data for file operation contexts in the text mode version. (file_op_context_create_ui): Renamed from create_op_win() and made it use a context instead of global variables. (file_op_context_destroy_ui): Likewise, renamed from destroy_op_win(). (fmd_widgets): Removed an #ifdef HAVE_XVIEW bit and moved the initialization of the result pointers to file_mask_dialog(), as we need to use the pointers to the fields inside the file op context now. Made all the functions use a file operation context. (file_mask_dialog): Always call fmd_init_i18n(); it will take care of idempotence by itself. (fmd_init_i18n): Now the code that makes sure this function is only called once is here. * cmd.c (check_for_default): Make it use a file operation context. * tree.c (tree_copy): Likewise. (tree_move): Likewise. (tree_rmdir_cmd): Likewise. * file.c: Removed file_progress_replace_progress and file_progress_replace_filename -- they are only used in filegui.c as part of the UI for the file operation context. (panel_operate_generate_prompt): Made static. (panel_operate_generate_prompt): Always call fmd_init_i18n(); it will take care of idempotence by itself. (panel_operate): Removed the panel_operate_def() function, and made panel_operate() take an extra "ask_user" argument. (query_recursive): Made static. * background.c (background_attention): Made static. (register_task_running): Made static. (do_background): Now takes a file operation context as an argument. It stores the pid of the child there. * Makefile.in: Added fileopctx.[ch].
1999-01-07 04:14:50 +03:00
typedef enum {
FILE_CONT = 0,
FILE_RETRY = 1,
FILE_SKIP = 2,
FILE_ABORT = 3
1999-01-06 Federico Mena Quintero <federico@nuclecu.unam.mx> * fileopctx.h: New file with declarations for the file operation context structure. * fileopctx.c (file_op_context_new): New function to create a file operation context with the default file mask values. (file_op_context_destroy): New function to destroy a file operation context and its associated UI, if appropriate. * filegui.h: Use complete prototype for fmd_init_i18n(). * filegui.c (FileOpContextUI): New structure that describes the UI and internal data for file operation contexts in the text mode version. (file_op_context_create_ui): Renamed from create_op_win() and made it use a context instead of global variables. (file_op_context_destroy_ui): Likewise, renamed from destroy_op_win(). (fmd_widgets): Removed an #ifdef HAVE_XVIEW bit and moved the initialization of the result pointers to file_mask_dialog(), as we need to use the pointers to the fields inside the file op context now. Made all the functions use a file operation context. (file_mask_dialog): Always call fmd_init_i18n(); it will take care of idempotence by itself. (fmd_init_i18n): Now the code that makes sure this function is only called once is here. * cmd.c (check_for_default): Make it use a file operation context. * tree.c (tree_copy): Likewise. (tree_move): Likewise. (tree_rmdir_cmd): Likewise. * file.c: Removed file_progress_replace_progress and file_progress_replace_filename -- they are only used in filegui.c as part of the UI for the file operation context. (panel_operate_generate_prompt): Made static. (panel_operate_generate_prompt): Always call fmd_init_i18n(); it will take care of idempotence by itself. (panel_operate): Removed the panel_operate_def() function, and made panel_operate() take an extra "ask_user" argument. (query_recursive): Made static. * background.c (background_attention): Made static. (register_task_running): Made static. (do_background): Now takes a file operation context as an argument. It stores the pid of the child there. * Makefile.in: Added fileopctx.[ch].
1999-01-07 04:14:50 +03:00
} FileProgressStatus;
typedef enum {
RECURSIVE_YES,
RECURSIVE_NO,
RECURSIVE_ALWAYS,
RECURSIVE_NEVER,
RECURSIVE_ABORT
} FileCopyMode;
/* First argument passed to real functions */
enum OperationMode {
Foreground,
Background
};
1999-01-06 Federico Mena Quintero <federico@nuclecu.unam.mx> * fileopctx.h: New file with declarations for the file operation context structure. * fileopctx.c (file_op_context_new): New function to create a file operation context with the default file mask values. (file_op_context_destroy): New function to destroy a file operation context and its associated UI, if appropriate. * filegui.h: Use complete prototype for fmd_init_i18n(). * filegui.c (FileOpContextUI): New structure that describes the UI and internal data for file operation contexts in the text mode version. (file_op_context_create_ui): Renamed from create_op_win() and made it use a context instead of global variables. (file_op_context_destroy_ui): Likewise, renamed from destroy_op_win(). (fmd_widgets): Removed an #ifdef HAVE_XVIEW bit and moved the initialization of the result pointers to file_mask_dialog(), as we need to use the pointers to the fields inside the file op context now. Made all the functions use a file operation context. (file_mask_dialog): Always call fmd_init_i18n(); it will take care of idempotence by itself. (fmd_init_i18n): Now the code that makes sure this function is only called once is here. * cmd.c (check_for_default): Make it use a file operation context. * tree.c (tree_copy): Likewise. (tree_move): Likewise. (tree_rmdir_cmd): Likewise. * file.c: Removed file_progress_replace_progress and file_progress_replace_filename -- they are only used in filegui.c as part of the UI for the file operation context. (panel_operate_generate_prompt): Made static. (panel_operate_generate_prompt): Always call fmd_init_i18n(); it will take care of idempotence by itself. (panel_operate): Removed the panel_operate_def() function, and made panel_operate() take an extra "ask_user" argument. (query_recursive): Made static. * background.c (background_attention): Made static. (register_task_running): Made static. (do_background): Now takes a file operation context as an argument. It stores the pid of the child there. * Makefile.in: Added fileopctx.[ch].
1999-01-07 04:14:50 +03:00
/* The following functions are implemented separately by each port */
void file_op_context_create_ui (FileOpContext *ctx, int with_eta);
1999-01-06 Federico Mena Quintero <federico@nuclecu.unam.mx> * fileopctx.h: New file with declarations for the file operation context structure. * fileopctx.c (file_op_context_new): New function to create a file operation context with the default file mask values. (file_op_context_destroy): New function to destroy a file operation context and its associated UI, if appropriate. * filegui.h: Use complete prototype for fmd_init_i18n(). * filegui.c (FileOpContextUI): New structure that describes the UI and internal data for file operation contexts in the text mode version. (file_op_context_create_ui): Renamed from create_op_win() and made it use a context instead of global variables. (file_op_context_destroy_ui): Likewise, renamed from destroy_op_win(). (fmd_widgets): Removed an #ifdef HAVE_XVIEW bit and moved the initialization of the result pointers to file_mask_dialog(), as we need to use the pointers to the fields inside the file op context now. Made all the functions use a file operation context. (file_mask_dialog): Always call fmd_init_i18n(); it will take care of idempotence by itself. (fmd_init_i18n): Now the code that makes sure this function is only called once is here. * cmd.c (check_for_default): Make it use a file operation context. * tree.c (tree_copy): Likewise. (tree_move): Likewise. (tree_rmdir_cmd): Likewise. * file.c: Removed file_progress_replace_progress and file_progress_replace_filename -- they are only used in filegui.c as part of the UI for the file operation context. (panel_operate_generate_prompt): Made static. (panel_operate_generate_prompt): Always call fmd_init_i18n(); it will take care of idempotence by itself. (panel_operate): Removed the panel_operate_def() function, and made panel_operate() take an extra "ask_user" argument. (query_recursive): Made static. * background.c (background_attention): Made static. (register_task_running): Made static. (do_background): Now takes a file operation context as an argument. It stores the pid of the child there. * Makefile.in: Added fileopctx.[ch].
1999-01-07 04:14:50 +03:00
void file_op_context_destroy_ui (FileOpContext *ctx);
FileProgressStatus file_progress_show (FileOpContext *ctx, off_t done, off_t total);
FileProgressStatus file_progress_show_count (FileOpContext *ctx, off_t done, off_t total);
1999-01-06 Federico Mena Quintero <federico@nuclecu.unam.mx> * fileopctx.h: New file with declarations for the file operation context structure. * fileopctx.c (file_op_context_new): New function to create a file operation context with the default file mask values. (file_op_context_destroy): New function to destroy a file operation context and its associated UI, if appropriate. * filegui.h: Use complete prototype for fmd_init_i18n(). * filegui.c (FileOpContextUI): New structure that describes the UI and internal data for file operation contexts in the text mode version. (file_op_context_create_ui): Renamed from create_op_win() and made it use a context instead of global variables. (file_op_context_destroy_ui): Likewise, renamed from destroy_op_win(). (fmd_widgets): Removed an #ifdef HAVE_XVIEW bit and moved the initialization of the result pointers to file_mask_dialog(), as we need to use the pointers to the fields inside the file op context now. Made all the functions use a file operation context. (file_mask_dialog): Always call fmd_init_i18n(); it will take care of idempotence by itself. (fmd_init_i18n): Now the code that makes sure this function is only called once is here. * cmd.c (check_for_default): Make it use a file operation context. * tree.c (tree_copy): Likewise. (tree_move): Likewise. (tree_rmdir_cmd): Likewise. * file.c: Removed file_progress_replace_progress and file_progress_replace_filename -- they are only used in filegui.c as part of the UI for the file operation context. (panel_operate_generate_prompt): Made static. (panel_operate_generate_prompt): Always call fmd_init_i18n(); it will take care of idempotence by itself. (panel_operate): Removed the panel_operate_def() function, and made panel_operate() take an extra "ask_user" argument. (query_recursive): Made static. * background.c (background_attention): Made static. (register_task_running): Made static. (do_background): Now takes a file operation context as an argument. It stores the pid of the child there. * Makefile.in: Added fileopctx.[ch].
1999-01-07 04:14:50 +03:00
FileProgressStatus file_progress_show_bytes (FileOpContext *ctx, double done, double total);
FileProgressStatus file_progress_show_source (FileOpContext *ctx, const char *path);
FileProgressStatus file_progress_show_target (FileOpContext *ctx, const char *path);
FileProgressStatus file_progress_show_deleting (FileOpContext *ctx, const char *path);
1999-01-06 Federico Mena Quintero <federico@nuclecu.unam.mx> * fileopctx.h: New file with declarations for the file operation context structure. * fileopctx.c (file_op_context_new): New function to create a file operation context with the default file mask values. (file_op_context_destroy): New function to destroy a file operation context and its associated UI, if appropriate. * filegui.h: Use complete prototype for fmd_init_i18n(). * filegui.c (FileOpContextUI): New structure that describes the UI and internal data for file operation contexts in the text mode version. (file_op_context_create_ui): Renamed from create_op_win() and made it use a context instead of global variables. (file_op_context_destroy_ui): Likewise, renamed from destroy_op_win(). (fmd_widgets): Removed an #ifdef HAVE_XVIEW bit and moved the initialization of the result pointers to file_mask_dialog(), as we need to use the pointers to the fields inside the file op context now. Made all the functions use a file operation context. (file_mask_dialog): Always call fmd_init_i18n(); it will take care of idempotence by itself. (fmd_init_i18n): Now the code that makes sure this function is only called once is here. * cmd.c (check_for_default): Make it use a file operation context. * tree.c (tree_copy): Likewise. (tree_move): Likewise. (tree_rmdir_cmd): Likewise. * file.c: Removed file_progress_replace_progress and file_progress_replace_filename -- they are only used in filegui.c as part of the UI for the file operation context. (panel_operate_generate_prompt): Made static. (panel_operate_generate_prompt): Always call fmd_init_i18n(); it will take care of idempotence by itself. (panel_operate): Removed the panel_operate_def() function, and made panel_operate() take an extra "ask_user" argument. (query_recursive): Made static. * background.c (background_attention): Made static. (register_task_running): Made static. (do_background): Now takes a file operation context as an argument. It stores the pid of the child there. * Makefile.in: Added fileopctx.[ch].
1999-01-07 04:14:50 +03:00
void file_progress_set_stalled_label (FileOpContext *ctx, const char *stalled_msg);
1999-01-06 Federico Mena Quintero <federico@nuclecu.unam.mx> * fileopctx.h: New file with declarations for the file operation context structure. * fileopctx.c (file_op_context_new): New function to create a file operation context with the default file mask values. (file_op_context_destroy): New function to destroy a file operation context and its associated UI, if appropriate. * filegui.h: Use complete prototype for fmd_init_i18n(). * filegui.c (FileOpContextUI): New structure that describes the UI and internal data for file operation contexts in the text mode version. (file_op_context_create_ui): Renamed from create_op_win() and made it use a context instead of global variables. (file_op_context_destroy_ui): Likewise, renamed from destroy_op_win(). (fmd_widgets): Removed an #ifdef HAVE_XVIEW bit and moved the initialization of the result pointers to file_mask_dialog(), as we need to use the pointers to the fields inside the file op context now. Made all the functions use a file operation context. (file_mask_dialog): Always call fmd_init_i18n(); it will take care of idempotence by itself. (fmd_init_i18n): Now the code that makes sure this function is only called once is here. * cmd.c (check_for_default): Make it use a file operation context. * tree.c (tree_copy): Likewise. (tree_move): Likewise. (tree_rmdir_cmd): Likewise. * file.c: Removed file_progress_replace_progress and file_progress_replace_filename -- they are only used in filegui.c as part of the UI for the file operation context. (panel_operate_generate_prompt): Made static. (panel_operate_generate_prompt): Always call fmd_init_i18n(); it will take care of idempotence by itself. (panel_operate): Removed the panel_operate_def() function, and made panel_operate() take an extra "ask_user" argument. (query_recursive): Made static. * background.c (background_attention): Made static. (register_task_running): Made static. (do_background): Now takes a file operation context as an argument. It stores the pid of the child there. * Makefile.in: Added fileopctx.[ch].
1999-01-07 04:14:50 +03:00
FileProgressStatus file_progress_real_query_replace (FileOpContext *ctx,
enum OperationMode mode,
const char *destname,
1999-01-06 Federico Mena Quintero <federico@nuclecu.unam.mx> * fileopctx.h: New file with declarations for the file operation context structure. * fileopctx.c (file_op_context_new): New function to create a file operation context with the default file mask values. (file_op_context_destroy): New function to destroy a file operation context and its associated UI, if appropriate. * filegui.h: Use complete prototype for fmd_init_i18n(). * filegui.c (FileOpContextUI): New structure that describes the UI and internal data for file operation contexts in the text mode version. (file_op_context_create_ui): Renamed from create_op_win() and made it use a context instead of global variables. (file_op_context_destroy_ui): Likewise, renamed from destroy_op_win(). (fmd_widgets): Removed an #ifdef HAVE_XVIEW bit and moved the initialization of the result pointers to file_mask_dialog(), as we need to use the pointers to the fields inside the file op context now. Made all the functions use a file operation context. (file_mask_dialog): Always call fmd_init_i18n(); it will take care of idempotence by itself. (fmd_init_i18n): Now the code that makes sure this function is only called once is here. * cmd.c (check_for_default): Make it use a file operation context. * tree.c (tree_copy): Likewise. (tree_move): Likewise. (tree_rmdir_cmd): Likewise. * file.c: Removed file_progress_replace_progress and file_progress_replace_filename -- they are only used in filegui.c as part of the UI for the file operation context. (panel_operate_generate_prompt): Made static. (panel_operate_generate_prompt): Always call fmd_init_i18n(); it will take care of idempotence by itself. (panel_operate): Removed the panel_operate_def() function, and made panel_operate() take an extra "ask_user" argument. (query_recursive): Made static. * background.c (background_attention): Made static. (register_task_running): Made static. (do_background): Now takes a file operation context as an argument. It stores the pid of the child there. * Makefile.in: Added fileopctx.[ch].
1999-01-07 04:14:50 +03:00
struct stat *_s_stat,
struct stat *_d_stat);
#endif