parent
5ec94f96fd
commit
4d1dbe11e8
@ -227,7 +227,8 @@ class CommandDispatcher:
|
||||
self._tabbed_browser.close_tab(tab)
|
||||
tabbar.setSelectionBehaviorOnRemove(old_selection_behavior)
|
||||
|
||||
def _tab_close_prompt_if_pinned(self, tab, force, yes_action):
|
||||
@staticmethod
|
||||
def tab_close_prompt_if_pinned(tab, force, yes_action):
|
||||
"""Helper method for tab_close.
|
||||
|
||||
If tab is pinned, prompt. If everything is good, run yes_action.
|
||||
@ -260,7 +261,7 @@ class CommandDispatcher:
|
||||
close = functools.partial(self._tab_close, tab, prev,
|
||||
next_, opposite)
|
||||
|
||||
self._tab_close_prompt_if_pinned(tab, force, close)
|
||||
CommandDispatcher.tab_close_prompt_if_pinned(tab, force, close)
|
||||
|
||||
@cmdutils.register(instance='command-dispatcher', scope='window',
|
||||
name='tab-pin')
|
||||
@ -920,7 +921,7 @@ class CommandDispatcher:
|
||||
if not force:
|
||||
for i, tab in enumerate(self._tabbed_browser.widgets()):
|
||||
if _to_close(i) and tab.data.pinned:
|
||||
self._tab_close_prompt_if_pinned(
|
||||
CommandDispatcher.tab_close_prompt_if_pinned(
|
||||
tab, force,
|
||||
lambda: self.tab_only(
|
||||
prev=prev, next_=next_, force=True))
|
||||
|
@ -26,6 +26,7 @@ from PyQt5.QtWidgets import QSizePolicy
|
||||
from PyQt5.QtCore import pyqtSignal, pyqtSlot, QTimer, QUrl, QSize
|
||||
from PyQt5.QtGui import QIcon
|
||||
|
||||
from qutebrowser.browser.commands import CommandDispatcher
|
||||
from qutebrowser.config import config
|
||||
from qutebrowser.keyinput import modeman
|
||||
from qutebrowser.mainwindow import tabwidget
|
||||
@ -366,7 +367,8 @@ class TabbedBrowser(tabwidget.TabWidget):
|
||||
log.webview.debug("Got invalid tab {} for index {}!".format(
|
||||
tab, idx))
|
||||
return
|
||||
self.close_tab(tab)
|
||||
CommandDispatcher.tab_close_prompt_if_pinned(
|
||||
tab, False, lambda: self.close_tab(tab))
|
||||
|
||||
@pyqtSlot(browsertab.AbstractTab)
|
||||
def on_window_close_requested(self, widget):
|
||||
|
Loading…
Reference in New Issue
Block a user