diff options
-rwxr-xr-x | actions/services/__init__.py.in | 15 | ||||
-rw-r--r-- | actions/services/_ssh_tcp.py | 14 |
2 files changed, 22 insertions, 7 deletions
diff --git a/actions/services/__init__.py.in b/actions/services/__init__.py.in index 5f19e26..db70c8c 100755 --- a/actions/services/__init__.py.in +++ b/actions/services/__init__.py.in @@ -107,7 +107,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) @@ -139,8 +140,12 @@ def SshLogin(hostname, username = None): completion.set_text_column(0) win.show_all() - win.run() - return entry.get_text() + if win.run() == gtk.RESPONSE_OK: + win.destroy() + return entry.get_text() + else: + win.destroy() + return None def __create_completion_model(): ''' Creates a tree model containing the completions. @@ -163,7 +168,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) 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) |