utilunix.c(mc_tmpdir): Check return value of getpwuid() for NULL.
[midnight-commander.git] / src / treestore.h
blob0f1a037bc98f889d66f1a8712d722fe3a6159693
1 #ifndef __TREE_STORE_H
2 #define __TREE_STORE_H
4 /* Default filenames for the tree */
6 #define MC_TREE ".mc/Tree"
7 #define MC_TREE_TMP ".mc/Tree.tmp"
9 typedef struct tree_entry {
10 char *name; /* The full path of directory */
11 int sublevel; /* Number of parent directories (slashes) */
12 long submask; /* Bitmask of existing sublevels after this entry */
13 char *subname; /* The last part of name (the actual name) */
14 unsigned int mark:1; /* Flag: Is this entry marked (e. g. for delete)? */
15 unsigned int scanned:1; /* Flag: childs scanned or not */
16 struct tree_entry *next; /* Next item in the list */
17 struct tree_entry *prev; /* Previous item in the list */
18 } tree_entry;
20 struct TreeStore {
21 tree_entry *tree_first; /* First entry in the list */
22 tree_entry *tree_last; /* Last entry in the list */
23 tree_entry *check_start; /* Start of checked subdirectories */
24 char *check_name;
25 GList *add_queue; /* List of strings of added directories */
26 unsigned int loaded:1;
27 unsigned int dirty:1;
30 struct TreeStore *tree_store_get (void);
31 int tree_store_load (void);
32 int tree_store_save (void);
33 void tree_store_remove_entry (char *name);
34 tree_entry *tree_store_start_check (char *path);
35 void tree_store_mark_checked (const char *subname);
36 void tree_store_end_check (void);
37 tree_entry *tree_store_whereis (char *name);
38 tree_entry *tree_store_rescan (char *dir);
41 * Register/unregister notification functions for "entry_remove"
43 typedef void (*tree_store_remove_fn) (tree_entry *tree, void *data);
44 void tree_store_add_entry_remove_hook (tree_store_remove_fn callback,
45 void *data);
46 void tree_store_remove_entry_remove_hook (tree_store_remove_fn callback);
48 #endif /* !__TREE_STORE_H */