use createDelegate and add the onHide method that stops updating the hosts grid

This commit is contained in:
Damien Churchill 2010-02-17 01:34:42 +00:00
parent 68b5f92ec0
commit 7bd5ba3cdb
1 changed files with 12 additions and 9 deletions

View File

@ -161,10 +161,8 @@ Copyright:
initComponent: function() {
Ext.deluge.ConnectionManager.superclass.initComponent.call(this);
this.on({
'hide': this.onHide,
'show': this.onShow
});
this.on('hide', this.onHide, this);
this.on('show', this.onShow, this);
Deluge.Events.on('login', this.onLogin, this);
Deluge.Events.on('logout', this.onLogout, this);
@ -243,6 +241,8 @@ Copyright:
]
})
});
this.update = this.update.createDelegate(this);
},
disconnect: function() {
@ -256,11 +256,11 @@ Copyright:
});
},
update: function(self) {
self.grid.getStore().each(function(r) {
update: function() {
this.grid.getStore().each(function(r) {
Deluge.Client.web.get_host_status(r.id, {
success: self.onGetHostStatus,
scope: self
success: this.onGetHostStatus,
scope: this
});
}, this);
},
@ -337,7 +337,6 @@ Copyright:
}, this, {single: true});
}
});
if (this.running) window.clearInterval(this.running);
this.hide();
}
},
@ -360,6 +359,10 @@ Copyright:
if (this.grid.getSelectionModel().getSelected() == record) this.updateButtons(record);
},
onHide: function() {
if (this.running) window.clearInterval(this.running);
},
onLogin: function() {
Deluge.Client.web.connected({
success: function(connected) {