From: Carlos Garcia Campos Date: Wed, 9 Dec 2009 17:23:00 +0000 (+0100) Subject: Use EvPage instead of page index to get links X-Git-Tag: EVINCE_2_29_4~23 X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=e63cb09538113fa2695bc2877902702109eed303;p=evince.git Use EvPage instead of page index to get links So that we can re-use the page object instead of creating and deleting a new one. --- diff --git a/backend/djvu/djvu-document.c b/backend/djvu/djvu-document.c index 46bbd402..88c7b0c0 100644 --- a/backend/djvu/djvu-document.c +++ b/backend/djvu/djvu-document.c @@ -697,9 +697,9 @@ djvu_document_find_iface_init (EvDocumentFindIface *iface) static GList * djvu_document_links_get_links (EvDocumentLinks *document_links, - gint page) + EvPage *page) { - return djvu_links_get_links (document_links, page, SCALE_FACTOR); + return djvu_links_get_links (document_links, page->index, SCALE_FACTOR); } static void diff --git a/backend/pdf/ev-poppler.cc b/backend/pdf/ev-poppler.cc index 506e9349..82cde9e3 100644 --- a/backend/pdf/ev-poppler.cc +++ b/backend/pdf/ev-poppler.cc @@ -1260,7 +1260,7 @@ pdf_document_links_get_links_model (EvDocumentLinks *document_links) static GList * pdf_document_links_get_links (EvDocumentLinks *document_links, - gint page) + EvPage *page) { PdfDocument *pdf_document; PopplerPage *poppler_page; @@ -1270,8 +1270,7 @@ pdf_document_links_get_links (EvDocumentLinks *document_links, double height; pdf_document = PDF_DOCUMENT (document_links); - poppler_page = poppler_document_get_page (pdf_document->document, - page); + poppler_page = POPPLER_PAGE (page->backend_page); mapping_list = poppler_page_get_link_mapping (poppler_page); poppler_page_get_size (poppler_page, NULL, &height); @@ -1293,7 +1292,6 @@ pdf_document_links_get_links (EvDocumentLinks *document_links, } poppler_page_free_link_mapping (mapping_list); - g_object_unref (poppler_page); return g_list_reverse (retval); } diff --git a/libdocument/ev-document-links.c b/libdocument/ev-document-links.c index d74804b0..96383e24 100644 --- a/libdocument/ev-document-links.c +++ b/libdocument/ev-document-links.c @@ -56,7 +56,7 @@ ev_document_links_get_links_model (EvDocumentLinks *document_links) GList * ev_document_links_get_links (EvDocumentLinks *document_links, - gint page) + EvPage *page) { EvDocumentLinksIface *iface = EV_DOCUMENT_LINKS_GET_IFACE (document_links); GList *retval; diff --git a/libdocument/ev-document-links.h b/libdocument/ev-document-links.h index b8ea6014..21c1d4b8 100644 --- a/libdocument/ev-document-links.h +++ b/libdocument/ev-document-links.h @@ -63,7 +63,7 @@ struct _EvDocumentLinksIface gboolean (* has_document_links) (EvDocumentLinks *document_links); GtkTreeModel *(* get_links_model) (EvDocumentLinks *document_links); GList *(* get_links) (EvDocumentLinks *document_links, - gint page); + EvPage *page); EvLinkDest *(* find_link_dest) (EvDocumentLinks *document_links, const gchar *link_name); }; @@ -73,7 +73,7 @@ gboolean ev_document_links_has_document_links (EvDocumentLinks *document_li GtkTreeModel *ev_document_links_get_links_model (EvDocumentLinks *document_links); GList *ev_document_links_get_links (EvDocumentLinks *document_links, - gint page); + EvPage *page); EvLinkDest *ev_document_links_find_link_dest (EvDocumentLinks *document_links, const gchar *link_name); diff --git a/libview/ev-jobs.c b/libview/ev-jobs.c index df15f6db..ac716308 100644 --- a/libview/ev-jobs.c +++ b/libview/ev-jobs.c @@ -598,7 +598,7 @@ ev_job_page_data_run (EvJob *job) ev_selection_get_selection_map (EV_SELECTION (job->document), ev_page); if ((job_pd->flags & EV_PAGE_DATA_INCLUDE_LINKS) && EV_IS_DOCUMENT_LINKS (job->document)) job_pd->link_mapping = - ev_document_links_get_links (EV_DOCUMENT_LINKS (job->document), job_pd->page); + ev_document_links_get_links (EV_DOCUMENT_LINKS (job->document), ev_page); if ((job_pd->flags & EV_PAGE_DATA_INCLUDE_FORMS) && EV_IS_DOCUMENT_FORMS (job->document)) job_pd->form_field_mapping = ev_document_forms_get_form_fields (EV_DOCUMENT_FORMS (job->document),