From a49d558aaf8b1edf804edad61559ddff74135855 Mon Sep 17 00:00:00 2001 From: Chase Sterling Date: Sat, 11 May 2013 22:53:27 -0400 Subject: [PATCH] Add default localclient info to localhost items in gtk connection manager --- deluge/ui/gtkui/connectionmanager.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/deluge/ui/gtkui/connectionmanager.py b/deluge/ui/gtkui/connectionmanager.py index 04e80cc67..28eab091a 100644 --- a/deluge/ui/gtkui/connectionmanager.py +++ b/deluge/ui/gtkui/connectionmanager.py @@ -458,7 +458,7 @@ class ConnectionManager(component.Component): # If we're connected, we can stop the dameon self.builder.get_object("button_startdaemon").set_sensitive(True) elif user and passwd: - # In this case we also have all the info to shutdown the dameon + # In this case we also have all the info to shutdown the daemon self.builder.get_object("button_startdaemon").set_sensitive(True) else: # Can't stop non localhost daemons, specially without the necessary info @@ -607,6 +607,9 @@ class ConnectionManager(component.Component): password = password_entry.get_text() hostname = hostname_entry.get_text() + if (not password and not username or username == "localclient") and hostname in ["127.0.0.1", "localhost"]: + username, password = get_localhost_auth() + # We add the host try: self.add_host(hostname, port_spinbutton.get_value_as_int(), @@ -651,10 +654,17 @@ class ConnectionManager(component.Component): response = dialog.run() if response == 2: - self.liststore[row][HOSTLIST_COL_HOST] = hostname_entry.get_text() + username = username_entry.get_text() + password = password_entry.get_text() + hostname = hostname_entry.get_text() + + if (not password and not username or username == "localclient") and hostname in ["127.0.0.1", "localhost"]: + username, password = get_localhost_auth() + + self.liststore[row][HOSTLIST_COL_HOST] = hostname self.liststore[row][HOSTLIST_COL_PORT] = port_spinbutton.get_value_as_int() - self.liststore[row][HOSTLIST_COL_USER] = username_entry.get_text() - self.liststore[row][HOSTLIST_COL_PASS] = password_entry.get_text() + self.liststore[row][HOSTLIST_COL_USER] = username + self.liststore[row][HOSTLIST_COL_PASS] = password self.liststore[row][HOSTLIST_COL_STATUS] = "Offline" # Save the host list to file