Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/epubadapter.py
diff options
context:
space:
mode:
authorGonzalo Odiard <godiard@gmail.com>2012-09-10 14:03:43 (GMT)
committer Gonzalo Odiard <godiard@gmail.com>2012-09-10 14:19:33 (GMT)
commiteafed20bd06a82e1737786da10fa829b1e220b70 (patch)
treeb2df004d09c79eeda3dda0a5d2c753be726e9c93 /epubadapter.py
parentef1810e61bf4658a48191fcff238857e1458b21b (diff)
Fix index management in epub files - SL #3853
Epub index can point to internal links in the content files. This patch manage this cases. A particular case was found in a file generated in UY (see attachment in the ticket) where the links don't point to the start of a file, but to the end of the previous file. Then, if the index is at the end of a file, we open the next file. Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
Diffstat (limited to 'epubadapter.py')
-rw-r--r--epubadapter.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/epubadapter.py b/epubadapter.py
index 5ad6e55..687565f 100644
--- a/epubadapter.py
+++ b/epubadapter.py
@@ -157,6 +157,18 @@ class EpubViewer(epubview.EpubView):
else:
return False
+ def get_link_iter(self, current_link):
+ """
+ Returns the iter related to a link
+ """
+ link_iter = self._epub.get_links_model().get_iter_first()
+
+ while link_iter is not None and \
+ self._epub.get_links_model().get_value(link_iter, 1) \
+ != current_link:
+ link_iter = self._epub.get_links_model().iter_next(link_iter)
+ return link_iter
+
def find_changed(self, job, page=None):
self._find_changed(job)