Ticket #703: sugar-703.patch

File sugar-703.patch, 2.1 KB (added by alsroot, 12 years ago)
  • readtoolbar.py

    From 84371b2ab49c7f592611c640dc8c45803965046e Mon Sep 17 00:00:00 2001
    From: Aleksey Lim <alsroot@member.fsf.org>
    Date: Mon, 6 Apr 2009 08:18:10 +0000
    Subject: Support evince binding w/o document_links support #703
    
    ---
     readtoolbar.py |   23 +++++++++++++----------
     1 files changed, 13 insertions(+), 10 deletions(-)
    
    diff --git a/readtoolbar.py b/readtoolbar.py
    index 8cf797a..5c812c9 100644
    a b class ReadToolbar(gtk.Toolbar): 
    272272   
    273273    def _page_changed_cb(self, page, proxy):
    274274        self._update_nav_buttons()
    275         if self._document.has_document_links():
    276             self._toc_select_active_page()
     275        if hasattr(self._document, 'has_document_links'):
     276            if self._document.has_document_links():
     277                self._toc_select_active_page()
    277278
    278279    def _update_nav_buttons(self):
    279280        current_page = self._document.get_page_cache().get_current_page()
    class ReadToolbar(gtk.Toolbar): 
    286287            ' / ' + str(self._document.get_n_pages())
    287288
    288289    def _update_toc(self):
    289         if self._document.has_document_links():
    290             self._navigator.props.sensitive = True
     290        if hasattr(self._document, 'has_document_links'):
     291            if self._document.has_document_links():
     292                self._navigator.props.sensitive = True
    291293
    292             self._toc_model = self._document.get_links_model()
    293             self._navigator.set_model(self._toc_model)
    294             self._navigator.set_active(0)
     294                self._toc_model = self._document.get_links_model()
     295                self._navigator.set_model(self._toc_model)
     296                self._navigator.set_active(0)
    295297
    296             self.__navigator_changed_handler_id = \
    297                 self._navigator.connect('changed', self._navigator_changed_cb)
     298                self.__navigator_changed_handler_id = \
     299                    self._navigator.connect('changed',
     300                            self._navigator_changed_cb)
    298301
    299             self._toc_select_active_page()
     302                self._toc_select_active_page()
    300303
    301304    def _navigator_changed_cb(self, combobox):
    302305        iter = self._navigator.get_active_iter()