Merge branch '2919_dlg_as_widget'
[midnight-commander.git] / src / filemanager / treestore.h
blobb9cf425c855d3f8aa17502afa67d992a98b0959c
1 /** \file treestore.h
2 * \brief Header: tree store
4 * Contains a storage of the file system tree representation.
5 */
7 #ifndef MC__TREE_STORE_H
8 #define MC__TREE_STORE_H
10 /*** typedefs(not structures) and defined constants **********************************************/
13 * Register/unregister notification functions for "entry_remove"
15 struct tree_entry;
16 typedef void (*tree_store_remove_fn) (struct tree_entry * tree, void *data);
18 /*** enums ***************************************************************************************/
20 /*** structures declarations (and typedefs of structures)*****************************************/
22 typedef struct tree_entry
24 vfs_path_t *name; /* The full path of directory */
25 int sublevel; /* Number of parent directories (slashes) */
26 long submask; /* Bitmask of existing sublevels after this entry */
27 const char *subname; /* The last part of name (the actual name) */
28 unsigned int mark:1; /* Flag: Is this entry marked (e. g. for delete)? */
29 unsigned int scanned:1; /* Flag: childs scanned or not */
30 struct tree_entry *next; /* Next item in the list */
31 struct tree_entry *prev; /* Previous item in the list */
32 } tree_entry;
34 struct TreeStore
36 tree_entry *tree_first; /* First entry in the list */
37 tree_entry *tree_last; /* Last entry in the list */
38 tree_entry *check_start; /* Start of checked subdirectories */
39 vfs_path_t *check_name;
40 GList *add_queue_vpath; /* List of vfs_path_t objects of added directories */
41 unsigned int loaded:1;
42 unsigned int dirty:1;
45 /*** global variables defined in .c file *********************************************************/
47 /*** declarations of public functions ************************************************************/
49 struct TreeStore *tree_store_get (void);
50 int tree_store_load (void);
51 int tree_store_save (void);
52 void tree_store_remove_entry (const vfs_path_t * name_vpath);
53 tree_entry *tree_store_start_check (const vfs_path_t * vpath);
54 void tree_store_mark_checked (const char *subname);
55 void tree_store_end_check (void);
56 tree_entry *tree_store_whereis (const vfs_path_t * name);
57 tree_entry *tree_store_rescan (const vfs_path_t * vpath);
59 void tree_store_add_entry_remove_hook (tree_store_remove_fn callback, void *data);
60 void tree_store_remove_entry_remove_hook (tree_store_remove_fn callback);
62 /*** inline functions ****************************************************************************/
63 #endif /* MC__TREE_STORE_H */