Ticket #3934: 0001-Title-of-media-files-SL-3934.patch

File 0001-Title-of-media-files-SL-3934.patch, 1.4 KB (added by humitos, 11 years ago)
  • browser.py

    From 9b555513f5baa5fd74fe5351d5103452cb430348 Mon Sep 17 00:00:00 2001
    From: Manuel Kaufmann <humitos@gmail.com>
    Date: Thu, 1 Nov 2012 13:18:32 -0300
    Subject: [PATCH Browse] Title of media files SL #3934
    
    When a plugin handles the request, for example to play an .ogg file,
    WebKit sets the title as 'None' and '__load_status_changed_cb' is not
    called when status is 'WebKit.LoadStatus.FINISHED', so the title is
    not set as 'Untitled'.
    
    This patch checks if the title is 'None' (because of the case
    mentioned above) and sets it as the 'os.path.basename' of the
    'WebKit.WebView.props.uri' (the name of the filename).
    
    Signed-off-by: Manuel Kaufmann <humitos@gmail.com>
    ---
     browser.py | 9 ++++++---
     1 file changed, 6 insertions(+), 3 deletions(-)
    
    diff --git a/browser.py b/browser.py
    index 39a304d..37bfda3 100644
    a b class TabLabel(Gtk.HBox): 
    436436        self.emit('tab-close')
    437437
    438438    def __title_changed_cb(self, widget, param):
    439         if widget.props.title:
    440             self._label.set_text(widget.props.title)
    441             self._title = widget.props.title
     439        title = widget.props.title
     440        if not title:
     441            title = os.path.basename(widget.props.uri)
     442
     443        self._label.set_text(title)
     444        self._title = title
    442445
    443446    def __load_status_changed_cb(self, widget, param):
    444447        status = widget.get_load_status()