fix the file icon on files

fix clearing the tree when a different torrent is selected
This commit is contained in:
Damien Churchill 2009-03-30 23:25:27 +00:00
parent 0b9b261038
commit a32b43b414
2 changed files with 14 additions and 4 deletions

View File

@ -62,7 +62,7 @@ Deluge.Add = {
size: fsize(item[0]), size: fsize(item[0]),
leaf: true, leaf: true,
checked: item[1], checked: item[1],
iconCls: 'x-deluge-add-file', icon: '/icons/16/document.png',
uiProvider: Ext.tree.ColumnNodeUI uiProvider: Ext.tree.ColumnNodeUI
})); }));
} }

View File

@ -203,7 +203,11 @@ Deluge.Details.Files = {
this.panel.update = this.update.bind(this); this.panel.update = this.update.bind(this);
}, },
onRequestComplete: function(files) { onRequestComplete: function(files, torrentId) {
if (this.torrentId != torrentId) {
this.clear();
this.torrentId = torrentId;
}
function walk(files, parent) { function walk(files, parent) {
$each(files, function(item, file) { $each(files, function(item, file) {
var child = parent.findChild('id', file); var child = parent.findChild('id', file);
@ -224,7 +228,7 @@ Deluge.Details.Files = {
size: fsize(item[0]), size: fsize(item[0]),
progress: item[1], progress: item[1],
leaf: true, leaf: true,
iconCls: 'x-deluge-file', icon: '/icons/16/document.png',
uiProvider: Ext.tree.ColumnNodeUI uiProvider: Ext.tree.ColumnNodeUI
}); });
parent.appendChild(child); parent.appendChild(child);
@ -237,7 +241,13 @@ Deluge.Details.Files = {
}, },
clear: function() { clear: function() {
var root = this.panel.getRootNode();
if (!root.hasChildNodes()) return;
root.cascade(function(node) {
var parent = node.parentNode;
if (!parent) return;
parent.removeChild(node);
});
}, },
update: function(torrentId) { update: function(torrentId) {