mirror of
https://github.com/transmission/transmission
synced 2025-02-20 13:16:53 +00:00
(trunk web) #4452 "file list not refreshing" -- instead of only requesting file info for the inspector when the inspector is opened (and also when torrent selection changes while the inspector is open), keep re-requesting the file info util we've got it. That way if the first request fails, we'll pick it up on subsequent updates.
This commit is contained in:
parent
27c6f96271
commit
b23131a5b4
2 changed files with 18 additions and 5 deletions
|
@ -236,6 +236,7 @@ Torrent.prototype =
|
|||
isFinished: function() { return this.fields.isFinished; },
|
||||
|
||||
// derived accessors
|
||||
hasExtraInfo: function() { return 'hashString' in this.fields; },
|
||||
isSeeding: function() { return this.getStatus() === Torrent._StatusSeed; },
|
||||
isStopped: function() { return this.getStatus() === Torrent._StatusStopped; },
|
||||
isChecking: function() { return this.getStatus() === Torrent._StatusCheck; },
|
||||
|
|
|
@ -448,7 +448,7 @@ Transmission.prototype =
|
|||
selectionChanged: function()
|
||||
{
|
||||
if (this[Prefs._ShowInspector])
|
||||
this.refreshInspectorTorrents(true);
|
||||
this.refreshInspectorTorrents();
|
||||
|
||||
this.updateButtonStates();
|
||||
this.updateInspector();
|
||||
|
@ -1076,7 +1076,19 @@ Transmission.prototype =
|
|||
this.remote.updateTorrents(null, fields, this.updateFromTorrentGet, this);
|
||||
},
|
||||
|
||||
refreshInspectorTorrents: function(full)
|
||||
needsExtraInfo: function(ids)
|
||||
{
|
||||
var i, id, tor;
|
||||
|
||||
for (i=0; id=ids[i]; ++i)
|
||||
if ((tor = this._torrents[id]))
|
||||
if (!tor.hasExtraInfo())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
refreshInspectorTorrents: function(full)
|
||||
{
|
||||
// some torrent fields are only used by the inspector, so we defer loading them
|
||||
// until the user is viewing the torrent in the inspector.
|
||||
|
@ -1084,7 +1096,7 @@ Transmission.prototype =
|
|||
var ids = this.getSelectedTorrentIds();
|
||||
if (ids && ids.length) {
|
||||
var fields = ['id'].concat(Torrent.Fields.StatsExtra);
|
||||
if (full)
|
||||
if (this.needsExtraInfo(ids))
|
||||
fields = fields.concat(Torrent.Fields.InfoExtra);
|
||||
this.remote.updateTorrents(ids, fields, this.updateFromTorrentGet, this);
|
||||
}
|
||||
|
@ -1827,8 +1839,8 @@ Transmission.prototype =
|
|||
delete this._periodic_inspector_refresh;
|
||||
if (visible) {
|
||||
var tr = this;
|
||||
this._periodic_inspector_refresh = setInterval(function() {tr.refreshInspectorTorrents(false);},2000);
|
||||
this.refreshInspectorTorrents(true);
|
||||
this._periodic_inspector_refresh = setInterval(function() {tr.refreshInspectorTorrents();},2000);
|
||||
this.refreshInspectorTorrents();
|
||||
}
|
||||
|
||||
// update the ui widgetry
|
||||
|
|
Loading…
Reference in a new issue