[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[virt-tools-list] [PATCH] virt-manager: Make enter-key trigger the okay button in the auth dialog



Patch attached.

Matthias
# HG changeset patch
# User Matthias Bolte <matthias bolte googlemail com>
# Date 1283017470 -7200
# Node ID 9d7eca1dbe0b9cef861eae95e32fc15d72bade65
# Parent  ae14f22afee1e16d63610dfbe5b035e0499053d4
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.

diff -r ae14f22afee1 -r 9d7eca1dbe0b src/virtManager/connection.py
--- a/src/virtManager/connection.py	Thu Aug 26 08:45:28 2010 -0400
+++ b/src/virtManager/connection.py	Sat Aug 28 19:44:30 2010 +0200
@@ -894,6 +894,14 @@
         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 @@
             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)

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]