2 * ROX-Filer, filer for the ROX desktop project
3 * Thomas Leonard, <tal197@users.sourceforge.net>
10 #include <sys/types.h>
16 /* Check for [id]notify support */
17 #if defined(HAVE_SYS_INOTIFY_H)
19 #elif defined(DN_MULTISHOT) && defined(SIGRTMIN)
22 #if defined(USE_INOTIFY) || defined(USE_DNOTIFY)
24 extern gboolean dnotify_wakeup_flag
;
28 DIR_START_SCAN
, /* Set 'scanning' indicator */
29 DIR_END_SCAN
, /* Clear 'scanning' indicator */
30 DIR_ADD
, /* Add the listed items to the display */
31 DIR_REMOVE
, /* Remove listed items from display */
32 DIR_UPDATE
, /* Redraw these items */
33 DIR_ERROR_CHANGED
, /* Check dir->error */
34 DIR_QUEUE_INTERESTING
, /* Call dir_queue_recheck */
37 typedef struct _DirUser DirUser
;
38 typedef void (*DirCallback
)(Directory
*dir
,
43 extern GFSCache
*dir_cache
;
51 typedef struct _DirectoryClass DirectoryClass
;
53 struct _DirectoryClass
{
61 char *pathname
; /* Internal use only */
62 GList
*users
; /* Functions to call on update */
63 char *error
; /* NULL => no error */
65 struct stat stat_info
; /* Internal use */
67 gboolean notify_active
; /* Notify timeout is running */
68 gint idle_callback
; /* Idle callback ID */
70 GHashTable
*known_items
; /* What our users know about */
71 GPtrArray
*new_items
; /* New items to add in */
72 GPtrArray
*up_items
; /* Items to redraw */
73 GPtrArray
*gone_items
; /* Items removed */
75 GList
*recheck_list
; /* Items to check on callback */
77 gboolean have_scanned
; /* TRUE after first complete scan */
78 gboolean scanning
; /* TRUE if we sent DIR_START_SCAN */
80 /* Indicates that the directory needs to be rescanned.
81 * This is cleared when scanning starts, and set when the fscache
82 * detects that the directory needs to be rescanned and is already
85 * If scanning finishes when this is set, or if someone attaches
86 * and scanning is not in progress, a rescan is triggered.
88 gboolean needs_update
;
90 gint rescan_timeout
; /* See dir_rescan_soon() */
93 int notify_fd
; /* -1 if not watching */
101 void dir_attach(Directory
*dir
, DirCallback callback
, gpointer data
);
102 void dir_detach(Directory
*dir
, DirCallback callback
, gpointer data
);
103 void dir_update(Directory
*dir
, gchar
*pathname
);
104 void refresh_dirs(const char *path
);
105 void dir_check_this(const guchar
*path
);
106 DirItem
*dir_update_item(Directory
*dir
, const gchar
*leafname
);
107 void dir_merge_new(Directory
*dir
);
108 void dir_force_update_path(const gchar
*path
);
109 #if defined(USE_DNOTIFY)
110 void dnotify_wakeup(void);
112 void dir_drop_all_notifies(void);
113 void dir_queue_recheck(Directory
*dir
, DirItem
*item
);