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
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('hide', this.onHide, this);
this.on('show', this.onShow, this); this.on('show', this.onShow, this);
deluge.events.on('disconnect', this.onDisconnect, this);
deluge.events.on('login', this.onLogin, this); deluge.events.on('login', this.onLogin, this);
deluge.events.on('logout', this.onLogout, this); deluge.events.on('logout', this.onLogout, this);
@ -81,6 +80,7 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, {
header: _('Version'), header: _('Version'),
width: .25, width: .25,
sortable: true, sortable: true,
tpl: '<tpl if="version">{version}</tpl>',
dataIndex: 'version' dataIndex: 'version'
}], }],
singleSelect: true, singleSelect: true,
@ -141,8 +141,12 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, {
}); });
}, },
disconnect: function() { disconnect: function(show) {
deluge.events.fire('disconnect'); deluge.events.fire('disconnect');
if (show) {
if (this.isVisible()) return;
this.show();
}
}, },
loadHosts: function() { loadHosts: function() {
@ -240,12 +244,6 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, {
} }
}, },
// private
onDisconnect: function() {
if (this.isVisible()) return;
this.show();
},
// private // private
onGetHosts: function(hosts) { onGetHosts: function(hosts) {
this.list.getStore().loadData(hosts); this.list.getStore().loadData(hosts);
@ -296,9 +294,6 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, {
if (!this.hidden && this.rendered) { if (!this.hidden && this.rendered) {
this.hide(); this.hide();
} }
if (this.running) {
}
}, },
// private // private
@ -335,7 +330,6 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, {
} else { } else {
this.removeHostButton.disable(); this.removeHostButton.disable();
this.stopHostButton.disable(); this.stopHostButton.disable();
this.updateButtons(null);
} }
}, },

View file

@ -129,7 +129,10 @@ deluge.ui = {
* Updates the various components in the interface. * Updates the various components in the interface.
*/ */
onUpdate: function(data) { onUpdate: function(data) {
if (!data['connected']) deluge.events.fire('disconnect'); if (!data['connected']) {
deluge.connectionManager.disconnect(true);
return;
}
if (deluge.config.show_session_speed) { if (deluge.config.show_session_speed) {
document.title = this.originalTitle + document.title = this.originalTitle +