fix clearing the tree w...
Content-type: text/plain

Author: damoxc

Revision: 4948

Log:
        fix the file icon on files
fix clearing the tree when a different torrent is selected

Diff:
Modified: trunk/deluge/ui/web/js/deluge-add.js
===================================================================
--- trunk/deluge/ui/web/js/deluge-add.js        2009-03-30 23:24:51 UTC (rev 
4947)
+++ trunk/deluge/ui/web/js/deluge-add.js        2009-03-30 23:25:27 UTC (rev 
4948)
@@ -62,7 +62,7 @@
                                                size: fsize(item[0]),
                                                leaf: true,
                                                checked: item[1],
-                                               iconCls: 'x-deluge-add-file',
+                                               icon: '/icons/16/document.png',
                                                uiProvider: 
Ext.tree.ColumnNodeUI
                                        }));    
                                }

Modified: trunk/deluge/ui/web/js/deluge-details.js
===================================================================
--- trunk/deluge/ui/web/js/deluge-details.js    2009-03-30 23:24:51 UTC (rev 
4947)
+++ trunk/deluge/ui/web/js/deluge-details.js    2009-03-30 23:25:27 UTC (rev 
4948)
@@ -203,7 +203,11 @@
                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) {
                        $each(files, function(item, file) {
                                var child = parent.findChild('id', file);
@@ -224,7 +228,7 @@
                                                        size: fsize(item[0]),
                                                        progress: item[1],
                                                        leaf: true,
-                                                       iconCls: 
'x-deluge-file',
+                                                       icon: 
'/icons/16/document.png',
                                                        uiProvider: 
Ext.tree.ColumnNodeUI
                                                });
                                                parent.appendChild(child);
@@ -237,7 +241,13 @@
        },
        
        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) {



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to