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): |
436 | 436 | self.emit('tab-close') |
437 | 437 | |
438 | 438 | 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 |
442 | 445 | |
443 | 446 | def __load_status_changed_cb(self, widget, param): |
444 | 447 | status = widget.get_load_status() |