Get times from GIO correctly
[rox-filer.git] / ROX-Filer / src / diritem.h
blob224860175cbf4a717fa692bee57d4bee5602e756
1 /*
2 * ROX-Filer, filer for the ROX desktop project
3 * Thomas Leonard, <tal197@users.sourceforge.net>
4 */
7 #ifndef _DIRITEM_H
8 #define _DIRITEM_H
10 #include <gio/gio.h>
11 #include <sys/types.h>
13 #define USEFUL_GIO_ATTRS "standard::*,unix::*,time::*,thumbnail::path"
15 extern time_t diritem_recent_time;
17 typedef enum
19 ITEM_FLAG_SYMLINK = 0x01, /* Is a symlink */
20 ITEM_FLAG_APPDIR = 0x02, /* Contains an AppRun */
21 ITEM_FLAG_MOUNT_POINT = 0x04, /* Is mounted or in fstab */
22 ITEM_FLAG_MOUNTED = 0x08, /* Is mounted */
23 ITEM_FLAG_EXEC_FILE = 0x20, /* File, and has an X bit set (or is a .desktop)*/
24 ITEM_FLAG_MAY_DELETE = 0x40, /* Delete on finishing scan */
25 ITEM_FLAG_RECENT = 0x80, /* [MC]-time is around now */
27 /* DirItems are created with this flag set. Restatting or queuing an
28 * item in this state clears the flag. This is to prevent an item
29 * being added to the queue more than once at a time.
31 ITEM_FLAG_NEED_RESCAN_QUEUE = 0x100,
33 ITEM_FLAG_HAS_XATTR = 0x200, /* Has extended attributes set */
34 } ItemFlags;
36 struct _DirItem
38 char *leafname;
39 CollateKey *leafname_collate; /* Preprocessed for sorting */
40 gboolean may_delete; /* Not yet found, this scan */
41 int base_type;
42 int flags;
43 mode_t mode;
44 off_t size;
45 time_t atime, ctime, mtime;
46 MaskedPixmap *_image; /* NULL => leafname only so far */
47 MIME_type *mime_type;
48 uid_t uid;
49 gid_t gid;
50 int lstat_errno; /* 0 if details are valid */
53 void diritem_init(void);
54 DirItem *diritem_new(const guchar *leafname);
55 void diritem_restat(const guchar *path, DirItem *item, struct stat *parent);
56 void diritem_restat_gfile(GFile *path, DirItem *item);
57 void _diritem_get_image(DirItem *item);
58 void diritem_free(DirItem *item);
60 static inline MaskedPixmap *di_image(DirItem *item)
62 if (!item->_image && item->base_type != TYPE_UNKNOWN)
63 _diritem_get_image(item);
64 return item->_image;
67 #endif /* _DIRITEM_H */