2012-03-04 15:56:54 +01:00
|
|
|
/* See LICENSE file for license and copyright information */
|
|
|
|
|
|
|
|
#include "database.h"
|
|
|
|
|
|
|
|
G_DEFINE_INTERFACE(ZathuraDatabase, zathura_database, G_TYPE_OBJECT)
|
|
|
|
|
|
|
|
static void
|
|
|
|
zathura_database_default_init(ZathuraDatabaseInterface* GIRARA_UNUSED(iface))
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-03-24 18:27:10 +01:00
|
|
|
void
|
|
|
|
zathura_db_free(zathura_database_t* db)
|
2012-03-04 15:56:54 +01:00
|
|
|
{
|
|
|
|
if (db == NULL) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_object_unref(db);
|
|
|
|
}
|
|
|
|
|
2012-03-24 18:27:10 +01:00
|
|
|
bool
|
|
|
|
zathura_db_add_bookmark(zathura_database_t* db, const char* file,
|
2012-03-04 15:56:54 +01:00
|
|
|
zathura_bookmark_t* bookmark)
|
|
|
|
{
|
2012-03-04 16:59:07 +01:00
|
|
|
g_return_val_if_fail(ZATHURA_IS_DATABASE(db) && file != NULL && bookmark != NULL, false);
|
2012-03-04 15:56:54 +01:00
|
|
|
|
|
|
|
return ZATHURA_DATABASE_GET_INTERFACE(db)->add_bookmark(db, file, bookmark);
|
|
|
|
}
|
|
|
|
|
2012-03-24 18:27:10 +01:00
|
|
|
bool
|
|
|
|
zathura_db_remove_bookmark(zathura_database_t* db, const char* file, const char*
|
|
|
|
id)
|
2012-03-04 15:56:54 +01:00
|
|
|
{
|
2012-03-04 16:59:07 +01:00
|
|
|
g_return_val_if_fail(ZATHURA_IS_DATABASE(db) && file != NULL && id != NULL, false);
|
2012-03-04 15:56:54 +01:00
|
|
|
|
|
|
|
return ZATHURA_DATABASE_GET_INTERFACE(db)->remove_bookmark(db, file, id);
|
|
|
|
}
|
|
|
|
|
2012-03-24 18:27:10 +01:00
|
|
|
girara_list_t*
|
|
|
|
zathura_db_load_bookmarks(zathura_database_t* db, const char* file)
|
2012-03-04 15:56:54 +01:00
|
|
|
{
|
2012-03-04 16:59:07 +01:00
|
|
|
g_return_val_if_fail(ZATHURA_IS_DATABASE(db) && file != NULL, NULL);
|
2012-03-04 15:56:54 +01:00
|
|
|
|
|
|
|
return ZATHURA_DATABASE_GET_INTERFACE(db)->load_bookmarks(db, file);
|
|
|
|
}
|
|
|
|
|
2012-03-24 18:27:10 +01:00
|
|
|
bool
|
|
|
|
zathura_db_set_fileinfo(zathura_database_t* db, const char* file, unsigned int
|
|
|
|
page, unsigned int offset, double scale, unsigned int rotation)
|
2012-03-04 15:56:54 +01:00
|
|
|
{
|
2012-03-04 16:59:07 +01:00
|
|
|
g_return_val_if_fail(ZATHURA_IS_DATABASE(db) && file != NULL, false);
|
2012-03-04 15:56:54 +01:00
|
|
|
|
2012-03-04 16:59:07 +01:00
|
|
|
return ZATHURA_DATABASE_GET_INTERFACE(db)->set_fileinfo(db, file, page, offset,
|
|
|
|
scale, rotation);
|
2012-03-04 15:56:54 +01:00
|
|
|
}
|
|
|
|
|
2012-03-24 18:27:10 +01:00
|
|
|
bool
|
|
|
|
zathura_db_get_fileinfo(zathura_database_t* db, const char* file, unsigned int*
|
|
|
|
page, unsigned int* offset, double* scale, unsigned int* rotation)
|
2012-03-04 15:56:54 +01:00
|
|
|
{
|
2012-03-04 16:59:07 +01:00
|
|
|
g_return_val_if_fail(ZATHURA_IS_DATABASE(db) && file != NULL && page != NULL &&
|
|
|
|
offset != NULL && scale != NULL && rotation != NULL, false);
|
2012-03-04 15:56:54 +01:00
|
|
|
|
2012-03-04 16:59:07 +01:00
|
|
|
return ZATHURA_DATABASE_GET_INTERFACE(db)->get_fileinfo(db, file, page, offset,
|
|
|
|
scale, rotation);
|
2012-03-04 15:56:54 +01:00
|
|
|
}
|