(trunk web) refactor sendTorrentCommand in my quest to allow remote.js to stand on its own

This also happens to fix #2322. Before, the callback would only update
recently-active torrents. Now it updates all affected torrents.
This commit is contained in:
Kevin Glowacz
2009-08-12 02:53:45 +00:00
parent 5ba0a70848
commit 6138abe38f
2 changed files with 26 additions and 21 deletions

View File

@@ -1381,7 +1381,9 @@ Transmission.prototype =
},
removeTorrents: function( torrents ) {
this.remote.removeTorrents( torrents );
var torrent_ids = jQuery.map(torrents, function(t) { return t.id(); } );
var tr = this;
this.remote.removeTorrents( torrent_ids, function(){ tr.refreshTorrents() } );
},
removeTorrentsAndData: function( torrents ) {
@@ -1402,13 +1404,17 @@ Transmission.prototype =
this.startTorrents( [ torrent ] );
},
startTorrents: function( torrents ) {
this.remote.startTorrents( torrents );
var torrent_ids = jQuery.map(torrents, function(t) { return t.id(); } );
var tr = this;
this.remote.startTorrents( torrent_ids, function(){ tr.refreshTorrents(torrent_ids) } );
},
verifyTorrent: function( torrent ) {
this.verifyTorrents( [ torrent ] );
},
verifyTorrents: function( torrents ) {
this.remote.verifyTorrents( torrents );
var torrent_ids = jQuery.map(torrents, function(t) { return t.id(); } );
var tr = this;
this.remote.verifyTorrents( torrent_ids, function(){ tr.refreshTorrents(torrent_ids) } );
},
stopSelectedTorrents: function( ) {
@@ -1421,7 +1427,9 @@ Transmission.prototype =
this.stopTorrents( [ torrent ] );
},
stopTorrents: function( torrents ) {
this.remote.stopTorrents( torrents );
var torrent_ids = jQuery.map(torrents, function(t) { return t.id(); } );
var tr = this;
this.remote.stopTorrents( torrent_ids, function(){ tr.refreshTorrents(torrent_ids )} );
},
changeFileCommand: function(command, torrent, file) {
this.remote.changeFileCommand(command, torrent, file)