This commit is contained in:
Damien Churchill 2010-12-12 00:02:41 +00:00
parent 29a306e378
commit 82fbbad385
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

@ -113,6 +113,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,
@ -169,7 +172,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;