r1996: Cope slightly better with invalid filenames in various places (reported by
[rox-filer.git] / ROX-Filer / src / fscache.h
blobb6dbb9429c0f6ac7b3069c93d5f1f7ac2817e868
1 /*
2 * $Id$
4 * Thomas Leonard, <tal197@users.sourceforge.net>
5 */
8 #ifndef _FSCACHE_H
9 #define _FSCACHE_H
11 #include <sys/stat.h>
12 #include <unistd.h>
13 #include <stdlib.h>
14 #include <time.h>
15 #include <glib.h>
16 #include <glib-object.h>
18 typedef GObject *(*GFSLoadFunc)(const char *pathname, gpointer user_data);
19 typedef void (*GFSUpdateFunc)(gpointer object,
20 const char *pathname,
21 gpointer user_data);
22 typedef enum {
23 FSCACHE_LOOKUP_CREATE, /* Load if missing. Update as needed. */
24 FSCACHE_LOOKUP_ONLY_NEW,/* Return NULL if not present AND uptodate */
25 FSCACHE_LOOKUP_PEEK, /* Lookup; don't load or update */
26 FSCACHE_LOOKUP_INIT, /* Internal use */
27 FSCACHE_LOOKUP_INSERT, /* Internal use */
28 } FSCacheLookup;
30 GFSCache *g_fscache_new(GFSLoadFunc load,
31 GFSUpdateFunc update,
32 gpointer user_data);
33 void g_fscache_destroy(GFSCache *cache);
34 gpointer g_fscache_lookup(GFSCache *cache, const char *pathname);
35 gpointer g_fscache_lookup_full(GFSCache *cache, const char *pathname,
36 FSCacheLookup lookup_type,
37 gboolean *found);
38 void g_fscache_may_update(GFSCache *cache, const char *pathname);
39 void g_fscache_update(GFSCache *cache, const char *pathname);
40 void g_fscache_purge(GFSCache *cache, gint age);
42 void g_fscache_insert(GFSCache *cache, const char *pathname, gpointer obj,
43 gboolean update_details);
45 #endif /* _FSCACHE_H */