diff options
author | Florian Bruhin <me@the-compiler.org> | 2020-09-14 14:51:54 +0200 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2020-09-14 14:51:54 +0200 |
commit | 1943fa072ec3df5a87e18a23b0916f134c131016 (patch) | |
tree | 66a0d1962d0c888a58b49df4c184f3eb05e4b878 /qutebrowser/mainwindow/tabbedbrowser.py | |
parent | 1e473c4bc01da1d7f1c4386d8b7b887e00fbf385 (diff) | |
download | qutebrowser-1943fa072ec3df5a87e18a23b0916f134c131016.tar.gz qutebrowser-1943fa072ec3df5a87e18a23b0916f134c131016.zip |
Handle tab pinned status in AbstractTab
This replaces TabbedBrowser.set_tab_pinned() with
AbstractTab.set_pinned() and thus also allows us to set a tab as pinned
without having to know which TabbedBrowser it belongs to.
This also fixes a bug when :undo is used after closing a tab and then
setting tabs_are_windows to true - we asked "self" (i.e. the
TabbedBrowser the tab was closed in) to restore the tab's pinned status,
but the tab wasn't actually part of that TabbedBrowser as it was opened
in a new window after the undo.
Diffstat (limited to 'qutebrowser/mainwindow/tabbedbrowser.py')
-rw-r--r-- | qutebrowser/mainwindow/tabbedbrowser.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/qutebrowser/mainwindow/tabbedbrowser.py b/qutebrowser/mainwindow/tabbedbrowser.py index 76ca7c721..707527c81 100644 --- a/qutebrowser/mainwindow/tabbedbrowser.py +++ b/qutebrowser/mainwindow/tabbedbrowser.py @@ -28,7 +28,6 @@ import datetime import attr from PyQt5.QtWidgets import QSizePolicy, QWidget, QApplication from PyQt5.QtCore import pyqtSignal, pyqtSlot, QTimer, QUrl -from PyQt5.QtGui import QIcon from qutebrowser.config import config from qutebrowser.keyinput import modeman @@ -351,6 +350,8 @@ class TabbedBrowser(QWidget): functools.partial(self._on_title_changed, tab)) tab.icon_changed.connect( functools.partial(self._on_icon_changed, tab)) + tab.pinned_changed.connect( + functools.partial(self._on_pinned_changed, tab)) tab.load_progress.connect( functools.partial(self._on_load_progress, tab)) tab.load_finished.connect( @@ -530,7 +531,7 @@ class TabbedBrowser(QWidget): newtab = self.tabopen(background=False, idx=entry.index) newtab.history.private_api.deserialize(entry.history) - self.widget.set_tab_pinned(newtab, entry.pinned) + newtab.set_pinned(entry.pinned) @pyqtSlot('QUrl', bool) def load_url(self, url, newtab): @@ -917,6 +918,12 @@ class TabbedBrowser(QWidget): self._update_window_title('scroll_pos') self.widget.update_tab_title(idx, 'scroll_pos') + def _on_pinned_changed(self, tab): + """Update the tab's pinned status.""" + idx = self.widget.indexOf(tab) + self.widget.update_tab_favicon(tab) + self.widget.update_tab_title(idx) + def _on_audio_changed(self, tab, _muted): """Update audio field in tab when mute or recentlyAudible changed.""" try: |