Here is the data representation of a catalog when loaded. ========================================================= CONFIG *my_config contains the configuration parameters, and one or two variables that should not remain there (for example: my_config->racine). my_config->racine (FOLDER *) contains the files and the tree structure. racine->descriptions (GPtrArray of GString) contains the descriptions. racine->categories (GPtrArray of GString) contains the categories. racine->datas (GPtrArray of FILE_DATA) contains everything about the files racine->tree (GTree) is the file tree. The data field of each node is the index of the file (except the root node). Notice that a FILE_DATA structure contains a field that points to the concerned GNode. And another that points to the GtkCTreeNode displayed. To search an information about a file, all the FILE_DATA can be scanned. ======================================================================== One way is a loop on the GPtrArray my_config->racine->data. Another way is a traverse_function called with g_node_traverse. It depends on if all the files have to be scanned, or if only some files have to be, depending on their location into the tree. Note about racine->descriptions & racine->categories. ===================================================== - Prefer get_description() and get_categories() to accessing the data directly. - racine->descriptions->len is the number of descriptions - racine->descriptions[0] is the first description - WARNING : d = ((FILEDATA*)fd)->description to get the description, read my_config->description[d-1] because if d == 0, there is no description if d == 1, the description is the first one: description[0], not description[1]. - This is exactly the same with categories. Note about the GNode tree racine->tree. ======================================= racine->tree is a simple GNode tree, where the data field is a pointer to the corresponding data in the array racine->datas. THIS IS NOT TRUE FOR THE ROOT NODE. The root node is a pointer to the variable racine. In other words (racine->tree->data == racine) is always true. (This is new since 0.3.2) Note about links ================ A link is like a directory, but its type is IS_LINK. Like a directory, it can contain files. In fact, it ALWAYS contains ONE file. The FILE_DATA of a link is the same as the file it contains, except for the name. The link has this name: ("%s -> %s", link_name, destination). The file it contains just has destname as its name. Note about folder.c =================== folder.c contains many functions to access the data in the tree. Use them as much as possible. If the structure was changed (moved to a database), there would only be this file to change in the best world. Note about VFS ============== Vfs are stored just like other files and directories. The only difference is the type of the data. Yves 20001121