-
Notifications
You must be signed in to change notification settings - Fork 0
/
file_cabinet.h
46 lines (32 loc) · 1.56 KB
/
file_cabinet.h
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
#ifndef FILE_CABINET_H
#define FILE_CABINET_H
#include <glib.h>
#include "sql.h"
#include "file.h"
typedef struct FileCabinet FileCabinet;
FileCabinet *file_cabinet_new0 (sqlite3 *db, GHashTable *files);
FileCabinet *file_cabinet_new (sqlite3 *db);
FileCabinet *file_cabinet_init (FileCabinet *res);
void file_cabinet_destroy (FileCabinet *fc);
/* Removes a file from a single slot */
void file_cabinet_remove (FileCabinet *fc, file_id_t slot_id, File *f);
/* Removes from all of the slots. All of them */
void file_cabinet_remove_v (FileCabinet *fc, tagdb_key_t slot_ids, File *f);
/* Inserts a file into a single slot */
void file_cabinet_insert (FileCabinet *fc, file_id_t slot_id, File *f);
/* Inserts into all of the slots. All of them */
void file_cabinet_insert_v (FileCabinet *fc, tagdb_key_t slot_ids, File *f);
void file_cabinet_remove_all (FileCabinet *fc, File *f);
/* Actually delete the file */
void file_cabinet_delete_file(FileCabinet *fc, File *f);
/* Returns the keyed file slot as a GList */
GList *file_cabinet_get_drawer_l (FileCabinet *fc, file_id_t slot_id);
GList *file_cabinet_get_drawer_tags (FileCabinet *fc, file_id_t slot_id);
/* Returns files without any tags */
GList *file_cabinet_get_untagged_files (FileCabinet *fc);
int file_cabinet_drawer_size (FileCabinet *fc, file_id_t key);
void file_cabinet_remove_drawer (FileCabinet *fc, file_id_t slot_id);
/* returns the number of drawers */
gulong file_cabinet_size (FileCabinet *fc);
File *file_cabinet_lookup_file (FileCabinet *fc, tagdb_key_t tag_id, const char *name);
#endif /* FILE_CABINET_H */