From c716633286e4bbdadf3ceb9f490359f4ce27e228 Mon Sep 17 00:00:00 2001 From: Matthias Bolte Date: Sat, 28 Aug 2010 19:44:30 +0200 Subject: [PATCH] Make enter-key trigger the okay button in the auth dialog If the dialog contains multiple entries then only hitting the enter-key in the last entry triggers the okay button. From all other entries the enter-key lets the focus jump to the next entry. --- src/virtManager/connection.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/virtManager/connection.py b/src/virtManager/connection.py index ec43b40c5..4cdcc5262 100644 --- a/src/virtManager/connection.py +++ b/src/virtManager/connection.py @@ -894,6 +894,14 @@ class vmmConnection(gobject.GObject): box.set_row_spacings(6) box.set_col_spacings(12) + def _on_ent_activate(ent): + idx = entry.index(ent) + + if idx < len(entry) - 1: + entry[idx + 1].grab_focus() + else: + dialog.response(gtk.RESPONSE_OK) + row = 0 for cred in creds: if (cred[0] == libvirt.VIR_CRED_AUTHNAME or @@ -912,6 +920,7 @@ class vmmConnection(gobject.GObject): ent = gtk.Entry() if cred[0] == libvirt.VIR_CRED_PASSPHRASE: ent.set_visibility(False) + ent.connect("activate", _on_ent_activate) entry.append(ent) box.attach(label[row], 0, 1, row, row+1, gtk.FILL, 0, 0, 0)