Only close window (instead of quitting) when closing last tab.

This also renames the 'quit' value for tabs->last-close to 'close' to avoid
confusion.

Fixes #154.
This commit is contained in:
Florian Bruhin 2014-10-07 17:09:24 +02:00
parent f9dc9f4acd
commit 3e31e88921
4 changed files with 7 additions and 10 deletions

View File

@ -222,10 +222,6 @@ class CommandDispatcher:
Args: Args:
count: The tab index to close, or None count: The tab index to close, or None
Emit:
quit: If last tab was closed and last-close in config is set to
quit.
""" """
tab = self._cntwidget(count) tab = self._cntwidget(count)
if tab is None: if tab is None:

View File

@ -1163,7 +1163,7 @@ class LastClose(BaseType):
valid_values = ValidValues(('ignore', "Don't do anything."), valid_values = ValidValues(('ignore', "Don't do anything."),
('blank', "Load a blank page."), ('blank', "Load a blank page."),
('quit', "Quit qutebrowser.")) ('close', "Close the window."))
class AcceptCookies(BaseType): class AcceptCookies(BaseType):

View File

@ -200,7 +200,7 @@ class MainWindow(QWidget):
prompter = self._get_object('prompter') prompter = self._get_object('prompter')
# misc # misc
self._tabbed_browser.quit.connect(app.shutdown) self._tabbed_browser.close_window.connect(self.close)
mode_manager.entered.connect(hints.on_mode_entered) mode_manager.entered.connect(hints.on_mode_entered)
# status bar # status bar
@ -294,6 +294,7 @@ class MainWindow(QWidget):
self._completion.setGeometry(rect) self._completion.setGeometry(rect)
@cmdutils.register(instance='main-window', scope='window') @cmdutils.register(instance='main-window', scope='window')
@pyqtSlot()
def close(self): def close(self):
"""Close the current window. """Close the current window.

View File

@ -72,7 +72,7 @@ class TabbedBrowser(tabwidget.TabWidget):
arg 1: x-position in %. arg 1: x-position in %.
arg 2: y-position in %. arg 2: y-position in %.
cur_load_status_changed: Loading status of current tab changed. cur_load_status_changed: Loading status of current tab changed.
quit: The last tab was closed, quit application. close_window: The last tab was closed, close this window.
resized: Emitted when the browser window has resized, so the completion resized: Emitted when the browser window has resized, so the completion
widget can adjust its size to it. widget can adjust its size to it.
arg: The new size. arg: The new size.
@ -92,7 +92,7 @@ class TabbedBrowser(tabwidget.TabWidget):
cur_scroll_perc_changed = pyqtSignal(int, int) cur_scroll_perc_changed = pyqtSignal(int, int)
cur_load_status_changed = pyqtSignal(str) cur_load_status_changed = pyqtSignal(str)
start_download = pyqtSignal('QNetworkReply*') start_download = pyqtSignal('QNetworkReply*')
quit = pyqtSignal() close_window = pyqtSignal()
resized = pyqtSignal('QRect') resized = pyqtSignal('QRect')
got_cmd = pyqtSignal(str) got_cmd = pyqtSignal(str)
current_tab_changed = pyqtSignal(webview.WebView) current_tab_changed = pyqtSignal(webview.WebView)
@ -229,9 +229,9 @@ class TabbedBrowser(tabwidget.TabWidget):
last_close = config.get('tabs', 'last-close') last_close = config.get('tabs', 'last-close')
if self.count() > 1: if self.count() > 1:
self._remove_tab(tab) self._remove_tab(tab)
elif last_close == 'quit': elif last_close == 'close':
self._remove_tab(tab) self._remove_tab(tab)
self.quit.emit() self.close_window.emit()
elif last_close == 'blank': elif last_close == 'blank':
tab.openurl('about:blank') tab.openurl('about:blank')