fix #990, showing 0 as a limit when it means unlimited in the statusbar

This commit is contained in:
Damien Churchill 2009-10-28 17:38:35 +00:00
parent 93e3d2acf6
commit a1e4c51c9c
2 changed files with 4 additions and 3 deletions

View File

@ -246,6 +246,7 @@ Deluge.Menus.Torrent = new Ext.menu.Menu({
Ext.deluge.StatusbarMenu = Ext.extend(Ext.menu.Menu, {
setValue: function(value) {
value = (value == 0) ? -1 : value;
var item = this.items.get(value);
if (!item) item = this.items.get('other')
item.suspendEvents();

View File

@ -78,12 +78,12 @@
var updateStat = function(name, config) {
var item = this.items.get('statusbar-' + name);
if (config.limit.value == -1) {
var str = (config.value.formatter) ? config.value.formatter(config.value.value) : config.value.value;
} else {
if (config.limit.value > 0) {
var value = (config.value.formatter) ? config.value.formatter(config.value.value) : config.value.value;
var limit = (config.limit.formatter) ? config.limit.formatter(config.limit.value) : config.limit.value;
var str = String.format(config.format, value, limit);
} else {
var str = (config.value.formatter) ? config.value.formatter(config.value.value) : config.value.value;
}
item.setText(str);
}.bind(this);