mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-13 04:54:23 +00:00
Add quit dialog when changing classic mode.
Don't change visibility of connection manager when changing classic mode.
This commit is contained in:
parent
c398ef57a5
commit
3e98ef5f89
@ -169,8 +169,6 @@ class MenuBar(component.Component):
|
||||
"menuitem_addtorrent"
|
||||
]
|
||||
|
||||
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)
|
||||
client.register_event_handler("SessionPausedEvent", self.on_sessionpaused_event)
|
||||
@ -194,9 +192,10 @@ class MenuBar(component.Component):
|
||||
for widget in non_remote_items:
|
||||
self.torrentmenu_glade.get_widget(widget).set_no_show_all(False)
|
||||
|
||||
if not self.config["classic_mode"]:
|
||||
self.window.main_glade.get_widget("separatormenuitem").show()
|
||||
self.window.main_glade.get_widget("menuitem_quitdaemon").show()
|
||||
self.window.main_glade.get_widget("separatormenuitem").set_visible(not self.config["classic_mode"])
|
||||
self.window.main_glade.get_widget("menuitem_quitdaemon").set_visible(not self.config["classic_mode"])
|
||||
self.window.main_glade.get_widget("menuitem_connectionmanager").set_visible(not self.config["classic_mode"])
|
||||
|
||||
# Show the Torrent menu because we're connected to a host
|
||||
self.menu_torrent.show()
|
||||
|
||||
@ -460,20 +459,3 @@ class MenuBar(component.Component):
|
||||
def on_menuitem_sidebar_trackers_toggled(self, widget):
|
||||
self.config["sidebar_show_trackers"] = widget.get_active()
|
||||
component.get("FilterTreeView").update()
|
||||
|
||||
def _on_classic_mode(self, key, value):
|
||||
items = [
|
||||
"menuitem_quitdaemon",
|
||||
"separatormenuitem",
|
||||
"menuitem_connectionmanager"
|
||||
]
|
||||
|
||||
for item in items:
|
||||
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()
|
||||
|
@ -751,6 +751,22 @@ class Preferences(component.Component):
|
||||
# Re-show the dialog to make sure everything has been updated
|
||||
self.show()
|
||||
|
||||
if client.is_classicmode() != new_gtkui_config["classic_mode"]:
|
||||
dialog = gtk.MessageDialog(
|
||||
flags=gtk.DIALOG_MODAL|gtk.DIALOG_DESTROY_WITH_PARENT,
|
||||
type=gtk.MESSAGE_QUESTION,
|
||||
buttons=gtk.BUTTONS_YES_NO,
|
||||
message_format=_("You must restart the deluge UI to change classic mode. Quit now?")
|
||||
)
|
||||
result = dialog.run()
|
||||
if result == gtk.RESPONSE_YES:
|
||||
shutdown_daemon = (not client.is_classicmode() and
|
||||
client.connected() and
|
||||
client.is_localhost())
|
||||
component.get("MainWindow").quit(shutdown=shutdown_daemon)
|
||||
dialog.destroy()
|
||||
|
||||
|
||||
def hide(self):
|
||||
self.glade.get_widget("port_img").hide()
|
||||
self.pref_dialog.hide()
|
||||
|
@ -74,14 +74,11 @@ class ToolBar(component.Component):
|
||||
"toolbutton_queue_down"
|
||||
]
|
||||
|
||||
self.config.register_set_function("classic_mode", self._on_classic_mode, True)
|
||||
|
||||
# Hide if necessary
|
||||
self.visible(self.config["show_toolbar"])
|
||||
|
||||
def start(self):
|
||||
if not self.config["classic_mode"]:
|
||||
self.window.main_glade.get_widget("toolbutton_connectionmanager").show()
|
||||
self.window.main_glade.get_widget("toolbutton_connectionmanager").set_visible(not self.config["classic_mode"])
|
||||
|
||||
for widget in self.change_sensitivity:
|
||||
self.window.main_glade.get_widget(widget).set_sensitive(True)
|
||||
@ -178,10 +175,3 @@ class ToolBar(component.Component):
|
||||
def on_toolbutton_queue_down_clicked(self, data):
|
||||
log.debug("on_toolbutton_queue_down_clicked")
|
||||
component.get("MenuBar").on_menuitem_queue_down_activate(data)
|
||||
|
||||
def _on_classic_mode(self, key, value):
|
||||
w = self.window.main_glade.get_widget("toolbutton_connectionmanager")
|
||||
if value:
|
||||
w.hide()
|
||||
else:
|
||||
w.show()
|
||||
|
Loading…
x
Reference in New Issue
Block a user