summaryrefslogtreecommitdiff
path: root/db.h
blob: 969bacef4b997d50e0b7aa3531e758f02075bee4 (plain)
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
#ifndef _DB_H_
#define _DB_H_

#include <glib.h>
#include <sqlite3.h>
#include <time.h>

struct directory_t {
	gchar *name;
	sqlite_uint64 dirid;
};

struct wallpaper_t {
	gchar *filepath;
	sqlite_uint64 id;
	time_t date;
	int size;
	int width;
	int height;
};

struct tag_t {
	gchar *name;
	sqlite_uint64 id;
	sqlite_uint64 parent;
};

int db_open();
void db_close();
sqlite_uint64 db_add_directory(const char*, sqlite_uint64);
sqlite_uint64 db_get_directory(const char*);
int db_get_top_level_directories(GArray**);
int db_get_directories(sqlite_uint64, GArray**);
sqlite_uint64 db_add_wallpaper(const char*, sqlite_uint64, int, int, int);
sqlite_uint64 db_get_wallpaper(const char*);
int db_remove_wallpaper(sqlite_uint64);
int db_get_wallpaper_data(sqlite_uint64, struct wallpaper_t*);
int db_get_wall_tags(sqlite_uint64, GArray**);
int db_get_wallpapers(sqlite_uint64, GArray**);
int db_get_walls_by_tags(GArray*, GArray**);
sqlite_uint64 db_add_tag(const char*, sqlite_uint64);
int db_get_tags_all(GArray**);
int db_get_top_level_tags(GArray**);
int db_get_tags(GArray**, sqlite_uint64);
int db_add_wall_tag(sqlite_uint64, sqlite_uint64);
void db_remove_tag(sqlite_uint64);
int db_remove_wall_tag(sqlite_uint64, sqlite_uint64);

#endif