1999-01-09 03:43:05 +00:00
|
|
|
#ifndef __TREE_STORE_H
|
|
|
|
#define __TREE_STORE_H
|
|
|
|
|
|
|
|
typedef struct tree_entry {
|
|
|
|
char *name; /* The full path of directory */
|
|
|
|
int sublevel; /* Number of parent directories (slashes) */
|
|
|
|
long submask; /* Bitmask of existing sublevels after this entry */
|
|
|
|
char *subname; /* The last part of name (the actual name) */
|
1999-01-12 05:55:12 +00:00
|
|
|
unsigned int mark:1; /* Flag: Is this entry marked (e. g. for delete)? */
|
|
|
|
unsigned int scanned:1; /* Flag: childs scanned or not */
|
1999-01-09 03:43:05 +00:00
|
|
|
struct tree_entry *next; /* Next item in the list */
|
|
|
|
struct tree_entry *prev; /* Previous item in the list */
|
|
|
|
} tree_entry;
|
|
|
|
|
1999-01-12 05:55:12 +00:00
|
|
|
typedef struct {
|
|
|
|
struct tree_entry *base;
|
|
|
|
struct tree_entry *current;
|
|
|
|
int base_dir_len;
|
|
|
|
int sublevel;
|
|
|
|
} tree_scan;
|
|
|
|
|
1999-01-09 03:43:05 +00:00
|
|
|
typedef struct {
|
|
|
|
int refcount;
|
|
|
|
tree_entry *tree_first; /* First entry in the list */
|
|
|
|
tree_entry *tree_last; /* Last entry in the list */
|
|
|
|
tree_entry *check_start; /* Start of checked subdirectories */
|
1999-02-07 05:04:09 +00:00
|
|
|
GSList *check_name_stack;
|
1999-01-12 05:55:12 +00:00
|
|
|
unsigned int loaded : 1;
|
|
|
|
unsigned int dirty : 1;
|
1999-01-09 03:43:05 +00:00
|
|
|
} TreeStore;
|
|
|
|
|
1999-02-05 02:45:43 +00:00
|
|
|
#define TREE_CHECK_NAME ts.check_name_list->data
|
|
|
|
|
1999-01-12 05:55:12 +00:00
|
|
|
extern void (*tree_store_dirty_notify)(int state);
|
|
|
|
|
1999-01-14 01:10:32 +00:00
|
|
|
TreeStore *tree_store_init (void);
|
|
|
|
int tree_store_load (char *name);
|
|
|
|
int tree_store_save (char *name);
|
|
|
|
tree_entry *tree_store_add_entry (char *name);
|
|
|
|
void tree_store_remove_entry (char *name);
|
|
|
|
void tree_store_destroy (void);
|
|
|
|
tree_entry *tree_store_start_check (char *path);
|
|
|
|
tree_entry *tree_store_start_check_cwd (void);
|
|
|
|
void tree_store_mark_checked (const char *subname);
|
|
|
|
void tree_store_end_check (void);
|
|
|
|
tree_entry *tree_store_whereis (char *name);
|
|
|
|
tree_entry *tree_store_rescan (char *dir);
|
1999-01-09 03:43:05 +00:00
|
|
|
|
1999-01-23 20:43:36 +00:00
|
|
|
/*
|
|
|
|
* Register/unregister notification functions for "entry_remove"
|
|
|
|
*/
|
1999-01-09 03:43:05 +00:00
|
|
|
typedef void (*tree_store_remove_fn)(tree_entry *tree, void *data);
|
1999-01-23 20:43:36 +00:00
|
|
|
void tree_store_add_entry_remove_hook (tree_store_remove_fn callback, void *data);
|
|
|
|
void tree_store_remove_entry_remove_hook (tree_store_remove_fn callback);
|
1999-01-09 03:43:05 +00:00
|
|
|
|
1999-01-23 20:43:36 +00:00
|
|
|
/*
|
|
|
|
* Register/unregister notification functions for "entry_remove"
|
|
|
|
*/
|
|
|
|
typedef void (*tree_store_add_fn)(tree_entry *tree, void *data);
|
|
|
|
void tree_store_add_entry_add_hook (tree_store_remove_fn callback, void *data);
|
|
|
|
void tree_store_remove_entry_add_hook (tree_store_remove_fn callback);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Changes in the tree_entry are notified with these
|
|
|
|
*/
|
|
|
|
void tree_store_notify_remove (tree_entry *entry);
|
|
|
|
void tree_store_notify_add (tree_entry *entry);
|
1999-01-12 05:55:12 +00:00
|
|
|
|
|
|
|
tree_scan *tree_store_opendir (char *path);
|
|
|
|
tree_entry *tree_store_readdir (tree_scan *scanner);
|
|
|
|
void tree_store_closedir (tree_scan *scanner);
|
|
|
|
|
1999-01-09 03:43:05 +00:00
|
|
|
#endif
|