summaryrefslogtreecommitdiffstats
path: root/actions/services/_ssh_tcp.py
diff options
context:
space:
mode:
authorSebastian Droege <slomo@ubuntu.com>2005-10-08 11:28:45 +0000
committerSebastian Droege <slomo@ubuntu.com>2005-10-08 11:28:45 +0000
commit753bdc888db6abe14d6324e22ebfa5053ce571de (patch)
tree75789490178f806f306656e57a104857f127c13f /actions/services/_ssh_tcp.py
parentbb1a5955f7c9169ae8125ef76acd8f6b1b1b7aec (diff)
* Polish the SSH login dialog:
+ Add a cancel button + Do nothing on cancel or dialog-closing + Close the dialog after every action git-svn-id: file:///home/lennart/svn/public/service-discovery-applet/trunk@61 3be567f1-68ff-0310-b24a-ad7cc433fd2f
Diffstat (limited to 'actions/services/_ssh_tcp.py')
-rw-r--r--actions/services/_ssh_tcp.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/actions/services/_ssh_tcp.py b/actions/services/_ssh_tcp.py
index 1465275..7660ea5 100644
--- a/actions/services/_ssh_tcp.py
+++ b/actions/services/_ssh_tcp.py
@@ -13,7 +13,8 @@ def SshLogin(hostname, username = None):
global win
win = gtk.Dialog("Ssh Connection", None,
gtk.DIALOG_MODAL,
- (gtk.STOCK_OK, gtk.RESPONSE_OK))
+ (gtk.STOCK_OK, gtk.RESPONSE_OK,
+ gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
vbox = gtk.VBox(False, 5)
win.vbox.pack_start(vbox, True, True, 0)
@@ -45,7 +46,12 @@ def SshLogin(hostname, username = None):
completion.set_text_column(0)
win.show_all()
- win.run()
+ if win.run() == gtk.RESPONSE_OK:
+ win.destroy()
+ return entry.get_text()
+ else:
+ win.destroy()
+ return None
return entry.get_text()
def __create_completion_model():
@@ -69,7 +75,9 @@ def _ssh_tcp(name, hostname, address, port, txts):
else:
username = SshLogin(name)
- if username != "":
+ if username == None:
+ return
+ elif username != "":
sshline = "ssh -l %s -p %i %s" % (username, port, address)
else:
sshline = "ssh -p %i %s" % (port, address)