This commit is contained in:
Damien Churchill 2010-12-12 00:02:41 +00:00
parent 0f36a65aaf
commit f282487806
3 changed files with 17 additions and 3 deletions

View File

@ -46,7 +46,7 @@ Ext.apply(Ext, {
return true;
},
isObjectsEqual: function(obj1, obj2) {
areObjectsEqual: function(obj1, obj2) {
var equal = true;
if (!obj1 || !obj2) return false;
for (var i in obj1) {

View File

@ -284,8 +284,15 @@
return ids;
},
update: function(torrents) {
update: function(torrents, wipe) {
var store = this.getStore();
// Need to perform a complete reload of the torrent grid.
if (wipe) {
store.removeAll();
this.torrents = {};
}
var newTorrents = [];
// Update and add any new torrents.

View File

@ -114,6 +114,9 @@ deluge.ui = {
update: function() {
var filters = deluge.sidebar.getFilterStates();
this.oldFilters = this.filters;
this.filters = filters;
deluge.client.web.update_ui(Deluge.Keys.Grid, filters, {
success: this.onUpdate,
failure: this.onUpdateError,
@ -170,7 +173,11 @@ deluge.ui = {
' (Down: ' + fspeed(data['stats'].download_rate, true) +
' Up: ' + fspeed(data['stats'].upload_rate, true) + ')';
}
deluge.torrents.update(data['torrents']);
if (Ext.areObjectsEqual(this.filters, this.oldFilters)) {
deluge.torrents.update(data['torrents']);
} else {
deluge.torrents.update(data['torrents'], true);
}
deluge.statusbar.update(data['stats']);
deluge.sidebar.update(data['filters']);
this.errorCount = 0;