diff options
author | Bastien Nocera <hadess@hadess.net> | 2013-02-18 11:59:26 +0100 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2013-02-18 18:00:44 +0100 |
commit | 3c8a4126a897b032eda6c7baa287ebe94c9e5736 (patch) | |
tree | 311d93276d9a9b43a2b960c8ff9d73ca46261215 /gtk/gtkaccellabel.c | |
parent | 5dbf814f0c0c94733ef96d6dc3c8c5ddb7a63f3a (diff) | |
download | gtk+-3c8a4126a897b032eda6c7baa287ebe94c9e5736.tar.gz |
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
Diffstat (limited to 'gtk/gtkaccellabel.c')
-rw-r--r-- | gtk/gtkaccellabel.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gtk/gtkaccellabel.c b/gtk/gtkaccellabel.c index 311b4a4d7f..d8bb7e96fa 100644 --- a/gtk/gtkaccellabel.c +++ b/gtk/gtkaccellabel.c @@ -836,12 +836,13 @@ _gtk_accel_label_class_get_accelerator_label (GtkAccelLabelClass *klass, #endif seen_mod = TRUE; } - if (seen_mod) - g_string_append (gstring, klass->mod_separator); ch = gdk_keyval_to_unicode (accelerator_key); if (ch && ch < 0x80 && (g_unichar_isgraph (ch) || ch == ' ')) { + if (seen_mod) + g_string_append (gstring, klass->mod_separator); + switch (ch) { case ' ': @@ -862,6 +863,9 @@ _gtk_accel_label_class_get_accelerator_label (GtkAccelLabelClass *klass, tmp = gdk_keyval_name (gdk_keyval_to_lower (accelerator_key)); if (tmp != NULL) { + if (seen_mod) + g_string_append (gstring, klass->mod_separator); + if (tmp[0] != 0 && tmp[1] == 0) g_string_append_c (gstring, g_ascii_toupper (tmp[0])); else |