Commit 3fca3d59 authored by Moritz Lipp's avatar Moritz Lipp
Browse files

Update functions to match latest libzathura API

parent cf0f7f0a
......@@ -31,7 +31,7 @@ pdf_page_get_annotations(zathura_page_t* page, zathura_list_t** annotations)
}
pdf_page_t* pdf_page;
if ((error = zathura_page_get_data(page, (void**) &pdf_page)) != ZATHURA_ERROR_OK) {
if ((error = zathura_page_get_user_data(page, (void**) &pdf_page)) != ZATHURA_ERROR_OK) {
goto error_out;
}
......@@ -43,7 +43,7 @@ pdf_page_get_annotations(zathura_page_t* page, zathura_list_t** annotations)
}
PopplerDocument* poppler_document;
if ((error = zathura_document_get_data(document, (void**) &poppler_document)) != ZATHURA_ERROR_OK
if ((error = zathura_document_get_user_data(document, (void**) &poppler_document)) != ZATHURA_ERROR_OK
|| poppler_document == NULL) {
goto error_out;
}
......@@ -490,7 +490,7 @@ poppler_annotation_to_zathura_annotation(PopplerAnnot* poppler_annotation,
goto error_free;
}
if (zathura_attachment_set_user_data(attachment, poppler_attachment)
if (zathura_attachment_set_user_data(attachment, poppler_attachment, g_object_unref)
!= ZATHURA_ERROR_OK) {
zathura_attachment_free(attachment);
goto error_free;
......
......@@ -19,7 +19,7 @@ static void add_attachment(PopplerAttachment* poppler_attachment, zathura_list_t
goto error_free;
}
if (zathura_attachment_set_user_data(attachment, poppler_attachment)
if (zathura_attachment_set_user_data(attachment, poppler_attachment, NULL)
!= ZATHURA_ERROR_OK) {
goto error_free;
}
......@@ -52,7 +52,7 @@ pdf_document_get_attachments(zathura_document_t* document, zathura_list_t** atta
zathura_error_t error = ZATHURA_ERROR_OK;
PopplerDocument* poppler_document;
if ((error = zathura_document_get_data(document, (void**) &poppler_document)) != ZATHURA_ERROR_OK
if ((error = zathura_document_get_user_data(document, (void**) &poppler_document)) != ZATHURA_ERROR_OK
|| poppler_document == NULL) {
return ZATHURA_ERROR_UNKNOWN;
}
......
......@@ -46,7 +46,7 @@ pdf_document_open(zathura_document_t* document)
goto error_free;
}
zathura_document_set_data(document, poppler_document);
zathura_document_set_user_data(document, poppler_document);
zathura_document_set_number_of_pages(document,
poppler_document_get_n_pages(poppler_document));
......@@ -76,10 +76,10 @@ pdf_document_free(zathura_document_t* document)
}
PopplerDocument* poppler_document;
if (zathura_document_get_data(document, (void**) &poppler_document) == ZATHURA_ERROR_OK) {
if (zathura_document_get_user_data(document, (void**) &poppler_document) == ZATHURA_ERROR_OK) {
if (poppler_document != NULL) {
g_object_unref(poppler_document);
zathura_document_set_data(document, NULL);
zathura_document_set_user_data(document, NULL);
}
}
......@@ -96,7 +96,7 @@ pdf_document_save_as(zathura_document_t* document, const char* path)
zathura_error_t error = ZATHURA_ERROR_OK;
PopplerDocument* poppler_document;
if ((error = zathura_document_get_data(document, (void**) &poppler_document)) != ZATHURA_ERROR_OK) {
if ((error = zathura_document_get_user_data(document, (void**) &poppler_document)) != ZATHURA_ERROR_OK) {
return error;
}
......
......@@ -26,7 +26,7 @@ pdf_page_get_form_fields(zathura_page_t* page, zathura_list_t** form_fields)
}
pdf_page_t* pdf_page;
if ((error = zathura_page_get_data(page, (void**) &pdf_page)) != ZATHURA_ERROR_OK) {
if ((error = zathura_page_get_user_data(page, (void**) &pdf_page)) != ZATHURA_ERROR_OK) {
goto error_out;
}
......@@ -38,7 +38,7 @@ pdf_page_get_form_fields(zathura_page_t* page, zathura_list_t** form_fields)
}
PopplerDocument* poppler_document;
if ((error = zathura_document_get_data(document, (void**) &poppler_document)) != ZATHURA_ERROR_OK
if ((error = zathura_document_get_user_data(document, (void**) &poppler_document)) != ZATHURA_ERROR_OK
|| poppler_document == NULL) {
goto error_out;
}
......@@ -204,7 +204,7 @@ poppler_form_field_to_zathura_form_field(zathura_page_t* page, PopplerFormField*
}
/* set user data */
if ((error = zathura_form_field_set_user_data(*form_field, poppler_form_field)) != ZATHURA_ERROR_OK) {
if ((error = zathura_form_field_set_user_data(*form_field, poppler_form_field, NULL)) != ZATHURA_ERROR_OK) {
goto error_out;
}
......
......@@ -41,7 +41,7 @@ pdf_page_get_images(zathura_page_t* page, zathura_list_t** images)
*images = NULL;
pdf_page_t* pdf_page;
if ((error = zathura_page_get_data(page, (void**) &pdf_page)) != ZATHURA_ERROR_OK) {
if ((error = zathura_page_get_user_data(page, (void**) &pdf_page)) != ZATHURA_ERROR_OK) {
goto error_out;
}
......@@ -84,7 +84,7 @@ pdf_page_get_images(zathura_page_t* page, zathura_list_t** images)
pdf_image->poppler_page = poppler_page;
pdf_image->image_id = poppler_image->image_id;
if (zathura_image_set_user_data(zathura_image, pdf_image) != ZATHURA_ERROR_OK) {
if (zathura_image_set_user_data(zathura_image, pdf_image, free) != ZATHURA_ERROR_OK) {
free(pdf_image);
zathura_image_free(zathura_image);
error = ZATHURA_ERROR_UNKNOWN;
......
......@@ -22,14 +22,14 @@ pdf_page_get_links(zathura_page_t* page, zathura_list_t** links)
}
pdf_page_t* pdf_page;
if ((error = zathura_page_get_data(page, (void**) &pdf_page)) != ZATHURA_ERROR_OK) {
if ((error = zathura_page_get_user_data(page, (void**) &pdf_page)) != ZATHURA_ERROR_OK) {
goto error_out;
}
PopplerPage* poppler_page = pdf_page->poppler_page;
PopplerDocument* poppler_document;
if ((error = zathura_document_get_data(document, (void**) &poppler_document)) != ZATHURA_ERROR_OK
if ((error = zathura_document_get_user_data(document, (void**) &poppler_document)) != ZATHURA_ERROR_OK
|| poppler_document == NULL) {
goto error_out;
}
......
......@@ -17,7 +17,7 @@ pdf_document_get_metadata(zathura_document_t* document,
zathura_error_t error = ZATHURA_ERROR_OK;
PopplerDocument* poppler_document;
if ((error = zathura_document_get_data(document, (void**) &poppler_document)) != ZATHURA_ERROR_OK
if ((error = zathura_document_get_user_data(document, (void**) &poppler_document)) != ZATHURA_ERROR_OK
|| poppler_document == NULL) {
return ZATHURA_ERROR_UNKNOWN;
}
......
......@@ -18,7 +18,7 @@ pdf_document_get_outline(zathura_document_t* document, zathura_node_t** outline)
zathura_error_t error = ZATHURA_ERROR_OK;
PopplerDocument* poppler_document;
if ((error = zathura_document_get_data(document, (void**) &poppler_document)) != ZATHURA_ERROR_OK
if ((error = zathura_document_get_user_data(document, (void**) &poppler_document)) != ZATHURA_ERROR_OK
|| poppler_document == NULL) {
return ZATHURA_ERROR_UNKNOWN;
}
......
......@@ -20,7 +20,7 @@ pdf_page_init(zathura_page_t* page)
}
PopplerDocument* poppler_document;
if ((error = zathura_document_get_data(document, (void**) &poppler_document)) != ZATHURA_ERROR_OK
if ((error = zathura_document_get_user_data(document, (void**) &poppler_document)) != ZATHURA_ERROR_OK
|| poppler_document == NULL) {
return ZATHURA_ERROR_UNKNOWN;
}
......@@ -41,7 +41,7 @@ pdf_page_init(zathura_page_t* page)
return ZATHURA_ERROR_UNKNOWN;
}
if ((error = zathura_page_set_data(page, pdf_page)) != ZATHURA_ERROR_OK) {
if ((error = zathura_page_set_user_data(page, pdf_page)) != ZATHURA_ERROR_OK) {
g_object_unref(pdf_page->poppler_page);
free(pdf_page);
return error;
......@@ -77,7 +77,7 @@ pdf_page_clear(zathura_page_t* page)
zathura_error_t error = ZATHURA_ERROR_OK;
pdf_page_t* pdf_page;
if ((error = zathura_page_get_data(page, (void**) &pdf_page)) != ZATHURA_ERROR_OK) {
if ((error = zathura_page_get_user_data(page, (void**) &pdf_page)) != ZATHURA_ERROR_OK) {
return error;
}
......
......@@ -19,7 +19,7 @@ zathura_error_t pdf_page_render_cairo(zathura_page_t* page, cairo_t* cairo,
zathura_error_t error = ZATHURA_ERROR_OK;
pdf_page_t* pdf_page;
if ((error = zathura_page_get_data(page, (void**) &pdf_page)) != ZATHURA_ERROR_OK) {
if ((error = zathura_page_get_user_data(page, (void**) &pdf_page)) != ZATHURA_ERROR_OK) {
goto error_out;
}
......
......@@ -18,7 +18,7 @@ zathura_error_t pdf_page_search_text(zathura_page_t* page, const char* text,
*results = NULL;
pdf_page_t* pdf_page;
if ((error = zathura_page_get_data(page, (void**) &pdf_page)) != ZATHURA_ERROR_OK) {
if ((error = zathura_page_get_user_data(page, (void**) &pdf_page)) != ZATHURA_ERROR_OK) {
goto error_out;
}
......
......@@ -19,7 +19,7 @@ pdf_page_get_text(zathura_page_t* page, char** text)
zathura_error_t error = ZATHURA_ERROR_OK;
pdf_page_t* pdf_page;
if ((error = zathura_page_get_data(page, (void**) &pdf_page)) != ZATHURA_ERROR_OK) {
if ((error = zathura_page_get_user_data(page, (void**) &pdf_page)) != ZATHURA_ERROR_OK) {
goto error_out;
}
......@@ -42,7 +42,7 @@ pdf_page_get_selected_text(zathura_page_t* page, char** text, zathura_rectangle_
zathura_error_t error = ZATHURA_ERROR_OK;
pdf_page_t* pdf_page;
if ((error = zathura_page_get_data(page, (void**) &pdf_page)) != ZATHURA_ERROR_OK) {
if ((error = zathura_page_get_user_data(page, (void**) &pdf_page)) != ZATHURA_ERROR_OK) {
goto error_out;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment