diff options
author | Andrew Resch <andrewresch@gmail.com> | 2009-12-13 21:25:22 +0000 |
---|---|---|
committer | Andrew Resch <andrewresch@gmail.com> | 2009-12-13 21:25:22 +0000 |
commit | 8edd91a3d5f5f41ac2a7c2596e466aa5e1f01ce3 (patch) | |
tree | 76ff78ffba9ce1eb6a7b630ee0a227cfda34241a | |
parent | f6fdae727d01eff47acc394a6727eb5f84ad21f9 (diff) | |
download | deluge-8edd91a3d5f5f41ac2a7c2596e466aa5e1f01ce3.tar.gz deluge-8edd91a3d5f5f41ac2a7c2596e466aa5e1f01ce3.tar.bz2 deluge-8edd91a3d5f5f41ac2a7c2596e466aa5e1f01ce3.zip |
Add an error dialog when trying to add a duplicate host
Center the add host dialog over the connection manager
-rw-r--r-- | deluge/ui/gtkui/connectionmanager.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/deluge/ui/gtkui/connectionmanager.py b/deluge/ui/gtkui/connectionmanager.py index ca89524aa..a10eac804 100644 --- a/deluge/ui/gtkui/connectionmanager.py +++ b/deluge/ui/gtkui/connectionmanager.py @@ -459,7 +459,8 @@ class ConnectionManager(component.Component): def on_button_addhost_clicked(self, widget): log.debug("on_button_addhost_clicked") dialog = self.glade.get_widget("addhost_dialog") - dialog.set_icon(common.get_logo(16)) + dialog.set_transient_for(self.connection_manager) + dialog.set_position(gtk.WIN_POS_CENTER_ON_PARENT) hostname_entry = self.glade.get_widget("entry_hostname") port_spinbutton = self.glade.get_widget("spinbutton_port") username_entry = self.glade.get_widget("entry_username") @@ -471,8 +472,16 @@ class ConnectionManager(component.Component): hostname = hostname_entry.get_text() # We add the host - self.add_host(hostname, port_spinbutton.get_value_as_int(), username, password) - + try: + self.add_host(hostname, port_spinbutton.get_value_as_int(), username, password) + except Exception, e: + from deluge.ui.gtkui.dialogs import ErrorDialog + ErrorDialog(_("Error Adding Host"), e).run() + + username_entry.set_text("") + password_entry.set_text("") + hostname_entry.set_text("") + port_spinbutton.set_value(58846) dialog.hide() def on_button_removehost_clicked(self, widget): |