1
2
3
4
5
6
7
8 #ifndef MC__FILEOPCTX_H
9 #define MC__FILEOPCTX_H
10
11 #include <sys/stat.h>
12 #include <sys/types.h>
13 #include <inttypes.h>
14
15 #include "lib/global.h"
16 #include "lib/vfs/vfs.h"
17
18
19
20
21 typedef int (*mc_stat_fn) (const vfs_path_t * vpath, struct stat * buf);
22
23
24
25 typedef enum
26 {
27 FILEGUI_DIALOG_ONE_ITEM,
28 FILEGUI_DIALOG_MULTI_ITEM,
29 FILEGUI_DIALOG_DELETE_ITEM
30 } filegui_dialog_type_t;
31
32 typedef enum
33 {
34 OP_COPY = 0,
35 OP_MOVE = 1,
36 OP_DELETE = 2
37 } FileOperation;
38
39 typedef enum
40 {
41 RECURSIVE_YES = 0,
42 RECURSIVE_NO = 1,
43 RECURSIVE_ALWAYS = 2,
44 RECURSIVE_NEVER = 3,
45 RECURSIVE_ABORT = 4
46 } FileCopyMode;
47
48
49 typedef enum
50 {
51 FILE_CONT = 10,
52 FILE_RETRY,
53 FILE_SKIP,
54 FILE_ABORT,
55 FILE_IGNORE,
56 FILE_IGNORE_ALL,
57 FILE_SUSPEND
58 } FileProgressStatus;
59
60
61 enum OperationMode
62 {
63 Foreground,
64 Background
65 };
66
67
68
69 struct mc_search_struct;
70
71
72
73
74 typedef struct
75 {
76
77 FileOperation operation;
78
79
80 double eta_secs;
81
82
83 long bps;
84
85
86 long bps_time;
87
88
89 gboolean progress_totals_computed;
90 filegui_dialog_type_t dialog_type;
91
92
93 size_t progress_count;
94 uintmax_t progress_bytes;
95
96
97 FileCopyMode recursive_result;
98
99
100 off_t do_reget;
101
102
103 gboolean do_append;
104
105
106 gboolean follow_links;
107
108
109 mc_stat_fn stat_func;
110
111
112 gboolean stable_symlinks;
113
114
115
116
117 gboolean preserve;
118
119
120
121
122 gboolean preserve_uidgid;
123
124
125 mode_t umask_kill;
126
127
128 char *dest_mask;
129
130
131 struct mc_search_struct *search_handle;
132
133
134 gboolean dive_into_subdirs;
135
136
137
138
139
140
141
142
143
144 gboolean erase_at_end;
145
146
147 pid_t pid;
148
149
150 gboolean ignore_all;
151
152
153 gboolean suspended;
154
155
156 void *ui;
157 } file_op_context_t;
158
159 typedef struct
160 {
161 size_t progress_count;
162 size_t prev_progress_count;
163 uintmax_t progress_bytes;
164 uintmax_t copied_bytes;
165 size_t bps;
166 size_t bps_count;
167 gint64 transfer_start;
168 double eta_secs;
169
170 gboolean ask_overwrite;
171 } file_op_total_context_t;
172
173
174
175 extern const char *op_names[3];
176
177
178
179 file_op_context_t *file_op_context_new (FileOperation op);
180 void file_op_context_destroy (file_op_context_t * ctx);
181
182 file_op_total_context_t *file_op_total_context_new (void);
183 void file_op_total_context_destroy (file_op_total_context_t * tctx);
184
185
186 FileProgressStatus file_progress_real_query_replace (file_op_context_t * ctx,
187 enum OperationMode mode, const char *src,
188 struct stat *src_stat, const char *dst,
189 struct stat *dst_stat);
190
191
192 #endif