3 * \brief Header: tree store
5 * Contains a storage of the file system tree representation.
8 #ifndef MC_TREE_STORE_H
9 #define MC_TREE_STORE_H
11 /* Default filenames for the tree */
13 #define MC_TREE ".mc/Tree"
14 #define MC_TREE_TMP ".mc/Tree.tmp"
16 typedef struct tree_entry
{
17 char *name
; /* The full path of directory */
18 int sublevel
; /* Number of parent directories (slashes) */
19 long submask
; /* Bitmask of existing sublevels after this entry */
20 const char *subname
; /* The last part of name (the actual name) */
21 unsigned int mark
:1; /* Flag: Is this entry marked (e. g. for delete)? */
22 unsigned int scanned
:1; /* Flag: childs scanned or not */
23 struct tree_entry
*next
; /* Next item in the list */
24 struct tree_entry
*prev
; /* Previous item in the list */
28 tree_entry
*tree_first
; /* First entry in the list */
29 tree_entry
*tree_last
; /* Last entry in the list */
30 tree_entry
*check_start
; /* Start of checked subdirectories */
32 GList
*add_queue
; /* List of strings of added directories */
33 unsigned int loaded
:1;
37 struct TreeStore
*tree_store_get (void);
38 int tree_store_load (void);
39 int tree_store_save (void);
40 void tree_store_remove_entry (const char *name
);
41 tree_entry
*tree_store_start_check (const char *path
);
42 void tree_store_mark_checked (const char *subname
);
43 void tree_store_end_check (void);
44 tree_entry
*tree_store_whereis (const char *name
);
45 tree_entry
*tree_store_rescan (const char *dir
);
48 * Register/unregister notification functions for "entry_remove"
50 typedef void (*tree_store_remove_fn
) (tree_entry
*tree
, void *data
);
51 void tree_store_add_entry_remove_hook (tree_store_remove_fn callback
,
53 void tree_store_remove_entry_remove_hook (tree_store_remove_fn callback
);