(trunk web) better encapsulation of FileRow -- make most of its fields and methods private. transmission.js and remote.js don't know about FileRow anymore.

This commit is contained in:
Jordan Lee
2011-09-03 04:33:04 +00:00
parent 0db7e2d242
commit f836308b42
4 changed files with 108 additions and 115 deletions

View File

@@ -146,18 +146,14 @@ TransmissionRemote.prototype =
});
},
changeFileCommand: function(command, rows) {
var remote = this;
var torrent_ids = [ rows[0].getTorrent().getId() ];
var files = [];
for (var i=0, row; row=rows[i]; ++i)
files.push(row.getIndex());
var o = {
method: 'torrent-set',
arguments: { ids: torrent_ids }
};
o.arguments[command] = files;
this.sendRequest(o, function() {
changeFileCommand: function(torrentId, fileIndices, command) {
var remote = this,
args = { ids: [torrentId] };
args[command] = fileIndices;
this.sendRequest({
arguments: args,
method: 'torrent-set'
}, function() {
remote._controller.refreshTorrents(torrent_ids);
});
},