From d5b7616f98fb7dccda19fc5d354bdc231c405adc Mon Sep 17 00:00:00 2001 From: Damien Churchill Date: Fri, 20 Mar 2009 19:20:07 +0000 Subject: [PATCH] if the client on the server is already connected skip the connection manager --- deluge/ui/web/js/deluge-connections.js | 17 +++++++++++++++-- deluge/ui/web/js/deluge-login.js | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/deluge/ui/web/js/deluge-connections.js b/deluge/ui/web/js/deluge-connections.js index f021d2905..dabdfc0a2 100644 --- a/deluge/ui/web/js/deluge-connections.js +++ b/deluge/ui/web/js/deluge-connections.js @@ -26,6 +26,18 @@ Deluge.Connections = { Deluge.Events.fire('disconnect'); }, + loginShow: function() { + Deluge.Client.web.connected({ + onSuccess: function(connected) { + if (connected) { + Deluge.Events.fire('connect'); + } else { + Deluge.Connections.Window.show(); + } + } + }); + }, + onAdd: function(button, e) { //Deluge.Connections.Add.show(); }, @@ -91,9 +103,10 @@ Deluge.Connections = { }); }, - runCheck: function() { + runCheck: function(callback) { + callback = $pick(callback, Deluge.Connections.onGetHosts); Deluge.Client.web.get_hosts({ - onSuccess: Deluge.Connections.onGetHosts + onSuccess: callback }); } } diff --git a/deluge/ui/web/js/deluge-login.js b/deluge/ui/web/js/deluge-login.js index 906bd0cd6..bfa10307b 100644 --- a/deluge/ui/web/js/deluge-login.js +++ b/deluge/ui/web/js/deluge-login.js @@ -28,7 +28,7 @@ Deluge.Login = { onSuccess: function(result) { if (result == true) { Deluge.Login.Window.hide(); - Deluge.Connections.Window.show(); + Deluge.Connections.loginShow(); passwordField.setRawValue(''); Deluge.Events.fire('login') } else {