The Birdfont Source Code


All Repositories / birdfont.git / blobdiff – RSS feed

Move key binding string to tool item

Changes made to libbirdfont/ToolItem.vala

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
--- libbirdfont/ToolItem.vala +++ libbirdfont/ToolItem.vala @@ -26,8 +26,40 @@ action.connect (() => { tool.select_action (tool); }); + } + + public string get_key_binding () { + StringBuilder sb = new StringBuilder (); + + if (key == '\0') { + return "".dup (); + } + + if ((modifiers & CTRL) > 0) { + sb.append ("Ctrl"); + sb.append ("+"); + } + + if ((modifiers & SHIFT) > 0) { + sb.append (t_("Shift")); + sb.append ("+"); + } + + if ((modifiers & ALT) > 0) { + sb.append ("Alt"); + sb.append ("+"); + } + + if ((modifiers & LOGO) > 0) { + sb.append ("Super"); + sb.append ("+"); + } + + sb.append_unichar (key); + + return sb.str; } } }