mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-06 00:18:39 +00:00
[GTKUI] Fix quitting bypassing password lock
This commit is contained in:
parent
c5ad5589df
commit
176064b520
2 changed files with 30 additions and 26 deletions
|
@ -176,7 +176,7 @@ class MainWindow(component.Component):
|
||||||
:param shutdown: whether or not to shutdown the daemon as well
|
:param shutdown: whether or not to shutdown the daemon as well
|
||||||
:type shutdown: boolean
|
:type shutdown: boolean
|
||||||
"""
|
"""
|
||||||
|
def quit_gtkui():
|
||||||
def shutdown_daemon(result):
|
def shutdown_daemon(result):
|
||||||
return client.daemon.shutdown()
|
return client.daemon.shutdown()
|
||||||
|
|
||||||
|
@ -202,6 +202,16 @@ class MainWindow(component.Component):
|
||||||
d.addErrback(log_failure, "disconnect client")
|
d.addErrback(log_failure, "disconnect client")
|
||||||
d.addBoth(stop_reactor)
|
d.addBoth(stop_reactor)
|
||||||
|
|
||||||
|
if self.config["tray_password"] and not self.visible():
|
||||||
|
dialog = PasswordDialog("Enter your pasword to Quit Deluge...")
|
||||||
|
def on_dialog_response(response_id):
|
||||||
|
if response_id == gtk.RESPONSE_OK:
|
||||||
|
if self.config["tray_password"] == sha(dialog.get_password()).hexdigest():
|
||||||
|
quit_gtkui()
|
||||||
|
dialog.run().addCallback(on_dialog_response)
|
||||||
|
else:
|
||||||
|
quit_gtkui()
|
||||||
|
|
||||||
def load_window_state(self):
|
def load_window_state(self):
|
||||||
x = self.config["window_x_pos"]
|
x = self.config["window_x_pos"]
|
||||||
y = self.config["window_y_pos"]
|
y = self.config["window_y_pos"]
|
||||||
|
|
|
@ -377,16 +377,10 @@ class SystemTray(component.Component):
|
||||||
|
|
||||||
def on_menuitem_quit_activate(self, menuitem):
|
def on_menuitem_quit_activate(self, menuitem):
|
||||||
log.debug("on_menuitem_quit_activate")
|
log.debug("on_menuitem_quit_activate")
|
||||||
if self.config["lock_tray"] and not self.window.visible():
|
|
||||||
self.window.present()
|
|
||||||
|
|
||||||
self.window.quit()
|
self.window.quit()
|
||||||
|
|
||||||
def on_menuitem_quitdaemon_activate(self, menuitem):
|
def on_menuitem_quitdaemon_activate(self, menuitem):
|
||||||
log.debug("on_menuitem_quitdaemon_activate")
|
log.debug("on_menuitem_quitdaemon_activate")
|
||||||
if self.config["lock_tray"] and not self.window.visible():
|
|
||||||
self.window.present()
|
|
||||||
|
|
||||||
self.window.quit(shutdown=True)
|
self.window.quit(shutdown=True)
|
||||||
|
|
||||||
def on_tray_setbwdown(self, widget, data=None):
|
def on_tray_setbwdown(self, widget, data=None):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue