Implemented some zathura_document wrapper functions

This commit is contained in:
Moritz Lipp 2012-03-27 14:44:09 +02:00
parent 61d7a6a436
commit 647f26a77f
2 changed files with 147 additions and 0 deletions

View File

@ -235,6 +235,87 @@ zathura_document_free(zathura_document_t* document)
return error;
}
const char*
zathura_document_get_path(zathura_document_t* document)
{
if (document == NULL) {
return NULL;
}
return document->file_path;
}
const char*
zathura_document_get_password(zathura_document_t* document)
{
if (document == NULL) {
return NULL;
}
return document->password;
}
void*
zathura_document_get_data(zathura_document_t* document)
{
if (document == NULL) {
return NULL;
}
return document->data;
}
void
zathura_document_set_data(zathura_document_t* document, void* data)
{
if (document == NULL) {
return;
}
document->data = data;
}
unsigned int
zathura_document_get_number_of_pages(zathura_document_t* document)
{
if (document == NULL) {
return 0;
}
return document->number_of_pages;
}
void
zathura_document_set_number_of_pages(zathura_document_t* document, unsigned int number_of_pages)
{
if (document == NULL) {
return;
}
document->number_of_pages = number_of_pages;
}
unsigned int
zathura_document_get_current_page(zathura_document_t* document)
{
if (document == NULL) {
return 0;
}
return document->current_page_number;
}
void
zathura_document_set_current_page(zathura_document_t* document, unsigned int
current_page)
{
if (document == NULL) {
return;
}
document->current_page_number = current_page;
}
zathura_error_t
zathura_document_save_as(zathura_document_t* document, const char* path)
{

View File

@ -64,6 +64,22 @@ struct zathura_document_s
zathura_document_t* zathura_document_open(zathura_t* zathura, const char* path,
const char* password);
/**
* Returns the path of the document
*
* @param document The document
* @return The file path of the document
*/
const char* zathura_document_get_path(zathura_document_t* document);
/**
* Returns the password of the document
*
* @param document The document
* @return Returns the password of the document
*/
const char* zathura_document_get_password(zathura_document_t* document);
/**
* Free the document
*
@ -73,6 +89,56 @@ zathura_document_t* zathura_document_open(zathura_t* zathura, const char* path,
*/
zathura_error_t zathura_document_free(zathura_document_t* document);
/**
* Returns the private data of the document
*
* @param document The document
* @return The private data or NULL
*/
void* zathura_document_get_data(zathura_document_t* document);
/**
* Returns the number of pages
*
* @param document The document
* @return Number of pages
*/
unsigned int zathura_document_get_number_of_pages(zathura_document_t* document);
/**
* Sets the number of pages
*
* @param document The document
* @param number_of_pages Number of pages
*/
void zathura_document_set_number_of_pages(zathura_document_t* document, unsigned
int number_of_pages);
/**
* Returns the current page number
*
* @param document The document
* @return Current page
*/
unsigned int zathura_document_get_current_page(zathura_document_t* document);
/**
* Sets the number of pages
*
* @param document The document
* @param current_page The current page number
*/
void zathura_document_set_current_page(zathura_document_t* document, unsigned
int current_page);
/**
* Sets the private data of the document
*
* @param document The document
* @param data The new private data
*/
void zathura_document_set_data(zathura_document_t* document, void* data);
/**
* Save the document
*