]> granicus.if.org Git - transmission/commitdiff
(trunk web) #4452 "file list not refreshing" -- instead of only requesting file info...
authorJordan Lee <jordan@transmissionbt.com>
Tue, 30 Aug 2011 02:49:01 +0000 (02:49 +0000)
committerJordan Lee <jordan@transmissionbt.com>
Tue, 30 Aug 2011 02:49:01 +0000 (02:49 +0000)
web/javascript/torrent.js
web/javascript/transmission.js

index 6596b1a2b41052935dd4cf3dadb72e0d7cee2a49..a0ea3892427ea8f1ce17995fb89ff8565ad38eb4 100644 (file)
@@ -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; },
index 45d4abd489d177e6b961db0e947660e3d972b45e..b5741f5954cf6e5480a64d1e4fdb1c83cf2c2a81 100644 (file)
@@ -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