[virt-manager PATCH 11/16] i18n: show localized accelerators in Send key menu

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

 



Turn the menu labels into GTK accelerator strings, so we can parse them
to convert them into a proper user representation.

There is a small behaviour change: the menu items do not have mnemonics
anymore by default.

Signed-off-by: Pino Toscano <ptoscano@xxxxxxxxxx>
---
 virtManager/details/console.py | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/virtManager/details/console.py b/virtManager/details/console.py
index ae9b85ed..062a019c 100644
--- a/virtManager/details/console.py
+++ b/virtManager/details/console.py
@@ -105,21 +105,22 @@ class _TimedRevealer(vmmGObject):
 def build_keycombo_menu(on_send_key_fn):
     menu = Gtk.Menu()
 
-    def make_item(name, combo):
-        item = Gtk.MenuItem.new_with_mnemonic(name)
+    def make_item(accel, combo):
+        name = Gtk.accelerator_get_label(*Gtk.accelerator_parse(accel))
+        item = Gtk.MenuItem(name)
         item.connect("activate", on_send_key_fn, combo)
 
         menu.add(item)
 
-    make_item("Ctrl+Alt+_Backspace", ["Control_L", "Alt_L", "BackSpace"])
-    make_item("Ctrl+Alt+_Delete", ["Control_L", "Alt_L", "Delete"])
+    make_item("<Control><Alt>BackSpace", ["Control_L", "Alt_L", "BackSpace"])
+    make_item("<Control><Alt>Delete", ["Control_L", "Alt_L", "Delete"])
     menu.add(Gtk.SeparatorMenuItem())
 
     for i in range(1, 13):
-        make_item("Ctrl+Alt+F_%d" % i, ["Control_L", "Alt_L", "F%d" % i])
+        make_item("<Control><Alt>F%d" % i, ["Control_L", "Alt_L", "F%d" % i])
     menu.add(Gtk.SeparatorMenuItem())
 
-    make_item("_Printscreen", ["Print"])
+    make_item("Print", ["Print"])
 
     menu.show_all()
     return menu
-- 
2.26.2




[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux