mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-02-27 15:04:43 +01:00
Update some return values
This commit is contained in:
parent
0049b6fa4b
commit
ee760f2098
1 changed files with 21 additions and 5 deletions
22
document.c
22
document.c
|
@ -366,7 +366,7 @@ zathura_plugin_error_t
|
||||||
zathura_document_free(zathura_document_t* document)
|
zathura_document_free(zathura_document_t* document)
|
||||||
{
|
{
|
||||||
if (document == NULL || document->zathura == NULL || document->zathura->ui.session == NULL) {
|
if (document == NULL || document->zathura == NULL || document->zathura->ui.session == NULL) {
|
||||||
return false;
|
return ZATHURA_PLUGIN_ERROR_INVALID_ARGUMENTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* free pages */
|
/* free pages */
|
||||||
|
@ -378,10 +378,11 @@ zathura_document_free(zathura_document_t* document)
|
||||||
free(document->pages);
|
free(document->pages);
|
||||||
|
|
||||||
/* free document */
|
/* free document */
|
||||||
bool r = true;
|
zathura_plugin_error_t error = ZATHURA_PLUGIN_ERROR_OK;
|
||||||
if (document->functions.document_free == NULL) {
|
if (document->functions.document_free == NULL) {
|
||||||
girara_notify(document->zathura->ui.session, GIRARA_WARNING, _("%s not implemented"), __FUNCTION__);
|
girara_notify(document->zathura->ui.session, GIRARA_WARNING, _("%s not implemented"), __FUNCTION__);
|
||||||
girara_error("%s not implemented", __FUNCTION__);
|
girara_error("%s not implemented", __FUNCTION__);
|
||||||
|
error = ZATHURA_PLUGIN_ERROR_NOT_IMPLEMENTED;
|
||||||
} else {
|
} else {
|
||||||
r = document->functions.document_free(document);
|
r = document->functions.document_free(document);
|
||||||
}
|
}
|
||||||
|
@ -415,12 +416,18 @@ girara_tree_node_t*
|
||||||
zathura_document_index_generate(zathura_document_t* document, zathura_plugin_error_t* error)
|
zathura_document_index_generate(zathura_document_t* document, zathura_plugin_error_t* error)
|
||||||
{
|
{
|
||||||
if (document == NULL || document->zathura == NULL || document->zathura->ui.session == NULL) {
|
if (document == NULL || document->zathura == NULL || document->zathura->ui.session == NULL) {
|
||||||
|
if (error != NULL) {
|
||||||
|
*error = ZATHURA_PLUGIN_ERROR_INVALID_ARGUMENTS;
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (document->functions.document_index_generate == NULL) {
|
if (document->functions.document_index_generate == NULL) {
|
||||||
girara_notify(document->zathura->ui.session, GIRARA_WARNING, _("%s not implemented"), __FUNCTION__);
|
girara_notify(document->zathura->ui.session, GIRARA_WARNING, _("%s not implemented"), __FUNCTION__);
|
||||||
girara_error("%s not implemented", __FUNCTION__);
|
girara_error("%s not implemented", __FUNCTION__);
|
||||||
|
if (error != NULL) {
|
||||||
|
*error = ZATHURA_PLUGIN_ERROR_NOT_IMPLEMENTED;
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -431,12 +438,18 @@ girara_list_t*
|
||||||
zathura_document_attachments_get(zathura_document_t* document, zathura_plugin_error_t* error)
|
zathura_document_attachments_get(zathura_document_t* document, zathura_plugin_error_t* error)
|
||||||
{
|
{
|
||||||
if (document == NULL || document->zathura == NULL || document->zathura->ui.session == NULL) {
|
if (document == NULL || document->zathura == NULL || document->zathura->ui.session == NULL) {
|
||||||
|
if (error != NULL) {
|
||||||
|
*error = ZATHURA_PLUGIN_ERROR_INVALID_ARGUMENTS;
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (document->functions.document_attachments_get == NULL) {
|
if (document->functions.document_attachments_get == NULL) {
|
||||||
girara_notify(document->zathura->ui.session, GIRARA_WARNING, _("%s not implemented"), __FUNCTION__);
|
girara_notify(document->zathura->ui.session, GIRARA_WARNING, _("%s not implemented"), __FUNCTION__);
|
||||||
girara_error("%s not implemented", __FUNCTION__);
|
girara_error("%s not implemented", __FUNCTION__);
|
||||||
|
if (error != NULL) {
|
||||||
|
*error = ZATHURA_PLUGIN_ERROR_NOT_IMPLEMENTED;
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -507,7 +520,10 @@ zathura_page_get(zathura_document_t* document, unsigned int page_id, zathura_plu
|
||||||
page->visible = false;
|
page->visible = false;
|
||||||
page->drawing_area = zathura_page_widget_new(page);
|
page->drawing_area = zathura_page_widget_new(page);
|
||||||
if (page->drawing_area == NULL) {
|
if (page->drawing_area == NULL) {
|
||||||
girara_error("couldn't create page widget");
|
if (error != NULL) {
|
||||||
|
*error = ZATHURA_PLUGIN_ERROR_UNKNOWN;
|
||||||
|
}
|
||||||
|
girara_error("Couldn't create page widget");
|
||||||
zathura_page_free(page);
|
zathura_page_free(page);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue