r4567: Get ATK headers through Zero Install.
[rox-filer/translations.git] / ROX-Filer / src / dir.h
bloba66e41334ce492f116deba120091d1fe847852e5
1 /*
2 * ROX-Filer, filer for the ROX desktop project
3 * Thomas Leonard, <tal197@users.sourceforge.net>
4 */
7 #ifndef _DIR_H
8 #define _DIR_H
10 #include <sys/types.h>
11 #include <dirent.h>
13 #include <signal.h>
14 #include <fcntl.h>
16 /* Check for dnotify support */
17 #if defined(DN_MULTISHOT) && defined(SIGRTMIN)
18 # define USE_DNOTIFY
19 extern gboolean dnotify_wakeup_flag;
20 #endif
22 typedef enum {
23 DIR_START_SCAN, /* Set 'scanning' indicator */
24 DIR_END_SCAN, /* Clear 'scanning' indicator */
25 DIR_ADD, /* Add the listed items to the display */
26 DIR_REMOVE, /* Remove listed items from display */
27 DIR_UPDATE, /* Redraw these items */
28 DIR_ERROR_CHANGED, /* Check dir->error */
29 DIR_QUEUE_INTERESTING, /* Call dir_queue_recheck */
30 } DirAction;
32 typedef struct _DirUser DirUser;
33 typedef void (*DirCallback)(Directory *dir,
34 DirAction action,
35 GPtrArray *items,
36 gpointer data);
38 extern GFSCache *dir_cache;
40 struct _DirUser
42 DirCallback callback;
43 gpointer data;
46 typedef struct _DirectoryClass DirectoryClass;
48 struct _DirectoryClass {
49 GObjectClass parent;
52 struct _Directory
54 GObject object;
56 char *pathname; /* Internal use only */
57 GList *users; /* Functions to call on update */
58 char *error; /* NULL => no error */
60 struct stat stat_info; /* Internal use */
62 gboolean notify_active; /* Notify timeout is running */
63 gint idle_callback; /* Idle callback ID */
65 GHashTable *known_items; /* What our users know about */
66 GPtrArray *new_items; /* New items to add in */
67 GPtrArray *up_items; /* Items to redraw */
68 GPtrArray *gone_items; /* Items removed */
70 GList *recheck_list; /* Items to check on callback */
72 gboolean have_scanned; /* TRUE after first complete scan */
73 gboolean scanning; /* TRUE if we sent DIR_START_SCAN */
75 /* Indicates that the directory needs to be rescanned.
76 * This is cleared when scanning starts, and set when the fscache
77 * detects that the directory needs to be rescanned and is already
78 * scanning.
80 * If scanning finishes when this is set, or if someone attaches
81 * and scanning is not in progress, a rescan is triggered.
83 gboolean needs_update;
85 gint rescan_timeout; /* See dir_rescan_soon() */
87 #ifdef USE_DNOTIFY
88 int dnotify_fd; /* -1 if not watching */
89 #endif
92 void dir_init(void);
93 void dir_attach(Directory *dir, DirCallback callback, gpointer data);
94 void dir_detach(Directory *dir, DirCallback callback, gpointer data);
95 void dir_update(Directory *dir, gchar *pathname);
96 void refresh_dirs(const char *path);
97 void dir_check_this(const guchar *path);
98 DirItem *dir_update_item(Directory *dir, const gchar *leafname);
99 void dir_merge_new(Directory *dir);
100 void dir_force_update_path(const gchar *path);
101 void dnotify_wakeup(void);
102 void dir_drop_all_dnotifies(void);
103 void dir_queue_recheck(Directory *dir, DirItem *item);
105 #endif /* _DIR_H */