1 /* vifm 2 * Copyright (C) 2001 Ken Steen. 3 * Copyright (C) 2011 xaizek. 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 18 */ 19 20 #ifndef VIFM__FOPS_MISC_H__ 21 #define VIFM__FOPS_MISC_H__ 22 23 #include <sys/types.h> /* gid_t uid_t */ 24 25 #include <stdint.h> /* uint64_t */ 26 27 #include "utils/test_helpers.h" 28 29 struct view_t; 30 31 /* Removes marked files (optionally into trash directory) of the view to 32 * specified register. Returns zero on failure and non-zero otherwise, in which 33 * case status bar message is also printed. */ 34 int fops_delete(struct view_t *view, int reg, int use_trash); 35 36 /* Removes current entry of the view. Non-zero nested flag means that this is 37 * not a standalone operation and is surrounded by other file operations. 38 * Returns new value for save_msg flag. */ 39 int fops_delete_current(struct view_t *view, int use_trash, int nested); 40 41 /* Initiates removal of marked files (optionally into trash directory) of the 42 * view to specified register. Returns new value for save_msg flag. */ 43 int fops_delete_bg(struct view_t *view, int use_trash); 44 45 /* Yanks marked files of the view into register specified by its name via reg 46 * parameter. Returns new value for save_msg. */ 47 int fops_yank(struct view_t *view, int reg); 48 49 /* Changes link target interactively. Returns new value for save_msg. */ 50 int fops_retarget(struct view_t *view); 51 52 /* Clones marked files in the view. Returns new value for save_msg flag. */ 53 int fops_clone(struct view_t *view, char *list[], int nlines, int force, 54 int copies); 55 56 /* Creates directories, possibly including intermediate ones. Can modify 57 * strings in the names array. at specifies index of entry to be used to obtain 58 * destination path, -1 means current position. Returns new value for save_msg 59 * flag. */ 60 int fops_mkdirs(struct view_t *view, int at, char *names[], int count, 61 int create_parent); 62 63 /* Creates files. at specifies index of entry to be used to obtain destination 64 * path, -1 means current position. Returns new value for save_msg flag. */ 65 int fops_mkfiles(struct view_t *view, int at, char *names[], int count); 66 67 /* Returns new value for save_msg flag. */ 68 int fops_restore(struct view_t *view); 69 70 /* Initiates background calculation of directory sizes. Forcing disables using 71 * previously cached values. */ 72 void fops_size_bg(struct view_t *view, int force); 73 74 struct cancellation_t; 75 76 /* Calculates size of a directory specified by path possibly using cache of 77 * known sizes. Forcing disables using previously cached values. Returns size 78 * of a directory or zero on error. */ 79 uint64_t fops_dir_size(const char path[], int force, 80 const struct cancellation_t *cancellation); 81 82 #ifndef _WIN32 83 84 /* Sets uid and or gid for marked files. Non-zero u enables setting of uid, 85 * non-zero g of gid. Returns new value for save_msg flag. */ 86 int fops_chown(int u, int g, uid_t uid, gid_t gid); 87 88 /* Changes owner of selected or current file interactively. */ 89 void fops_chuser(void); 90 91 /* Changes group of selected or current file interactively. */ 92 void fops_chgroup(void); 93 94 #endif 95 96 TSTATIC_DEFS( 97 const char * gen_clone_name(const char dir[], const char normal_name[]); 98 ) 99 100 #endif /* VIFM__FOPS_MISC_H__ */ 101 102 /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 : */ 103 /* vim: set cinoptions+=t0 : */ 104