fix the connection manager when the ui disconnects from a daemon so it doesn't end up in a loop

This commit is contained in:
Damien Churchill 2010-04-28 11:50:56 +01:00
parent 759ae6356d
commit bf28b3ac31
2 changed files with 10 additions and 13 deletions

View File

@ -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() {
@ -240,12 +244,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);
@ -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);
}
},

View File

@ -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 +