mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-01-15 02:06:00 +01:00
Add new function to get signatures from pages
This commit is contained in:
parent
d9bdd00b53
commit
1ecd8d69c6
3 changed files with 58 additions and 1 deletions
|
@ -412,3 +412,41 @@ zathura_page_get_label(zathura_page_t* page, zathura_error_t* error)
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
sig_free(void* sig)
|
||||||
|
{
|
||||||
|
zathura_signature_info_free(sig);
|
||||||
|
}
|
||||||
|
|
||||||
|
girara_list_t*
|
||||||
|
zathura_page_get_signatures(zathura_page_t* page, zathura_error_t* error)
|
||||||
|
{
|
||||||
|
if (page == NULL || page->document == NULL) {
|
||||||
|
if (error) {
|
||||||
|
*error = ZATHURA_ERROR_INVALID_ARGUMENTS;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
zathura_plugin_t* plugin = zathura_document_get_plugin(page->document);
|
||||||
|
const zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
|
||||||
|
if (functions->page_get_signatures == NULL) {
|
||||||
|
if (error) {
|
||||||
|
*error = ZATHURA_ERROR_NOT_IMPLEMENTED;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
girara_list_t* ret = girara_list_new2(sig_free);
|
||||||
|
zathura_error_t e = functions->page_get_signatures(page, page->data, ret);
|
||||||
|
if (e != ZATHURA_ERROR_OK) {
|
||||||
|
if (error) {
|
||||||
|
*error = e;
|
||||||
|
}
|
||||||
|
girara_list_free(ret);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
|
@ -218,10 +218,20 @@ ZATHURA_PLUGIN_API zathura_error_t zathura_page_render(zathura_page_t* page, cai
|
||||||
* is returned.
|
* is returned.
|
||||||
*
|
*
|
||||||
* @param page Page
|
* @param page Page
|
||||||
* @param error Set to an error value (see \ref zathura_Error_t) if an error
|
* @param error Set to an error value (see \ref zathura_error_t) if an error
|
||||||
* occurred.
|
* occurred.
|
||||||
* @return Page label
|
* @return Page label
|
||||||
*/
|
*/
|
||||||
ZATHURA_PLUGIN_API char* zathura_page_get_label(zathura_page_t* page, zathura_error_t* error);
|
ZATHURA_PLUGIN_API char* zathura_page_get_label(zathura_page_t* page, zathura_error_t* error);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get signatures of a page
|
||||||
|
*
|
||||||
|
* @param page Page
|
||||||
|
* @param error Set to an error value (see \ref zathura_error_t) if an error
|
||||||
|
* occurred.
|
||||||
|
* @return List of signatures
|
||||||
|
*/
|
||||||
|
ZATHURA_PLUGIN_API girara_list_t* zathura_page_get_signatures(zathura_page_t* page, zathura_error_t* error);
|
||||||
|
|
||||||
#endif // PAGE_H
|
#endif // PAGE_H
|
||||||
|
|
|
@ -108,6 +108,10 @@ typedef zathura_error_t (*zathura_plugin_page_render_cairo_t)(zathura_page_t* pa
|
||||||
*/
|
*/
|
||||||
typedef zathura_error_t (*zathura_plugin_page_get_label_t)(zathura_page_t* page, void* data, char** label);
|
typedef zathura_error_t (*zathura_plugin_page_get_label_t)(zathura_page_t* page, void* data, char** label);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get signatures
|
||||||
|
*/
|
||||||
|
typedef zathura_error_t (*zathura_plugin_page_get_signatures)(zathura_page_t* page, void* data, girara_list_t*);
|
||||||
|
|
||||||
struct zathura_plugin_functions_s
|
struct zathura_plugin_functions_s
|
||||||
{
|
{
|
||||||
|
@ -205,6 +209,11 @@ struct zathura_plugin_functions_s
|
||||||
* Get page label.
|
* Get page label.
|
||||||
*/
|
*/
|
||||||
zathura_plugin_page_get_label_t page_get_label;
|
zathura_plugin_page_get_label_t page_get_label;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get signatures.
|
||||||
|
*/
|
||||||
|
zathura_plugin_page_get_signatures page_get_signatures;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct zathura_plugin_version_s {
|
typedef struct zathura_plugin_version_s {
|
||||||
|
|
Loading…
Reference in a new issue