zathura
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
database.h
Go to the documentation of this file.
1 /* See LICENSE file for license and copyright information */
2 
3 #ifndef DATABASE_H
4 #define DATABASE_H
5 
6 #include <stdbool.h>
7 #include <girara/types.h>
8 #include <glib-object.h>
9 
10 #include "bookmarks.h"
11 
12 typedef struct zathura_fileinfo_s {
13  unsigned int current_page;
14  unsigned int page_offset;
15  double scale;
16  unsigned int rotation;
17  unsigned int pages_per_row;
18  unsigned int first_page_column;
19  double position_x;
20  double position_y;
22 
23 #define ZATHURA_TYPE_DATABASE \
24  (zathura_database_get_type ())
25 #define ZATHURA_DATABASE(obj) \
26  (G_TYPE_CHECK_INSTANCE_CAST ((obj), ZATHURA_TYPE_DATABASE, ZathuraDatabase))
27 #define ZATHURA_IS_DATABASE(obj) \
28  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ZATHURA_TYPE_DATABASE))
29 #define ZATHURA_DATABASE_GET_INTERFACE(obj) \
30  (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ZATHURA_TYPE_DATABASE, ZathuraDatabaseInterface))
31 
32 typedef struct _ZathuraDatabase ZathuraDatabase;
33 typedef struct _ZathuraDatabaseInterface ZathuraDatabaseInterface;
34 
36 {
37  GTypeInterface parent_iface;
38 
39  /* interface methords */
40  bool (*add_bookmark)(ZathuraDatabase* db, const char* file, zathura_bookmark_t* bookmark);
41 
42  bool (*remove_bookmark)(ZathuraDatabase* db, const char* file, const char* id);
43 
44  girara_list_t* (*load_bookmarks)(ZathuraDatabase* db, const char* file);
45 
46  girara_list_t* (*load_jumplist)(ZathuraDatabase* db, const char* file);
47 
48  bool (*save_jumplist)(ZathuraDatabase* db, const char* file, girara_list_t* jumplist);
49 
50  bool (*set_fileinfo)(ZathuraDatabase* db, const char* file, zathura_fileinfo_t* file_info);
51 
52  bool (*get_fileinfo)(ZathuraDatabase* db, const char* file, zathura_fileinfo_t* file_info);
53 };
54 
55 GType zathura_database_get_type(void);
56 
65 bool zathura_db_add_bookmark(zathura_database_t* db, const char* file,
66  zathura_bookmark_t* bookmark);
67 
76 bool zathura_db_remove_bookmark(zathura_database_t* db, const char* file, const
77  char* id);
78 
86 girara_list_t* zathura_db_load_bookmarks(zathura_database_t* db, const char*
87  file);
88 
97 girara_list_t* zathura_db_load_jumplist(ZathuraDatabase* db, const char* file);
98 
108 bool zathura_db_save_jumplist(ZathuraDatabase* db, const char* file, girara_list_t* jumplist);
109 
118 bool zathura_db_set_fileinfo(zathura_database_t* db, const char* file,
119  zathura_fileinfo_t* file_info);
120 
121 /* Get file info (last site, ...) from the database.
122  *
123  * @param db The database instance
124  * @param file The file to which the file info belongs.
125  * @param file_info The file info
126  * @return true on success, false otherwise.
127  */
128 bool zathura_db_get_fileinfo(zathura_database_t* db, const char* file,
129  zathura_fileinfo_t* file_info);
130 
131 #endif // DATABASE_H