Ticket #3564: 0002-Update-progress-bar-and-stop-reload-buttons-when-swi.patch

File 0002-Update-progress-bar-and-stop-reload-buttons-when-swi.patch, 3.5 KB (added by manuq, 12 years ago)

fix

  • pdfviewer.py

    From d90af9aab2a740352b453862b94d8ed5225d6634 Mon Sep 17 00:00:00 2001
    From: =?UTF-8?q?Manuel=20Qui=C3=B1ones?= <manuq@laptop.org>
    Date: Fri, 23 Mar 2012 09:03:17 -0300
    Subject: [PATCH Browse 2/3] Update progress bar and stop/reload buttons when
     switching tabs
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    Mail-Followup-To: <sugar-devel@lists.sugarlabs.org>
    
    Calling the _set_status and _set_progress methods in the web toolbar
    directly when a new tab is activated.
    
    Also the callback for load-status is disconnected now in the previous
    tab, like the other callbacks.
    
    Removed the update of the navigation buttons when the loading status
    changes.  This is only needed when the adress changes or when the tabs
    are switched.
    
    Removed the title set to None when loading status chenges, this was
    giving the following Gtk error:
    
    Gtk-CRITICAL **: gtk_entry_set_text: assertion `text != NULL' failed
    
    Signed-off-by: Manuel Quiñones <manuq@laptop.org>
    Acked-by: Simon Schampijer <simon@laptop.org>
    ---
     pdfviewer.py  |    1 -
     webtoolbar.py |   18 +++++++++---------
     2 files changed, 9 insertions(+), 10 deletions(-)
    
    diff --git a/pdfviewer.py b/pdfviewer.py
    index c7e2452..ef6a6ea 100644
    a b class PDFTabPage(Gtk.HBox): 
    366366
    367367    def __download_progress_cb(self, download, data):
    368368        progress = download.get_progress()
    369         self._browser.props.load_status = WebKit.LoadStatus.PROVISIONAL
    370369        self._browser.props.progress = progress
    371370
    372371    def __download_status_cb(self, download, data):
  • webtoolbar.py

    diff --git a/webtoolbar.py b/webtoolbar.py
    index 7525053..654f720 100644
    a b class PrimaryToolbar(ToolbarBase): 
    324324            self._browser.disconnect(self._title_changed_hid)
    325325            self._browser.disconnect(self._uri_changed_hid)
    326326            self._browser.disconnect(self._progress_changed_hid)
     327            self._browser.disconnect(self._loading_changed_hid)
    327328
    328329        self._browser = browser
    329330        if self._browser.props.title:
    class PrimaryToolbar(ToolbarBase): 
    331332        else:
    332333            self._set_title(_('Untitled'))
    333334        self._set_address(self._browser.props.uri)
     335        self._set_progress(self._browser.props.progress)
     336        self._set_status(self._browser.props.load_status)
    334337
    335         if isinstance(self._browser, Browser):
    336             self.entry.props.editable = True
    337         else:
    338             self.entry.props.editable = False
     338        is_webkit_browser = isinstance(self._browser, Browser)
     339        self.entry.props.editable = is_webkit_browser
    339340
    340341        self._title_changed_hid = self._browser.connect(
    341342                'notify::title', self._title_changed_cb)
    class PrimaryToolbar(ToolbarBase): 
    349350        self._update_navigation_buttons()
    350351
    351352    def __loading_changed_cb(self, widget, param):
    352         status = widget.get_load_status()
    353         if status <= WebKit.LoadStatus.COMMITTED:
    354             self._set_title(None)
    355         self._set_loading(status < WebKit.LoadStatus.FINISHED)
    356         self._update_navigation_buttons()
     353        self._set_status(widget.get_load_status())
    357354
    358355    def __progress_changed_cb(self, widget, param):
    359356        self._set_progress(widget.get_progress())
    360357
     358    def _set_status(self, status):
     359        self._set_loading(status < WebKit.LoadStatus.FINISHED)
     360
    361361    def _set_progress(self, progress):
    362362        if progress == 1.0:
    363363            self.entry.set_progress_fraction(0.0)