Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/evinceadapter.py
diff options
context:
space:
mode:
authorGonzalo Odiard <godiard@gmail.com>2012-08-28 14:58:54 (GMT)
committer Gonzalo Odiard <godiard@gmail.com>2012-09-10 14:19:32 (GMT)
commit37bd782de180d79131f36eb8c950a274ec8bbd98 (patch)
tree45e2f1a6d7f2cf205e7a540f7185656d3871b09b /evinceadapter.py
parentb57794402e9be371601032ae2f5a757f4744cf50 (diff)
Start implementation of read index in the pdf backend.
Is not workinging yet due to https://bugzilla.gnome.org/show_bug.cgi?id=682882 Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
Diffstat (limited to 'evinceadapter.py')
-rw-r--r--evinceadapter.py39
1 files changed, 38 insertions, 1 deletions
diff --git a/evinceadapter.py b/evinceadapter.py
index 45f9dd3..06071cd 100644
--- a/evinceadapter.py
+++ b/evinceadapter.py
@@ -242,7 +242,44 @@ class EvinceViewer():
self._model.connect('page-changed', handler)
def update_toc(self, activity):
- return False
+ doc = self._model.get_document()
+ if not doc.has_document_links():
+ logging.error('The pdf file does not have a index')
+ return False
+ else:
+ self._job_links = EvinceView.JobLinks.new(document=doc)
+ self._job_links.connect('finished', self.__index_loaded_cb,
+ activity)
+ EvinceView.Job.scheduler_push_job(self._job_links,
+ EvinceView.JobPriority.PRIORITY_NONE)
+
+ def __index_loaded_cb(self, job, activity):
+ logging.error('__index_loaded_cb %s %s', job.__class__, dir(job))
+ logging.error('job.succeeded %s', job.succeeded())
+ logging.error('job.is_finished %s', job.is_finished())
+
+ self._index_model = job.model
+
+ logging.error('index_model loaded %s', job.model.__class__)
+ if job.model is None:
+ return False
+ """
+ _iter = job.model.get_iter_first()
+ while True:
+ value = job.model.get_value(_iter, 0)
+ logging.error('value %s', value)
+ _iter = job.model.iter_next(_iter)
+ if _iter is None:
+ break
+ """
+
+ activity._navigator_toolbar_button.show()
+ activity._navigator.show_all()
+
+ activity._toc_model = self._index_model
+ activity._navigator.set_model(activity._toc_model)
+ activity._navigator.set_active(0)
+ return True
def find_set_highlight_search(self, set_highlight_search):
self._view.find_set_highlight_search(set_highlight_search)