1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
/* Virtualdir is a collection of routines managing virtual directory entries.
* It is used to display the contents of the last session in gnometoaster. */
#ifndef VIRTUALDIR_H
#define VIRTUALDIR_H
#include <gtk/gtk.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
/* type returned by virtualdir_open() */
#define virtualdir_VDIR GList*
/* this is a compound directory/direntry structure */
typedef struct
{
char name[255]; /* name of the directory */
unsigned long int filesize; /* file size,if ordinary file */
unsigned int mode; /* mode,includes IS_DIR flag */
GList *entries; /* a GList of virtualdir_dir,
* the entries of our directory.
* NULL if ordinary file */
} virtualdir_dir;
/* create a new dir */
virtualdir_dir *virtualdir_create(/* informations about the file/directory
* to be created */
char *name,
unsigned int mode,
unsigned long int filesize);
/* find entry with name in directory dir */
virtualdir_dir *virtualdir_findentry(virtualdir_dir *dir,
gchar *name);
/* find a subdirectory of dir root */
virtualdir_dir *virtualdir_finddir(virtualdir_dir *root,
gchar *path);
/* open a subdirectory of dir root for reading */
virtualdir_VDIR *virtualdir_open(virtualdir_dir *root,
gchar *path);
/* read a directory entry. this call's structur is similar to
* the readdir() libc function. it will return
* a pointer to the direntry struct or NULL if the end of the directory
* has been reached */
virtualdir_dir *virtualdir_read(virtualdir_VDIR *vdir);
/* close a VDIR opened by virtualdir_open */
void virtualdir_close(virtualdir_VDIR *vdir);
/* add a direntry structure to the virtual directory
* structure specified by root in subdir path,
* client should be created with virtualdir_create() */
void virtualdir_addentry(virtualdir_dir *root,
virtualdir_dir *client,
char *path);
/* delete the entire virtual directory structure */
void virtualdir_deletestructure(virtualdir_dir *root);
#endif // VIRTUALDIR_H
|