From 9d9915e8dd24056fe090cb2f3aec73d8fa554591 Mon Sep 17 00:00:00 2001 From: Moritz Lipp Date: Wed, 2 May 2012 01:34:38 +0200 Subject: [PATCH] Save page object instead of index in annotation --- annotations.c | 12 ++++++------ annotations.h | 14 ++++++++------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/annotations.c b/annotations.c index 7ac3c2b..1ea79b6 100644 --- a/annotations.c +++ b/annotations.c @@ -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* diff --git a/annotations.h b/annotations.h index 2b80a7f..582d55a 100644 --- a/annotations.h +++ b/annotations.h @@ -5,6 +5,8 @@ #include +#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