diff options
author | Germán Poo-Caamaño <[email protected]> | 2014-05-02 23:17:04 -0700 |
---|---|---|
committer | raveit65 <[email protected]> | 2017-08-28 16:04:01 +0200 |
commit | 4a24be7eb05f971e77064fb22d7a649bf959d90b (patch) | |
tree | 5b802af5aeecdbd53ba17219eab605b7991aaa45 /backend/pdf/ev-poppler.cc | |
parent | cd5aaa1eabf27936c8a348d4712d711800bdd67f (diff) | |
download | atril-4a24be7eb05f971e77064fb22d7a649bf959d90b.tar.bz2 atril-4a24be7eb05f971e77064fb22d7a649bf959d90b.tar.xz |
pdf: Implement remove_annotation virtual func
https://bugzilla.gnome.org/show_bug.cgi?id=649044
origin commit:
https://git.gnome.org/browse/evince/commit/?id=38ca871
Diffstat (limited to 'backend/pdf/ev-poppler.cc')
-rw-r--r-- | backend/pdf/ev-poppler.cc | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/backend/pdf/ev-poppler.cc b/backend/pdf/ev-poppler.cc index 24c452dd..6f7b544e 100644 --- a/backend/pdf/ev-poppler.cc +++ b/backend/pdf/ev-poppler.cc @@ -2825,6 +2825,36 @@ pdf_document_annotations_document_is_modified (EvDocumentAnnotations *document_a } static void +pdf_document_annotations_remove_annotation (EvDocumentAnnotations *document_annotations, + EvAnnotation *annot) +{ + PopplerPage *poppler_page; + PdfDocument *pdf_document; + EvPage *page; + PopplerAnnot *poppler_annot; + EvMappingList *mapping_list; + EvMapping *annot_mapping; + GList *list; + + poppler_annot = POPPLER_ANNOT (g_object_get_data (G_OBJECT (annot), "poppler-annot")); + pdf_document = PDF_DOCUMENT (document_annotations); + page = ev_annotation_get_page (annot); + poppler_page = POPPLER_PAGE (page->backend_page); + + poppler_page_remove_annot (poppler_page, poppler_annot); + + /* We don't check for pdf_document->annots, if it were NULL then something is really wrong */ + mapping_list = (EvMappingList *)g_hash_table_lookup (pdf_document->annots, + GINT_TO_POINTER (page->index)); + if (mapping_list) { + annot_mapping = ev_mapping_list_find (mapping_list, annot); + ev_mapping_list_remove (mapping_list, annot_mapping); + } + + pdf_document->annots_modified = TRUE; +} + +static void pdf_document_annotations_add_annotation (EvDocumentAnnotations *document_annotations, EvAnnotation *annot, EvRectangle *rect) @@ -2996,6 +3026,7 @@ pdf_document_document_annotations_iface_init (EvDocumentAnnotationsInterface *if iface->document_is_modified = pdf_document_annotations_document_is_modified; iface->add_annotation = pdf_document_annotations_add_annotation; iface->save_annotation = pdf_document_annotations_save_annotation; + iface->remove_annotation = pdf_document_annotations_remove_annotation; } /* Attachments */ |