r139: Fixed a test_point() bug for small icons.
[rox-filer/ma.git] / ROX-Filer / src / dir.h
blobc33d3023e5db4a12cfd890dc317b190215cc1479
1 /*
2 * $Id$
4 * Thomas Leonard, <tal197@ecs.soton.ac.uk>
5 */
8 #ifndef _DIR_H
9 #define _DIR_H
11 #include <glib.h>
12 #include <sys/types.h>
13 #include <dirent.h>
15 typedef enum {
16 DIR_END_SCAN, /* Remove busy cursor */
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 _Directory Directory;
23 typedef struct _DirItem DirItem;
24 typedef struct _DirUser DirUser;
25 typedef void (*DirCallback)(Directory *dir,
26 DirAction action,
27 GPtrArray *items,
28 gpointer data);
30 typedef enum
32 ITEM_FLAG_SYMLINK = 0x01, /* Is a symlink */
33 ITEM_FLAG_APPDIR = 0x02, /* Contains /AppInfo */
34 ITEM_FLAG_MOUNT_POINT = 0x04, /* Is in mtab or fstab */
35 ITEM_FLAG_MOUNTED = 0x08, /* Is in /etc/mtab */
36 ITEM_FLAG_TEMP_ICON = 0x10, /* Free icon after use */
37 ITEM_FLAG_EXEC_FILE = 0x20, /* File, and has an X bit set */
38 ITEM_FLAG_MAY_DELETE = 0x40, /* Delete on finishing scan */
39 } ItemFlags;
41 #include "fscache.h"
42 #include "pixmaps.h"
43 #include "type.h"
45 extern GFSCache *dir_cache;
47 struct _DirItem
49 char *leafname;
50 gboolean may_delete; /* Not yet found, this scan */
51 int base_type;
52 int flags;
53 mode_t mode;
54 off_t size;
55 MaskedPixmap *image;
56 MIME_type *mime_type;
57 int name_width;
58 int details_width;
61 struct _DirUser
63 DirCallback callback;
64 gpointer data;
67 struct _Directory
69 char *pathname; /* Internal use only */
70 int ref;
71 GList *users; /* Functions to call on update */
72 char *error; /* NULL => no error */
74 gboolean needs_update; /* When scan is finished, rescan */
75 gboolean notify_active; /* Notify timeout is running */
76 gint idle; /* Idle callback ID */
77 DIR *dir_handle; /* NULL => not scanning */
79 GPtrArray *items; /* What our users know about */
80 GPtrArray *new_items; /* New items to add in */
81 GPtrArray *up_items; /* Items to redraw */
84 void dir_init(void);
85 void dir_attach(Directory *dir, DirCallback callback, gpointer data);
86 void dir_detach(Directory *dir, DirCallback callback, gpointer data);
87 void dir_update(Directory *dir, gchar *pathname);
88 int dir_item_cmp(const void *a, const void *b);
89 void refresh_dirs(char *path);
91 #endif /* _DIR_H */