]> www.fi.muni.cz Git - evince.git/commitdiff
[libdocument] Add find_link_page method to EvDocumentLinks interface
authorCarlos Garcia Campos <carlosgc@gnome.org>
Fri, 3 Sep 2010 08:25:46 +0000 (10:25 +0200)
committerCarlos Garcia Campos <carlosgc@gnome.org>
Fri, 3 Sep 2010 08:32:54 +0000 (10:32 +0200)
Very often we only need to know the page of a named destination, for
example when creating the outline. For some backends getting only the
page is much faster than creating the destination.

libdocument/ev-document-links.c
libdocument/ev-document-links.h

index 48dde7fcdf2aa17acdfde78bf92c4d536a8ffc6c..0cddb405e1dcd5c7a836aa0bd7d08e2f11432412 100644 (file)
@@ -77,6 +77,20 @@ ev_document_links_find_link_dest (EvDocumentLinks *document_links,
        return retval;
 }
 
+gint
+ev_document_links_find_link_page (EvDocumentLinks *document_links,
+                                 const gchar     *link_name)
+{
+       EvDocumentLinksInterface *iface = EV_DOCUMENT_LINKS_GET_IFACE (document_links);
+       gint retval;
+
+       ev_document_doc_mutex_lock ();
+       retval = iface->find_link_page (document_links, link_name);
+       ev_document_doc_mutex_unlock ();
+
+       return retval;
+}
+
 /* Helper functions */
 gint
 ev_document_links_get_dest_page (EvDocumentLinks *document_links,
index 1c507e718d9ebc6e44b813b176de2f992b6f9839..36fa25491baa65665994c2d36289b453797c7d54 100644 (file)
@@ -67,6 +67,8 @@ struct _EvDocumentLinksInterface
                                               EvPage          *page);
        EvLinkDest    *(* find_link_dest)     (EvDocumentLinks *document_links,
                                               const gchar     *link_name);
+       gint           (* find_link_page)     (EvDocumentLinks *document_links,
+                                              const gchar     *link_name);
 };
 
 GType          ev_document_links_get_type            (void) G_GNUC_CONST;
@@ -77,6 +79,8 @@ EvMappingList *ev_document_links_get_links           (EvDocumentLinks *document_
                                                      EvPage          *page);
 EvLinkDest    *ev_document_links_find_link_dest      (EvDocumentLinks *document_links,
                                                      const gchar     *link_name);
+gint           ev_document_links_find_link_page      (EvDocumentLinks *document_links,
+                                                     const gchar     *link_name);
 gint           ev_document_links_get_dest_page       (EvDocumentLinks *document_links,
                                                      EvLinkDest      *dest);
 gchar         *ev_document_links_get_dest_page_label (EvDocumentLinks *document_links,