From 8373377c105887cf17c07da304ff3b019f287509 Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Wed, 25 Mar 2009 18:01:16 +0000 Subject: [PATCH] Add daemon autoconnecting on startup --- deluge/ui/gtkui/gtkui.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/deluge/ui/gtkui/gtkui.py b/deluge/ui/gtkui/gtkui.py index 876e2f48e..d6167d9ee 100644 --- a/deluge/ui/gtkui/gtkui.py +++ b/deluge/ui/gtkui/gtkui.py @@ -218,16 +218,26 @@ class GtkUI: def _on_reactor_start(self): log.debug("_on_reactor_start") - if self.config["show_connection_manager_on_start"] and not self.config["classic_mode"]: - # XXX: We need to call a simulate() here, but this could be a bug in twisted - reactor.simulate() - self.connectionmanager.show() - if self.config["classic_mode"]: client.start_classic_mode() component.start() return + # Autoconnect to a host + if self.config["autoconnect"]: + for host in self.connectionmanager.config["hosts"]: + if host[0] == self.config["autoconnect_host_id"]: + def on_connect(connector): + component.start() + client.connect(*host[1:]).addCallback(on_connect) + + if self.config["show_connection_manager_on_start"]: + # XXX: We need to call a simulate() here, but this could be a bug in twisted + reactor.simulate() + self.connectionmanager.show() + + + def __on_disconnect(self): """ Called when disconnected from the daemon. We basically just stop all