r1107: Added a configure check for iconv.h.
[rox-filer.git] / ROX-Filer / src / dir.h
blobfe927b774c523990888636c6ce160ffc32233bd2
1 /*
2 * $Id$
4 * Thomas Leonard, <tal197@users.sourceforge.net>
5 */
8 #ifndef _DIR_H
9 #define _DIR_H
11 #include <sys/types.h>
12 #include <dirent.h>
14 typedef enum {
15 DIR_START_SCAN, /* Set 'scanning' indicator */
16 DIR_END_SCAN, /* Clear 'scanning' indicator */
17 DIR_ADD, /* Add the listed items to the display */
18 DIR_REMOVE, /* Remove listed items from display */
19 DIR_UPDATE, /* Redraw these items */
20 } DirAction;
22 typedef struct _DirUser DirUser;
23 typedef void (*DirCallback)(Directory *dir,
24 DirAction action,
25 GPtrArray *items,
26 gpointer data);
28 extern GFSCache *dir_cache;
30 struct _DirUser
32 DirCallback callback;
33 gpointer data;
36 struct _Directory
38 char *pathname; /* Internal use only */
39 int ref;
40 GList *users; /* Functions to call on update */
41 char *error; /* NULL => no error */
43 gboolean notify_active; /* Notify timeout is running */
44 gint idle_callback; /* Idle callback ID */
46 GHashTable *known_items; /* What our users know about */
47 GPtrArray *new_items; /* New items to add in */
48 GPtrArray *up_items; /* Items to redraw */
50 GList *recheck_list; /* Items to check on callback */
52 gboolean have_scanned; /* TRUE after first complete scan */
53 gboolean scanning; /* TRUE if we sent DIR_START_SCAN */
55 /* Indicates that the directory needs to be rescanned.
56 * This is cleared when scanning starts, and set when the fscache
57 * detects that the directory needs to be rescanned and is already
58 * scanning.
60 * If scanning finishes when this is set, or if someone attaches
61 * and scanning is not in progress, a rescan is triggered.
63 gboolean needs_update;
66 void dir_init(void);
67 void dir_attach(Directory *dir, DirCallback callback, gpointer data);
68 void dir_detach(Directory *dir, DirCallback callback, gpointer data);
69 void dir_update(Directory *dir, gchar *pathname);
70 int dir_item_cmp(const void *a, const void *b);
71 void refresh_dirs(char *path);
72 void dir_check_this(guchar *path);
73 DirItem *dir_update_item(Directory *dir, gchar *leafname);
74 void dir_rescan(Directory *dir, guchar *pathname);
75 void dir_merge_new(Directory *dir);
76 void dir_force_update_path(gchar *path);
78 #endif /* _DIR_H */