From a1e4c51c9c3385f46ace6b5a95771338c2572e53 Mon Sep 17 00:00:00 2001 From: Damien Churchill Date: Wed, 28 Oct 2009 17:38:35 +0000 Subject: [PATCH] fix #990, showing 0 as a limit when it means unlimited in the statusbar --- deluge/ui/web/js/Deluge.Menus.js | 1 + deluge/ui/web/js/Deluge.Statusbar.js | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/deluge/ui/web/js/Deluge.Menus.js b/deluge/ui/web/js/Deluge.Menus.js index 3ede856bb..b4a3305d0 100644 --- a/deluge/ui/web/js/Deluge.Menus.js +++ b/deluge/ui/web/js/Deluge.Menus.js @@ -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(); diff --git a/deluge/ui/web/js/Deluge.Statusbar.js b/deluge/ui/web/js/Deluge.Statusbar.js index 642c875e5..1fd810d00 100644 --- a/deluge/ui/web/js/Deluge.Statusbar.js +++ b/deluge/ui/web/js/Deluge.Statusbar.js @@ -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);