2 * ROX-Filer, filer for the ROX desktop project
3 * Thomas Leonard, <tal197@users.sourceforge.net>
10 #include <sys/types.h>
16 /* Check for dnotify support */
17 #if defined(DN_MULTISHOT) && defined(SIGRTMIN)
19 extern gboolean dnotify_wakeup_flag
;
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 */
32 typedef struct _DirUser DirUser
;
33 typedef void (*DirCallback
)(Directory
*dir
,
38 extern GFSCache
*dir_cache
;
46 typedef struct _DirectoryClass DirectoryClass
;
48 struct _DirectoryClass
{
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
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() */
88 int dnotify_fd
; /* -1 if not watching */
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
);