mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-03-09 08:58:27 +03:00
i18n: show localized accelerators in Send key menu
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. Reviewed-by: Cole Robinson <crobinso@redhat.com> Signed-off-by: Pino Toscano <ptoscano@redhat.com>
This commit is contained in:
parent
353351458a
commit
8872e1e962
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user