mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-11 03:10:09 +00:00
GtkAccelLabel: Don't show "+" if there's no more keys to add
With the following code: #define INVALID_CHAR GDK_KEY_VoidSymbol - 1 gtk_accelerator_get_label (INVALID_CHAR, GDK_SHIFT_MASK | GDK_CONTROL_MASK); we would get this label: Shift+Ctrl+ instead of this label: Shift+Ctrl https://bugzilla.gnome.org/show_bug.cgi?id=694075
This commit is contained in:
parent
5dbf814f0c
commit
3c8a4126a8
@ -836,12 +836,13 @@ _gtk_accel_label_class_get_accelerator_label (GtkAccelLabelClass *klass,
|
|||||||
#endif
|
#endif
|
||||||
seen_mod = TRUE;
|
seen_mod = TRUE;
|
||||||
}
|
}
|
||||||
if (seen_mod)
|
|
||||||
g_string_append (gstring, klass->mod_separator);
|
|
||||||
|
|
||||||
ch = gdk_keyval_to_unicode (accelerator_key);
|
ch = gdk_keyval_to_unicode (accelerator_key);
|
||||||
if (ch && ch < 0x80 && (g_unichar_isgraph (ch) || ch == ' '))
|
if (ch && ch < 0x80 && (g_unichar_isgraph (ch) || ch == ' '))
|
||||||
{
|
{
|
||||||
|
if (seen_mod)
|
||||||
|
g_string_append (gstring, klass->mod_separator);
|
||||||
|
|
||||||
switch (ch)
|
switch (ch)
|
||||||
{
|
{
|
||||||
case ' ':
|
case ' ':
|
||||||
@ -862,6 +863,9 @@ _gtk_accel_label_class_get_accelerator_label (GtkAccelLabelClass *klass,
|
|||||||
tmp = gdk_keyval_name (gdk_keyval_to_lower (accelerator_key));
|
tmp = gdk_keyval_name (gdk_keyval_to_lower (accelerator_key));
|
||||||
if (tmp != NULL)
|
if (tmp != NULL)
|
||||||
{
|
{
|
||||||
|
if (seen_mod)
|
||||||
|
g_string_append (gstring, klass->mod_separator);
|
||||||
|
|
||||||
if (tmp[0] != 0 && tmp[1] == 0)
|
if (tmp[0] != 0 && tmp[1] == 0)
|
||||||
g_string_append_c (gstring, g_ascii_toupper (tmp[0]));
|
g_string_append_c (gstring, g_ascii_toupper (tmp[0]));
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user