From b530658e208c6e48580e7fca2289b2f523458c86 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Thu, 1 Dec 2011 23:32:19 +0000 Subject: [PATCH] Fix #1969 : Menu item 'quit & shutdown' available when not connected to daemon --- deluge/ui/gtkui/menubar.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/deluge/ui/gtkui/menubar.py b/deluge/ui/gtkui/menubar.py index 2e3ca8edc..e6e9284e9 100644 --- a/deluge/ui/gtkui/menubar.py +++ b/deluge/ui/gtkui/menubar.py @@ -169,7 +169,7 @@ class MenuBar(component.Component): "menuitem_addtorrent" ] - self.config.register_set_function("classic_mode", self._on_classic_mode) + self.config.register_set_function("classic_mode", self._on_classic_mode, True) client.register_event_handler("TorrentStateChangedEvent", self.on_torrentstatechanged_event) client.register_event_handler("TorrentResumedEvent", self.on_torrentresumed_event) @@ -468,10 +468,12 @@ class MenuBar(component.Component): "menuitem_connectionmanager" ] - if value: - attr = "hide" - else: - attr = "show" - for item in items: - getattr(self.window.main_glade.get_widget(item), attr)() + w = self.window.main_glade.get_widget(item) + if value: + w.hide() + else: + if client.connected() or item is "menuitem_connectionmanager": + w.show() + else: + w.hide()