From 356536f6b8b44bfcf13c644a26ecdd583465bc0f Mon Sep 17 00:00:00 2001 From: Carlos Garcia Campos Date: Sun, 11 Jul 2010 08:52:34 +0000 Subject: Add EvMappingList data struct instead of using a GList It just wraps the GList and adds reference counting --- (limited to 'backend') diff --git a/backend/djvu/djvu-document.c b/backend/djvu/djvu-document.c index 0023a1c..aa0e595 100644 --- a/backend/djvu/djvu-document.c +++ b/backend/djvu/djvu-document.c @@ -689,7 +689,7 @@ djvu_document_find_iface_init (EvDocumentFindInterface *iface) iface->find_text = djvu_document_find_find_text; } -static GList * +static EvMappingList * djvu_document_links_get_links (EvDocumentLinks *document_links, EvPage *page) { diff --git a/backend/djvu/djvu-links.c b/backend/djvu/djvu-links.c index 72d68f9..d13af0b 100644 --- a/backend/djvu/djvu-links.c +++ b/backend/djvu/djvu-links.c @@ -26,7 +26,7 @@ #include "djvu-links.h" #include "djvu-document-private.h" #include "ev-document-links.h" -#include "ev-mapping.h" +#include "ev-mapping-list.h" static gboolean number_from_miniexp(miniexp_t sexp, int *number) { @@ -354,7 +354,7 @@ djvu_links_has_document_links (EvDocumentLinks *document_links) return FALSE; } -GList * +EvMappingList * djvu_links_get_links (EvDocumentLinks *document_links, gint page, double scale_factor) @@ -390,7 +390,7 @@ djvu_links_get_links (EvDocumentLinks *document_links, ddjvu_miniexp_release (djvu_document->d_document, page_annotations); } - return retval; + return ev_mapping_list_new (page, retval, (GDestroyNotify)g_object_unref); } EvLinkDest * diff --git a/backend/djvu/djvu-links.h b/backend/djvu/djvu-links.h index 3a3c5d6..76d9072 100644 --- a/backend/djvu/djvu-links.h +++ b/backend/djvu/djvu-links.h @@ -24,12 +24,12 @@ #include -GtkTreeModel *djvu_links_get_links_model (EvDocumentLinks *document_links); -GList *djvu_links_get_links (EvDocumentLinks *document_links, - gint page, - double scale_factor); -EvLinkDest *djvu_links_find_link_dest (EvDocumentLinks *document_links, - const gchar *link_name); -gboolean djvu_links_has_document_links (EvDocumentLinks *document_links); +GtkTreeModel *djvu_links_get_links_model (EvDocumentLinks *document_links); +EvMappingList *djvu_links_get_links (EvDocumentLinks *document_links, + gint page, + double scale_factor); +EvLinkDest *djvu_links_find_link_dest (EvDocumentLinks *document_links, + const gchar *link_name); +gboolean djvu_links_has_document_links (EvDocumentLinks *document_links); #endif /* __DJVU_LINK_H__ */ diff --git a/backend/pdf/ev-poppler.cc b/backend/pdf/ev-poppler.cc index 64ac308..83bccdf 100644 --- a/backend/pdf/ev-poppler.cc +++ b/backend/pdf/ev-poppler.cc @@ -37,7 +37,6 @@ #include "ev-poppler.h" #include "ev-file-exporter.h" -#include "ev-mapping.h" #include "ev-document-find.h" #include "ev-document-misc.h" #include "ev-document-links.h" @@ -1242,7 +1241,7 @@ pdf_document_links_get_links_model (EvDocumentLinks *document_links) return model; } -static GList * +static EvMappingList * pdf_document_links_get_links (EvDocumentLinks *document_links, EvPage *page) { @@ -1277,7 +1276,7 @@ pdf_document_links_get_links (EvDocumentLinks *document_links, poppler_page_free_link_mapping (mapping_list); - return g_list_reverse (retval); + return ev_mapping_list_new (page->index, g_list_reverse (retval), (GDestroyNotify)g_object_unref); } static EvLinkDest * @@ -1308,7 +1307,7 @@ pdf_document_document_links_iface_init (EvDocumentLinksInterface *iface) iface->find_link_dest = pdf_document_links_find_link_dest; } -static GList * +static EvMappingList * pdf_document_images_get_image_mapping (EvDocumentImages *document_images, EvPage *page) { @@ -1341,7 +1340,7 @@ pdf_document_images_get_image_mapping (EvDocumentImages *document_images, poppler_page_free_image_mapping (mapping_list); - return g_list_reverse (retval); + return ev_mapping_list_new (page->index, g_list_reverse (retval), (GDestroyNotify)g_object_unref); } GdkPixbuf * @@ -2265,7 +2264,7 @@ ev_form_field_from_poppler_field (PopplerFormField *poppler_field) return ev_field; } -static GList * +static EvMappingList * pdf_document_forms_get_form_fields (EvDocumentForms *document, EvPage *page) { @@ -2310,7 +2309,9 @@ pdf_document_forms_get_form_fields (EvDocumentForms *document, poppler_page_free_form_field_mapping (fields); - return g_list_reverse (retval); + return retval ? ev_mapping_list_new (page->index, + g_list_reverse (retval), + (GDestroyNotify)g_object_unref) : NULL; } static gchar * @@ -2664,7 +2665,7 @@ ev_annot_from_poppler_annot (PopplerAnnot *poppler_annot, return ev_annot; } -static GList * +static EvMappingList * pdf_document_annotations_get_annotations (EvDocumentAnnotations *document_annotations, EvPage *page) { @@ -2715,7 +2716,7 @@ pdf_document_annotations_get_annotations (EvDocumentAnnotations *document_annota poppler_page_free_annot_mapping (annots); - return g_list_reverse (retval); + return ev_mapping_list_new (page->index, g_list_reverse (retval), (GDestroyNotify)g_object_unref); } static void -- cgit v0.9.1