2 File operation contexts for the Midnight Commander
4 Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005, 2007, 2011
5 The Free Software Foundation, Inc.
8 Federico Mena <federico@nuclecu.unam.mx>
9 Miguel de Icaza <miguel@nuclecu.unam.mx>
11 This file is part of the Midnight Commander.
13 The Midnight Commander is free software: you can redistribute it
14 and/or modify it under the terms of the GNU General Public License as
15 published by the Free Software Foundation, either version 3 of the License,
16 or (at your option) any later version.
18 The Midnight Commander is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
23 You should have received a copy of the GNU General Public License
24 along with this program. If not, see <http://www.gnu.org/licenses/>.
28 * \brief Source: file operation contexts
30 * \author Federico Mena <federico@nuclecu.unam.mx>
31 * \author Miguel de Icaza <miguel@nuclecu.unam.mx>
38 #include "lib/global.h"
39 #include "fileopctx.h"
41 #include "lib/search.h"
42 #include "lib/vfs/vfs.h"
44 /*** global variables ****************************************************************************/
46 /*** file scope macro definitions ****************************************************************/
48 /*** file scope type declarations ****************************************************************/
50 /*** file scope variables ************************************************************************/
52 /*** file scope functions ************************************************************************/
53 /* --------------------------------------------------------------------------------------------- */
55 /* --------------------------------------------------------------------------------------------- */
56 /*** public functions ****************************************************************************/
57 /* --------------------------------------------------------------------------------------------- */
60 * \fn FileOpContext * file_op_context_new (FileOperation op)
61 * \param op file operation struct
62 * \return The newly-created context, filled with the default file mask values.
64 * Creates a new file operation context with the default values. If you later want
65 * to have a user interface for this, call file_op_context_create_ui().
69 file_op_context_new (FileOperation op
)
73 ctx
= g_new0 (FileOpContext
, 1);
76 ctx
->progress_bytes
= 0;
77 ctx
->op_preserve
= TRUE
;
79 ctx
->stat_func
= mc_lstat
;
81 ctx
->preserve_uidgid
= (geteuid () == 0);
82 ctx
->umask_kill
= 0777777;
83 ctx
->erase_at_end
= TRUE
;
84 ctx
->skip_all
= FALSE
;
89 /* --------------------------------------------------------------------------------------------- */
91 * \fn void file_op_context_destroy (FileOpContext *ctx)
92 * \param ctx The file operation context to destroy.
94 * Destroys the specified file operation context and its associated UI data, if
99 file_op_context_destroy (FileOpContext
* ctx
)
101 g_return_if_fail (ctx
!= NULL
);
103 file_op_context_destroy_ui (ctx
);
104 mc_search_free (ctx
->search_handle
);
105 /** \todo FIXME: do we need to free ctx->dest_mask? */
109 /* --------------------------------------------------------------------------------------------- */
112 file_op_total_context_new (void)
114 FileOpTotalContext
*tctx
;
115 tctx
= g_new0 (FileOpTotalContext
, 1);
116 tctx
->ask_overwrite
= TRUE
;
120 /* --------------------------------------------------------------------------------------------- */
123 file_op_total_context_destroy (FileOpTotalContext
* tctx
)
128 /* --------------------------------------------------------------------------------------------- */