1 /* File operation contexts for the Midnight Commander
3 Copyright (C) 1998 The Free Software Foundation
5 Authors: Federico Mena <federico@nuclecu.unam.mx>
6 Miguel de Icaza <miguel@nuclecu.unam.mx>
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 #include "fileopctx.h"
28 #include "../vfs/vfs.h"
32 * file_op_context_new:
34 * Creates a new file operation context with the default values. If you later want
35 * to have a user interface for this, call #file_op_context_create_ui().
37 * Return value: The newly-created context, filled with the default file mask values.
40 file_op_context_new (void)
44 ctx
= g_new0 (FileOpContext
, 1);
46 ctx
->progress_bytes
= 0.0;
47 ctx
->op_preserve
= TRUE
;
49 ctx
->stat_func
= (mc_stat_fn
) mc_lstat
;
51 ctx
->preserve_uidgid
= (geteuid () == 0) ? TRUE
: FALSE
;
52 ctx
->umask_kill
= 0777777;
53 ctx
->erase_at_end
= TRUE
;
60 * file_op_context_destroy:
61 * @ctx: The file operation context to destroy.
63 * Destroys the specified file operation context and its associated UI data, if
67 file_op_context_destroy (FileOpContext
*ctx
)
69 g_return_if_fail (ctx
!= NULL
);
72 file_op_context_destroy_ui (ctx
);
76 /* FIXME: do we need to free ctx->dest_mask? */