Not only comment it out but removing it
[midnight-commander.git] / src / fileopctx.c
blobad02cf4ae113a8b064322c9f327d609955a90606
1 /* File operation contexts for the Midnight Commander
3 Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005, 2007
4 Free Software Foundation, Inc.
6 Authors: Federico Mena <federico@nuclecu.unam.mx>
7 Miguel de Icaza <miguel@nuclecu.unam.mx>
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 #include <config.h>
26 #include <unistd.h>
28 #include "global.h"
29 #include "fileopctx.h"
32 /**
33 * file_op_context_new:
35 * Creates a new file operation context with the default values. If you later want
36 * to have a user interface for this, call #file_op_context_create_ui().
38 * Return value: The newly-created context, filled with the default file mask values.
39 **/
40 FileOpContext *
41 file_op_context_new (FileOperation op)
43 FileOpContext *ctx;
45 ctx = g_new0 (FileOpContext, 1);
46 ctx->operation = op;
47 ctx->eta_secs = 0.0;
48 ctx->progress_bytes = 0.0;
49 ctx->op_preserve = TRUE;
50 ctx->do_reget = TRUE;
51 ctx->stat_func = mc_lstat;
52 ctx->preserve = TRUE;
53 ctx->preserve_uidgid = (geteuid () == 0) ? TRUE : FALSE;
54 ctx->umask_kill = 0777777;
55 ctx->erase_at_end = TRUE;
57 return ctx;
61 /**
62 * file_op_context_destroy:
63 * @ctx: The file operation context to destroy.
65 * Destroys the specified file operation context and its associated UI data, if
66 * it exists.
67 **/
68 void
69 file_op_context_destroy (FileOpContext *ctx)
71 g_return_if_fail (ctx != NULL);
73 if (ctx->ui)
74 file_op_context_destroy_ui (ctx);
76 regfree (&ctx->rx);
78 /* FIXME: do we need to free ctx->dest_mask? */
80 g_free (ctx);