r2228: Made 'Automatic' an icon size, rather than a separate option.
[rox-filer.git] / ROX-Filer / src / dir.h
blob657f59c98f341f1090d193574c1dc70ba2b0fd0d
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 typedef struct _DirectoryClass DirectoryClass;
38 struct _DirectoryClass {
39 GObjectClass parent;
42 struct _Directory
44 GObject object;
46 char *pathname; /* Internal use only */
47 GList *users; /* Functions to call on update */
48 char *error; /* NULL => no error */
50 struct stat stat_info; /* Internal use */
52 gboolean notify_active; /* Notify timeout is running */
53 gint idle_callback; /* Idle callback ID */
55 GHashTable *known_items; /* What our users know about */
56 GPtrArray *new_items; /* New items to add in */
57 GPtrArray *up_items; /* Items to redraw */
58 GPtrArray *gone_items; /* Items removed */
60 GList *recheck_list; /* Items to check on callback */
62 gboolean have_scanned; /* TRUE after first complete scan */
63 gboolean scanning; /* TRUE if we sent DIR_START_SCAN */
65 /* Indicates that the directory needs to be rescanned.
66 * This is cleared when scanning starts, and set when the fscache
67 * detects that the directory needs to be rescanned and is already
68 * scanning.
70 * If scanning finishes when this is set, or if someone attaches
71 * and scanning is not in progress, a rescan is triggered.
73 gboolean needs_update;
76 void dir_init(void);
77 void dir_attach(Directory *dir, DirCallback callback, gpointer data);
78 void dir_detach(Directory *dir, DirCallback callback, gpointer data);
79 void dir_update(Directory *dir, gchar *pathname);
80 void refresh_dirs(const char *path);
81 void dir_check_this(const guchar *path);
82 DirItem *dir_update_item(Directory *dir, const gchar *leafname);
83 void dir_rescan(Directory *dir, const guchar *pathname);
84 void dir_merge_new(Directory *dir);
85 void dir_force_update_path(const gchar *path);
87 #endif /* _DIR_H */