r201: Allowed dragging to a subdirectory to save into it.
[rox-filer.git] / ROX-Filer / src / dir.h
blob8357816e28f518169375e7d8cf0648af85f620f0
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 time_t mtime;
56 MaskedPixmap *image;
57 MIME_type *mime_type;
58 int name_width;
59 int details_width;
60 uid_t uid;
61 gid_t gid;
64 struct _DirUser
66 DirCallback callback;
67 gpointer data;
70 struct _Directory
72 char *pathname; /* Internal use only */
73 int ref;
74 GList *users; /* Functions to call on update */
75 char *error; /* NULL => no error */
77 gboolean needs_update; /* When scan is finished, rescan */
78 gboolean notify_active; /* Notify timeout is running */
79 gboolean done_some_scanning; /* Read any items this scan? */
80 gint idle; /* Idle callback ID */
81 DIR *dir_handle; /* NULL => not scanning */
83 GPtrArray *items; /* What our users know about */
84 GPtrArray *new_items; /* New items to add in */
85 GPtrArray *up_items; /* Items to redraw */
88 void dir_init(void);
89 void dir_attach(Directory *dir, DirCallback callback, gpointer data);
90 void dir_detach(Directory *dir, DirCallback callback, gpointer data);
91 void dir_update(Directory *dir, gchar *pathname);
92 int dir_item_cmp(const void *a, const void *b);
93 void refresh_dirs(char *path);
95 #endif /* _DIR_H */