forked from AuroraMiddleware/gtk
Strip XF86 prefix from untranslated keysyms
When we don't have translations, at least remove the ugly XF86 prefix.
This commit is contained in:
parent
08f90b71a2
commit
b6783933c9
@ -600,7 +600,7 @@ gtk_accel_label_get_string (GtkAccelLabel *accel_label)
|
||||
* E.g., Page_Up should be "Page Up"
|
||||
*/
|
||||
static void
|
||||
substitute_underscores (char *str)
|
||||
substitute_underscores (gchar *str)
|
||||
{
|
||||
char *p;
|
||||
|
||||
@ -609,6 +609,20 @@ substitute_underscores (char *str)
|
||||
*p = ' ';
|
||||
}
|
||||
|
||||
/* Some keynames have prefixes that are not suitable
|
||||
* for display, e.g XF86AudioMute
|
||||
*/
|
||||
static gchar *
|
||||
strip_prefix (gchar *str)
|
||||
{
|
||||
if (g_str_has_prefix (str, "XF86"))
|
||||
return str + 4;
|
||||
else if (g_str_has_prefix (str, "ISO_"))
|
||||
return str + 4;
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
/* On Mac, if the key has symbolic representation (e.g. arrow keys),
|
||||
* append it to gstring and return TRUE; otherwise return FALSE.
|
||||
* See http://docs.info.apple.com/article.html?path=Mac/10.5/en/cdb_symbs.html
|
||||
@ -833,8 +847,9 @@ _gtk_accel_label_class_get_accelerator_label (GtkAccelLabelClass *klass,
|
||||
str = g_dpgettext2 (GETTEXT_PACKAGE, "keyboard label", tmp);
|
||||
if (str == tmp)
|
||||
{
|
||||
substitute_underscores (tmp);
|
||||
tmp = strip_prefix (tmp);
|
||||
g_string_append (gstring, tmp);
|
||||
substitute_underscores (gstring->str);
|
||||
}
|
||||
else
|
||||
g_string_append (gstring, str);
|
||||
|
Loading…
Reference in New Issue
Block a user