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 */
31 typedef struct _DirUser DirUser
;
32 typedef void (*DirCallback
)(Directory
*dir
,
37 extern GFSCache
*dir_cache
;
45 typedef struct _DirectoryClass DirectoryClass
;
47 struct _DirectoryClass
{
55 char *pathname
; /* Internal use only */
56 GList
*users
; /* Functions to call on update */
57 char *error
; /* NULL => no error */
59 struct stat stat_info
; /* Internal use */
61 gboolean notify_active
; /* Notify timeout is running */
62 gint idle_callback
; /* Idle callback ID */
64 GHashTable
*known_items
; /* What our users know about */
65 GPtrArray
*new_items
; /* New items to add in */
66 GPtrArray
*up_items
; /* Items to redraw */
67 GPtrArray
*gone_items
; /* Items removed */
69 GList
*recheck_list
; /* Items to check on callback */
71 gboolean have_scanned
; /* TRUE after first complete scan */
72 gboolean scanning
; /* TRUE if we sent DIR_START_SCAN */
74 /* Indicates that the directory needs to be rescanned.
75 * This is cleared when scanning starts, and set when the fscache
76 * detects that the directory needs to be rescanned and is already
79 * If scanning finishes when this is set, or if someone attaches
80 * and scanning is not in progress, a rescan is triggered.
82 gboolean needs_update
;
84 gint rescan_timeout
; /* See dir_rescan_soon() */
87 int dnotify_fd
; /* -1 if not watching */
92 void dir_attach(Directory
*dir
, DirCallback callback
, gpointer data
);
93 void dir_detach(Directory
*dir
, DirCallback callback
, gpointer data
);
94 void dir_update(Directory
*dir
, gchar
*pathname
);
95 void refresh_dirs(const char *path
);
96 void dir_check_this(const guchar
*path
);
97 DirItem
*dir_update_item(Directory
*dir
, const gchar
*leafname
);
98 void dir_merge_new(Directory
*dir
);
99 void dir_force_update_path(const gchar
*path
);
100 void dnotify_wakeup(void);
101 void dir_drop_all_dnotifies(void);