Skip to content

Commit

Permalink
#1252: re-use "connection modes" list to populate the drop down menu
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@13295 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Aug 10, 2016
1 parent 4b0d87a commit 6fb9dca
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions src/xpra/client/gtk_base/client_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,25 +111,29 @@ def raise_exception(*args):
self.client.init(self.config)
self.exit_code = None

def get_launcher_validation(self):
crypto_backend_init()
#TODO: since "mode" is not part of global options
#this validation should be injected from the launcher instead
MODES = ["tcp"]
def get_connection_modes(self):
modes = ["tcp"]
try:
import ssl
assert ssl
MODES.append("ssl")
modes.append("ssl")
except:
pass
if "AES" in ENCRYPTION_CIPHERS:
MODES.append("tcp + aes")
MODES.append("ssh")
modes.append("tcp + aes")
modes.append("ssh")
return modes

def get_launcher_validation(self):
crypto_backend_init()
#TODO: since "mode" is not part of global options
#this validation should be injected from the launcher instead
def validate_in_list(x, options):
if x in options:
return None
return "must be in %s" % (", ".join(options))
return {"mode" : lambda x : validate_in_list(x, MODES)}
modes = self.get_connection_modes()
return {"mode" : lambda x : validate_in_list(x, modes)}


def create_window(self):
Expand Down Expand Up @@ -188,11 +192,8 @@ def bug(*args):
hbox.set_spacing(20)
hbox.pack_start(gtk.Label("Mode: "))
self.mode_combo = gtk.combo_box_new_text()
#self.mode_combo.get_model().clear()
self.mode_combo.append_text("TCP")
if "AES" in ENCRYPTION_CIPHERS:
self.mode_combo.append_text("TCP + AES")
self.mode_combo.append_text("SSH")
for x in self.get_connection_modes():
self.mode_combo.append_text(x.upper())
self.mode_combo.connect("changed", self.mode_changed)
hbox.pack_start(self.mode_combo)
vbox.pack_start(hbox)
Expand Down

0 comments on commit 6fb9dca

Please sign in to comment.