Save page object instead of index in annotation

This commit is contained in:
Moritz Lipp 2012-05-02 01:34:38 +02:00
parent e2c32a07fd
commit 9d9915e8dd
2 changed files with 14 additions and 12 deletions

View file

@ -11,7 +11,7 @@ struct zathura_annotation_s {
char* name; /**< Name of the annotation */
char* content; /**< Content of the annotation */
time_t modification_date; /**< Modification date */
unsigned int page_index; /**< Page index */
zathura_page_t* page; /**< Zathura page */
void* data; /**< Custom data */
};
@ -163,24 +163,24 @@ zathura_annotation_set_modified(zathura_annotation_t* annotation, time_t modific
annotation->modification_date = modification_date;
}
unsigned int
zathura_page_t*
zathura_annotation_get_page_index(zathura_annotation_t* annotation)
{
if (annotation == NULL) {
return 0;
return NULL;
}
return annotation->page_index;
return annotation->page;
}
void
zathura_annotation_set_page_index(zathura_annotation_t* annotation, unsigned int page_index)
zathura_annotation_set_page(zathura_annotation_t* annotation, zathura_page_t* page)
{
if (annotation == NULL) {
return;
}
annotation->page_index = page_index;
annotation->page = page;
}
static char*

View file

@ -5,6 +5,8 @@
#include <time.h>
#include "page.h"
typedef struct zathura_annotation_s zathura_annotation_t;
typedef enum zathura_annotation_type_s {
@ -154,19 +156,19 @@ time_t zathura_annotation_get_modified(zathura_annotation_t* annotation);
void zathura_annotation_set_modified(zathura_annotation_t* annotation, time_t modification_date);
/**
* Returns the page index of the annotation
* Returns the page of the annotation
*
* @param annotation The annotation
* @return The page index of the annotation
* @return The page of the annotation
*/
unsigned int zathura_annotation_get_page_index(zathura_annotation_t* annotation);
zathura_page_t* zathura_annotation_get_page(zathura_annotation_t* annotation);
/**
* Sets the page index of the annotation
* Sets the page of the annotation
*
* @param annotation The annotation
* @param page_index The page index of the annotation
* @param page The page of the annotation
*/
void zathura_annotation_set_page_index(zathura_annotation_t* annotation, unsigned int page_index);
void zathura_annotation_set_page_index(zathura_annotation_t* annotation, zathura_page_t* page);
#endif // ANNOTATION_H