mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 12:32:40 +03:00
Move content of src/filemanager/fileopctx.[ch] to src/filemanager/filegui.[ch].
No functional changes. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
b2b10f1f87
commit
17fd844315
@ -51,8 +51,6 @@
|
|||||||
#include "lib/event-types.h"
|
#include "lib/event-types.h"
|
||||||
#include "lib/util.h" /* my_fork() */
|
#include "lib/util.h" /* my_fork() */
|
||||||
|
|
||||||
#include "filemanager/fileopctx.h" /* file_op_context_t */
|
|
||||||
|
|
||||||
#include "background.h"
|
#include "background.h"
|
||||||
|
|
||||||
/*** global variables ****************************************************************************/
|
/*** global variables ****************************************************************************/
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
#define MC__BACKGROUND_H
|
#define MC__BACKGROUND_H
|
||||||
|
|
||||||
#include <sys/types.h> /* pid_t */
|
#include <sys/types.h> /* pid_t */
|
||||||
#include "filemanager/fileopctx.h"
|
#include "filemanager/filegui.h"
|
||||||
|
|
||||||
/*** typedefs(not structures) and defined constants **********************************************/
|
/*** typedefs(not structures) and defined constants **********************************************/
|
||||||
|
|
||||||
enum TaskState
|
enum TaskState
|
||||||
|
@ -15,7 +15,6 @@ libmcfilemanager_la_SOURCES = \
|
|||||||
filegui.c filegui.h \
|
filegui.c filegui.h \
|
||||||
filemanager.h filemanager.c \
|
filemanager.h filemanager.c \
|
||||||
filenot.c filenot.h \
|
filenot.c filenot.h \
|
||||||
fileopctx.c fileopctx.h \
|
|
||||||
find.c \
|
find.c \
|
||||||
hotlist.c hotlist.h \
|
hotlist.c hotlist.h \
|
||||||
info.c info.h \
|
info.c info.h \
|
||||||
|
@ -76,7 +76,7 @@
|
|||||||
#include "src/diffviewer/ydiff.h"
|
#include "src/diffviewer/ydiff.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "fileopctx.h"
|
#include "filegui.h"
|
||||||
#include "filenot.h"
|
#include "filenot.h"
|
||||||
#include "hotlist.h" /* hotlist_show() */
|
#include "hotlist.h" /* hotlist_show() */
|
||||||
#include "tree.h" /* tree_chdir() */
|
#include "tree.h" /* tree_chdir() */
|
||||||
|
@ -77,7 +77,6 @@
|
|||||||
|
|
||||||
/* Needed for other_panel and WTree */
|
/* Needed for other_panel and WTree */
|
||||||
#include "dir.h"
|
#include "dir.h"
|
||||||
#include "filegui.h"
|
|
||||||
#include "filenot.h"
|
#include "filenot.h"
|
||||||
#include "tree.h"
|
#include "tree.h"
|
||||||
#include "filemanager.h" /* other_panel */
|
#include "filemanager.h" /* other_panel */
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#include "lib/global.h"
|
#include "lib/global.h"
|
||||||
#include "lib/widget.h"
|
#include "lib/widget.h"
|
||||||
|
|
||||||
#include "fileopctx.h"
|
#include "filegui.h"
|
||||||
|
|
||||||
/*** typedefs(not structures) and defined constants **********************************************/
|
/*** typedefs(not structures) and defined constants **********************************************/
|
||||||
|
|
||||||
|
@ -155,7 +155,6 @@ statfs (char const *filename, struct fs_info *buf)
|
|||||||
#include "src/setup.h" /* verbose, safe_overwrite */
|
#include "src/setup.h" /* verbose, safe_overwrite */
|
||||||
|
|
||||||
#include "filemanager.h"
|
#include "filemanager.h"
|
||||||
#include "fileopctx.h" /* FILE_CONT */
|
|
||||||
|
|
||||||
#include "filegui.h"
|
#include "filegui.h"
|
||||||
|
|
||||||
@ -762,6 +761,54 @@ progress_button_callback (WButton *button, int action)
|
|||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
/*** public functions ****************************************************************************/
|
/*** public functions ****************************************************************************/
|
||||||
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
/**
|
||||||
|
* \fn file_op_context_t * file_op_context_new (FileOperation op)
|
||||||
|
* \param op file operation struct
|
||||||
|
* \return The newly-created context, filled with the default file mask values.
|
||||||
|
*
|
||||||
|
* Creates a new file operation context with the default values. If you later want
|
||||||
|
* to have a user interface for this, call file_progress_ui_create().
|
||||||
|
*/
|
||||||
|
|
||||||
|
file_op_context_t *
|
||||||
|
file_op_context_new (FileOperation op)
|
||||||
|
{
|
||||||
|
file_op_context_t *ctx;
|
||||||
|
|
||||||
|
ctx = g_new0 (file_op_context_t, 1);
|
||||||
|
ctx->operation = op;
|
||||||
|
ctx->do_reget = -1;
|
||||||
|
ctx->stat_func = mc_lstat;
|
||||||
|
ctx->preserve = TRUE;
|
||||||
|
ctx->preserve_uidgid = (geteuid () == 0);
|
||||||
|
ctx->umask_kill = (mode_t) (~0);
|
||||||
|
ctx->erase_at_end = TRUE;
|
||||||
|
ctx->ask_overwrite = TRUE;
|
||||||
|
|
||||||
|
return ctx;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
/**
|
||||||
|
* \fn void file_op_context_destroy (file_op_context_t *ctx)
|
||||||
|
* \param ctx The file operation context to destroy.
|
||||||
|
*
|
||||||
|
* Destroys the specified file operation context and its associated UI data, if
|
||||||
|
* it exists.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
file_op_context_destroy (file_op_context_t *ctx)
|
||||||
|
{
|
||||||
|
if (ctx != NULL)
|
||||||
|
{
|
||||||
|
file_progress_ui_destroy (ctx);
|
||||||
|
mc_search_free (ctx->search_handle);
|
||||||
|
g_free (ctx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
FileProgressStatus
|
FileProgressStatus
|
||||||
|
@ -1,23 +1,180 @@
|
|||||||
/** \file filegui.h
|
/** \file filegui.h
|
||||||
* \brief Header: file management GUI for the text mode edition
|
* \brief Header: file management GUI
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MC__FILEGUI_H
|
#ifndef MC__FILEGUI_H
|
||||||
#define MC__FILEGUI_H
|
#define MC__FILEGUI_H
|
||||||
|
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <inttypes.h> /* uintmax_t */
|
||||||
|
|
||||||
#include "lib/global.h"
|
#include "lib/global.h"
|
||||||
#include "fileopctx.h"
|
#include "lib/vfs/vfs.h"
|
||||||
|
|
||||||
/*** typedefs(not structures) and defined constants **********************************************/
|
/*** typedefs(not structures) and defined constants **********************************************/
|
||||||
|
|
||||||
|
typedef int (*mc_stat_fn) (const vfs_path_t * vpath, struct stat * buf);
|
||||||
|
|
||||||
/*** enums ***************************************************************************************/
|
/*** enums ***************************************************************************************/
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
FILEGUI_DIALOG_ONE_ITEM,
|
||||||
|
FILEGUI_DIALOG_MULTI_ITEM,
|
||||||
|
FILEGUI_DIALOG_DELETE_ITEM
|
||||||
|
} filegui_dialog_type_t;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
OP_COPY = 0,
|
||||||
|
OP_MOVE = 1,
|
||||||
|
OP_DELETE = 2
|
||||||
|
} FileOperation;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
RECURSIVE_YES = 0,
|
||||||
|
RECURSIVE_NO = 1,
|
||||||
|
RECURSIVE_ALWAYS = 2,
|
||||||
|
RECURSIVE_NEVER = 3,
|
||||||
|
RECURSIVE_ABORT = 4
|
||||||
|
} FileCopyMode;
|
||||||
|
|
||||||
|
/* ATTENTION: avoid overlapping with B_* values (lib/widget/dialog.h) */
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
FILE_CONT = 10,
|
||||||
|
FILE_RETRY,
|
||||||
|
FILE_SKIP,
|
||||||
|
FILE_ABORT,
|
||||||
|
FILE_IGNORE,
|
||||||
|
FILE_IGNORE_ALL,
|
||||||
|
FILE_SUSPEND
|
||||||
|
} FileProgressStatus;
|
||||||
|
|
||||||
|
/* First argument passed to real functions */
|
||||||
|
enum OperationMode
|
||||||
|
{
|
||||||
|
Foreground,
|
||||||
|
Background
|
||||||
|
};
|
||||||
|
|
||||||
/*** structures declarations (and typedefs of structures)*****************************************/
|
/*** structures declarations (and typedefs of structures)*****************************************/
|
||||||
|
|
||||||
|
struct mc_search_struct;
|
||||||
|
|
||||||
|
/* This structure describes a context for file operations. It is used to update
|
||||||
|
* the progress windows and pass around options.
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
/* Operation type (copy, move, delete) */
|
||||||
|
FileOperation operation;
|
||||||
|
|
||||||
|
/* Start of file transferring */
|
||||||
|
gint64 transfer_start;
|
||||||
|
|
||||||
|
/* The estimated time of arrival in seconds */
|
||||||
|
double eta_secs;
|
||||||
|
|
||||||
|
/* Transferred bytes per second */
|
||||||
|
long bps;
|
||||||
|
|
||||||
|
/* Transferred seconds */
|
||||||
|
long bps_time;
|
||||||
|
|
||||||
|
filegui_dialog_type_t dialog_type;
|
||||||
|
|
||||||
|
/* Counters for progress indicators */
|
||||||
|
size_t progress_count;
|
||||||
|
size_t prev_progress_count; /* Used in OP_MOVE between copy and remove directories */
|
||||||
|
uintmax_t progress_bytes;
|
||||||
|
uintmax_t copied_bytes;
|
||||||
|
|
||||||
|
size_t total_count;
|
||||||
|
uintmax_t total_bytes;
|
||||||
|
/* Whether the panel total has been computed */
|
||||||
|
gboolean totals_computed;
|
||||||
|
|
||||||
|
size_t total_bps;
|
||||||
|
gint64 total_transfer_start;
|
||||||
|
double total_eta_secs;
|
||||||
|
|
||||||
|
/* Result from the recursive query */
|
||||||
|
FileCopyMode recursive_result;
|
||||||
|
|
||||||
|
/* Whether to do a reget */
|
||||||
|
off_t do_reget;
|
||||||
|
|
||||||
|
/* Controls appending to files */
|
||||||
|
gboolean do_append;
|
||||||
|
|
||||||
|
/* Whether to stat or lstat */
|
||||||
|
gboolean follow_links;
|
||||||
|
|
||||||
|
/* Pointer to the stat function we will use */
|
||||||
|
mc_stat_fn stat_func;
|
||||||
|
|
||||||
|
/* Whether to recompute symlinks */
|
||||||
|
gboolean stable_symlinks;
|
||||||
|
|
||||||
|
/* Preserve the original files' owner, group, permissions, and
|
||||||
|
* timestamps (owner, group only as root).
|
||||||
|
*/
|
||||||
|
gboolean preserve;
|
||||||
|
|
||||||
|
/* If running as root, preserve the original uid/gid (we don't want to
|
||||||
|
* try chown for non root) preserve_uidgid = preserve && uid == 0
|
||||||
|
*/
|
||||||
|
gboolean preserve_uidgid;
|
||||||
|
|
||||||
|
/* The bits to preserve in created files' modes on file copy */
|
||||||
|
mode_t umask_kill;
|
||||||
|
|
||||||
|
/* The mask of files to actually operate on */
|
||||||
|
char *dest_mask;
|
||||||
|
|
||||||
|
/* search handler */
|
||||||
|
struct mc_search_struct *search_handle;
|
||||||
|
|
||||||
|
/* Whether to dive into subdirectories for recursive operations */
|
||||||
|
gboolean dive_into_subdirs;
|
||||||
|
|
||||||
|
/* When moving directories cross filesystem boundaries delete the
|
||||||
|
* successfully copied files when all files below the directory and its
|
||||||
|
* subdirectories were processed.
|
||||||
|
*
|
||||||
|
* If erase_at_end is FALSE files will be deleted immediately after their
|
||||||
|
* successful copy (Note: this behavior is not tested and at the moment
|
||||||
|
* it can't be changed at runtime).
|
||||||
|
*/
|
||||||
|
gboolean erase_at_end;
|
||||||
|
|
||||||
|
/* PID of the child for background operations */
|
||||||
|
pid_t pid;
|
||||||
|
|
||||||
|
/* toggle if all errors should be ignored */
|
||||||
|
gboolean ignore_all;
|
||||||
|
|
||||||
|
/* Whether the file operation is in pause */
|
||||||
|
gboolean suspended;
|
||||||
|
|
||||||
|
gboolean ask_overwrite;
|
||||||
|
|
||||||
|
/* User interface data goes here */
|
||||||
|
void *ui;
|
||||||
|
} file_op_context_t;
|
||||||
|
|
||||||
/*** global variables defined in .c file *********************************************************/
|
/*** global variables defined in .c file *********************************************************/
|
||||||
|
|
||||||
|
extern const char *op_names[3];
|
||||||
|
|
||||||
/*** declarations of public functions ************************************************************/
|
/*** declarations of public functions ************************************************************/
|
||||||
|
|
||||||
|
file_op_context_t *file_op_context_new (FileOperation op);
|
||||||
|
void file_op_context_destroy (file_op_context_t * ctx);
|
||||||
|
|
||||||
void file_progress_ui_create (file_op_context_t * ctx, gboolean with_eta,
|
void file_progress_ui_create (file_op_context_t * ctx, gboolean with_eta,
|
||||||
filegui_dialog_type_t dialog_type);
|
filegui_dialog_type_t dialog_type);
|
||||||
void file_progress_ui_destroy (file_op_context_t * ctx);
|
void file_progress_ui_destroy (file_op_context_t * ctx);
|
||||||
@ -37,5 +194,12 @@ void file_progress_show_target (file_op_context_t * ctx, const vfs_path_t * vpat
|
|||||||
gboolean file_progress_show_deleting (file_op_context_t * ctx, const vfs_path_t * vpath,
|
gboolean file_progress_show_deleting (file_op_context_t * ctx, const vfs_path_t * vpath,
|
||||||
size_t *count);
|
size_t *count);
|
||||||
|
|
||||||
|
/* The following functions are implemented separately by each port */
|
||||||
|
FileProgressStatus file_progress_real_query_replace (file_op_context_t * ctx,
|
||||||
|
enum OperationMode mode, const char *src,
|
||||||
|
struct stat *src_stat, const char *dst,
|
||||||
|
struct stat *dst_stat);
|
||||||
|
|
||||||
/*** inline functions ****************************************************************************/
|
/*** inline functions ****************************************************************************/
|
||||||
|
|
||||||
#endif /* MC__FILEGUI_H */
|
#endif /* MC__FILEGUI_H */
|
||||||
|
@ -1,106 +0,0 @@
|
|||||||
/*
|
|
||||||
File operation contexts for the Midnight Commander
|
|
||||||
|
|
||||||
Copyright (C) 1999-2024
|
|
||||||
Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
Written by:
|
|
||||||
Federico Mena <federico@nuclecu.unam.mx>
|
|
||||||
Miguel de Icaza <miguel@nuclecu.unam.mx>
|
|
||||||
|
|
||||||
This file is part of the Midnight Commander.
|
|
||||||
|
|
||||||
The Midnight Commander is free software: you can redistribute it
|
|
||||||
and/or modify it under the terms of the GNU General Public License as
|
|
||||||
published by the Free Software Foundation, either version 3 of the License,
|
|
||||||
or (at your option) any later version.
|
|
||||||
|
|
||||||
The Midnight Commander is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** \file fileopctx.c
|
|
||||||
* \brief Source: file operation contexts
|
|
||||||
* \date 1998-2007
|
|
||||||
* \author Federico Mena <federico@nuclecu.unam.mx>
|
|
||||||
* \author Miguel de Icaza <miguel@nuclecu.unam.mx>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <config.h>
|
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include "lib/global.h"
|
|
||||||
#include "fileopctx.h"
|
|
||||||
#include "filegui.h"
|
|
||||||
#include "lib/search.h"
|
|
||||||
#include "lib/vfs/vfs.h"
|
|
||||||
|
|
||||||
/*** global variables ****************************************************************************/
|
|
||||||
|
|
||||||
/*** file scope macro definitions ****************************************************************/
|
|
||||||
|
|
||||||
/*** file scope type declarations ****************************************************************/
|
|
||||||
|
|
||||||
/*** file scope variables ************************************************************************/
|
|
||||||
|
|
||||||
/*** file scope functions ************************************************************************/
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
|
||||||
/*** public functions ****************************************************************************/
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \fn file_op_context_t * file_op_context_new (FileOperation op)
|
|
||||||
* \param op file operation struct
|
|
||||||
* \return The newly-created context, filled with the default file mask values.
|
|
||||||
*
|
|
||||||
* Creates a new file operation context with the default values. If you later want
|
|
||||||
* to have a user interface for this, call file_progress_ui_create().
|
|
||||||
*/
|
|
||||||
|
|
||||||
file_op_context_t *
|
|
||||||
file_op_context_new (FileOperation op)
|
|
||||||
{
|
|
||||||
file_op_context_t *ctx;
|
|
||||||
|
|
||||||
ctx = g_new0 (file_op_context_t, 1);
|
|
||||||
ctx->operation = op;
|
|
||||||
ctx->do_reget = -1;
|
|
||||||
ctx->stat_func = mc_lstat;
|
|
||||||
ctx->preserve = TRUE;
|
|
||||||
ctx->preserve_uidgid = (geteuid () == 0);
|
|
||||||
ctx->umask_kill = (mode_t) (~0);
|
|
||||||
ctx->erase_at_end = TRUE;
|
|
||||||
ctx->ask_overwrite = TRUE;
|
|
||||||
|
|
||||||
return ctx;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
|
||||||
/**
|
|
||||||
* \fn void file_op_context_destroy (file_op_context_t *ctx)
|
|
||||||
* \param ctx The file operation context to destroy.
|
|
||||||
*
|
|
||||||
* Destroys the specified file operation context and its associated UI data, if
|
|
||||||
* it exists.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
file_op_context_destroy (file_op_context_t *ctx)
|
|
||||||
{
|
|
||||||
if (ctx != NULL)
|
|
||||||
{
|
|
||||||
file_progress_ui_destroy (ctx);
|
|
||||||
mc_search_free (ctx->search_handle);
|
|
||||||
g_free (ctx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
|
@ -1,189 +0,0 @@
|
|||||||
/** \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>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef MC__FILEOPCTX_H
|
|
||||||
#define MC__FILEOPCTX_H
|
|
||||||
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <inttypes.h> /* uintmax_t */
|
|
||||||
|
|
||||||
#include "lib/global.h"
|
|
||||||
#include "lib/vfs/vfs.h"
|
|
||||||
|
|
||||||
|
|
||||||
/*** typedefs(not structures) and defined constants **********************************************/
|
|
||||||
|
|
||||||
typedef int (*mc_stat_fn) (const vfs_path_t * vpath, struct stat * buf);
|
|
||||||
|
|
||||||
/*** enums ***************************************************************************************/
|
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
FILEGUI_DIALOG_ONE_ITEM,
|
|
||||||
FILEGUI_DIALOG_MULTI_ITEM,
|
|
||||||
FILEGUI_DIALOG_DELETE_ITEM
|
|
||||||
} filegui_dialog_type_t;
|
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
OP_COPY = 0,
|
|
||||||
OP_MOVE = 1,
|
|
||||||
OP_DELETE = 2
|
|
||||||
} FileOperation;
|
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
RECURSIVE_YES = 0,
|
|
||||||
RECURSIVE_NO = 1,
|
|
||||||
RECURSIVE_ALWAYS = 2,
|
|
||||||
RECURSIVE_NEVER = 3,
|
|
||||||
RECURSIVE_ABORT = 4
|
|
||||||
} FileCopyMode;
|
|
||||||
|
|
||||||
/* ATTENTION: avoid overlapping with B_* values (lib/widget/dialog.h) */
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
FILE_CONT = 10,
|
|
||||||
FILE_RETRY,
|
|
||||||
FILE_SKIP,
|
|
||||||
FILE_ABORT,
|
|
||||||
FILE_IGNORE,
|
|
||||||
FILE_IGNORE_ALL,
|
|
||||||
FILE_SUSPEND
|
|
||||||
} FileProgressStatus;
|
|
||||||
|
|
||||||
/* First argument passed to real functions */
|
|
||||||
enum OperationMode
|
|
||||||
{
|
|
||||||
Foreground,
|
|
||||||
Background
|
|
||||||
};
|
|
||||||
|
|
||||||
/*** structures declarations (and typedefs of structures)*****************************************/
|
|
||||||
|
|
||||||
struct mc_search_struct;
|
|
||||||
|
|
||||||
/* This structure describes a context for file operations. It is used to update
|
|
||||||
* the progress windows and pass around options.
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
/* Operation type (copy, move, delete) */
|
|
||||||
FileOperation operation;
|
|
||||||
|
|
||||||
/* Start of file transferring */
|
|
||||||
gint64 transfer_start;
|
|
||||||
|
|
||||||
/* The estimated time of arrival in seconds */
|
|
||||||
double eta_secs;
|
|
||||||
|
|
||||||
/* Transferred bytes per second */
|
|
||||||
long bps;
|
|
||||||
|
|
||||||
/* Transferred seconds */
|
|
||||||
long bps_time;
|
|
||||||
|
|
||||||
filegui_dialog_type_t dialog_type;
|
|
||||||
|
|
||||||
/* Counters for progress indicators */
|
|
||||||
size_t progress_count;
|
|
||||||
size_t prev_progress_count; /* Used in OP_MOVE between copy and remove directories */
|
|
||||||
uintmax_t progress_bytes;
|
|
||||||
uintmax_t copied_bytes;
|
|
||||||
|
|
||||||
size_t total_count;
|
|
||||||
uintmax_t total_bytes;
|
|
||||||
/* Whether the panel total has been computed */
|
|
||||||
gboolean totals_computed;
|
|
||||||
|
|
||||||
size_t total_bps;
|
|
||||||
gint64 total_transfer_start;
|
|
||||||
double total_eta_secs;
|
|
||||||
|
|
||||||
/* Result from the recursive query */
|
|
||||||
FileCopyMode recursive_result;
|
|
||||||
|
|
||||||
/* Whether to do a reget */
|
|
||||||
off_t do_reget;
|
|
||||||
|
|
||||||
/* Controls appending to files */
|
|
||||||
gboolean do_append;
|
|
||||||
|
|
||||||
/* Whether to stat or lstat */
|
|
||||||
gboolean follow_links;
|
|
||||||
|
|
||||||
/* Pointer to the stat function we will use */
|
|
||||||
mc_stat_fn stat_func;
|
|
||||||
|
|
||||||
/* Whether to recompute symlinks */
|
|
||||||
gboolean stable_symlinks;
|
|
||||||
|
|
||||||
/* Preserve the original files' owner, group, permissions, and
|
|
||||||
* timestamps (owner, group only as root).
|
|
||||||
*/
|
|
||||||
gboolean preserve;
|
|
||||||
|
|
||||||
/* If running as root, preserve the original uid/gid (we don't want to
|
|
||||||
* try chown for non root) preserve_uidgid = preserve && uid == 0
|
|
||||||
*/
|
|
||||||
gboolean preserve_uidgid;
|
|
||||||
|
|
||||||
/* The bits to preserve in created files' modes on file copy */
|
|
||||||
mode_t umask_kill;
|
|
||||||
|
|
||||||
/* The mask of files to actually operate on */
|
|
||||||
char *dest_mask;
|
|
||||||
|
|
||||||
/* search handler */
|
|
||||||
struct mc_search_struct *search_handle;
|
|
||||||
|
|
||||||
/* Whether to dive into subdirectories for recursive operations */
|
|
||||||
gboolean dive_into_subdirs;
|
|
||||||
|
|
||||||
/* When moving directories cross filesystem boundaries delete the
|
|
||||||
* successfully copied files when all files below the directory and its
|
|
||||||
* subdirectories were processed.
|
|
||||||
*
|
|
||||||
* If erase_at_end is FALSE files will be deleted immediately after their
|
|
||||||
* successful copy (Note: this behavior is not tested and at the moment
|
|
||||||
* it can't be changed at runtime).
|
|
||||||
*/
|
|
||||||
gboolean erase_at_end;
|
|
||||||
|
|
||||||
/* PID of the child for background operations */
|
|
||||||
pid_t pid;
|
|
||||||
|
|
||||||
/* toggle if all errors should be ignored */
|
|
||||||
gboolean ignore_all;
|
|
||||||
|
|
||||||
/* Whether the file operation is in pause */
|
|
||||||
gboolean suspended;
|
|
||||||
|
|
||||||
gboolean ask_overwrite;
|
|
||||||
|
|
||||||
/* User interface data goes here */
|
|
||||||
void *ui;
|
|
||||||
} file_op_context_t;
|
|
||||||
|
|
||||||
/*** global variables defined in .c file *********************************************************/
|
|
||||||
|
|
||||||
extern const char *op_names[3];
|
|
||||||
|
|
||||||
/*** declarations of public functions ************************************************************/
|
|
||||||
|
|
||||||
file_op_context_t *file_op_context_new (FileOperation op);
|
|
||||||
void file_op_context_destroy (file_op_context_t * ctx);
|
|
||||||
|
|
||||||
/* The following functions are implemented separately by each port */
|
|
||||||
FileProgressStatus file_progress_real_query_replace (file_op_context_t * ctx,
|
|
||||||
enum OperationMode mode, const char *src,
|
|
||||||
struct stat *src_stat, const char *dst,
|
|
||||||
struct stat *dst_stat);
|
|
||||||
|
|
||||||
/*** inline functions ****************************************************************************/
|
|
||||||
#endif /* MC__FILEOPCTX_H */
|
|
Loading…
Reference in New Issue
Block a user