Add daemon autoconnecting on startup

This commit is contained in:
Andrew Resch 2009-03-25 18:01:16 +00:00
parent 7c1d16a51c
commit 8373377c10
1 changed files with 15 additions and 5 deletions

View File

@ -218,16 +218,26 @@ class GtkUI:
def _on_reactor_start(self): def _on_reactor_start(self):
log.debug("_on_reactor_start") 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"]: if self.config["classic_mode"]:
client.start_classic_mode() client.start_classic_mode()
component.start() component.start()
return 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): def __on_disconnect(self):
""" """
Called when disconnected from the daemon. We basically just stop all Called when disconnected from the daemon. We basically just stop all