]> www.fi.muni.cz Git - evince.git/commitdiff
Use EvPage instead of page index to get links
authorCarlos Garcia Campos <carlosgc@gnome.org>
Wed, 9 Dec 2009 17:23:00 +0000 (18:23 +0100)
committerCarlos Garcia Campos <carlosgc@gnome.org>
Wed, 9 Dec 2009 17:23:00 +0000 (18:23 +0100)
So that we can re-use the page object instead of creating and deleting a
new one.

backend/djvu/djvu-document.c
backend/pdf/ev-poppler.cc
libdocument/ev-document-links.c
libdocument/ev-document-links.h
libview/ev-jobs.c

index 46bbd40257d961e60619cef182907d18b3795330..88c7b0c074114d8b1fd0d5f2028fe6189dce1020 100644 (file)
@@ -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
index 506e9349b0ce23b7052eaa286a56024e84c0dcb2..82cde9e311893145d439369c06eac7172aa9969b 100644 (file)
@@ -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);
 }
index d74804b020c69f2751bb901199ce7487e6fb8cfd..96383e249c43bf873802d9cea83583a11735f750 100644 (file)
@@ -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;
index b8ea6014ca3ff073c60edcd77ed97e38a51232da..21c1d4b8411d4a0cd560e5e576d0ec25fafd4a89 100644 (file)
@@ -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);
 
index df15f6db865ce0fa489905019abf982b38190b43..ac716308da3c55af4cbac7abec20ff9cce48aff1 100644 (file)
@@ -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),