Module: deluge Branch: master Commit: bf28b3ac31fb2a8508bc66c952b0fbf13aff0c77
Author: Damien Churchill <[email protected]> Date: Wed Apr 28 11:50:56 2010 +0100 fix the connection manager when the ui disconnects from a daemon so it doesn't end up in a loop --- deluge/ui/web/js/deluge-all/ConnectionManager.js | 18 ++++++------------ deluge/ui/web/js/deluge-all/UI.js | 5 ++++- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/deluge/ui/web/js/deluge-all/ConnectionManager.js b/deluge/ui/web/js/deluge-all/ConnectionManager.js index 3891b91..54b3b25 100644 --- a/deluge/ui/web/js/deluge-all/ConnectionManager.js +++ b/deluge/ui/web/js/deluge-all/ConnectionManager.js @@ -48,7 +48,6 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, { this.on('hide', this.onHide, this); this.on('show', this.onShow, this); - deluge.events.on('disconnect', this.onDisconnect, this); deluge.events.on('login', this.onLogin, this); deluge.events.on('logout', this.onLogout, this); @@ -81,6 +80,7 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, { header: _('Version'), width: .25, sortable: true, + tpl: '<tpl if="version">{version}</tpl>', dataIndex: 'version' }], singleSelect: true, @@ -141,8 +141,12 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, { }); }, - disconnect: function() { + disconnect: function(show) { deluge.events.fire('disconnect'); + if (show) { + if (this.isVisible()) return; + this.show(); + } }, loadHosts: function() { @@ -241,12 +245,6 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, { }, // private - onDisconnect: function() { - if (this.isVisible()) return; - this.show(); - }, - - // private onGetHosts: function(hosts) { this.list.getStore().loadData(hosts); Ext.each(hosts, function(host) { @@ -296,9 +294,6 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, { if (!this.hidden && this.rendered) { this.hide(); } - if (this.running) { - - } }, // private @@ -335,7 +330,6 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, { } else { this.removeHostButton.disable(); this.stopHostButton.disable(); - this.updateButtons(null); } }, diff --git a/deluge/ui/web/js/deluge-all/UI.js b/deluge/ui/web/js/deluge-all/UI.js index 879ec5f..2e8f037 100644 --- a/deluge/ui/web/js/deluge-all/UI.js +++ b/deluge/ui/web/js/deluge-all/UI.js @@ -129,7 +129,10 @@ deluge.ui = { * Updates the various components in the interface. */ onUpdate: function(data) { - if (!data['connected']) deluge.events.fire('disconnect'); + if (!data['connected']) { + deluge.connectionManager.disconnect(true); + return; + } if (deluge.config.show_session_speed) { document.title = this.originalTitle + -- You received this message because you are subscribed to the Google Groups "deluge-commit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/deluge-commit?hl=en.
