diff options
author | Matthias Clasen <mclasen@redhat.com> | 2005-06-13 19:09:06 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2005-06-13 19:09:06 +0000 |
commit | 9962a15cbaf36b29c2a20a52faf731e913fe6715 (patch) | |
tree | bf52ce869d95344d082e05abe4fcda43c36d5fa7 /gtk/gtkaccellabel.c | |
parent | 7c885b9057e46f9f3c92ffb91795ce1d4d1995e3 (diff) | |
download | gtk+-9962a15cbaf36b29c2a20a52faf731e913fe6715.tar.gz |
Try harder not to modify readonly strings. (#307541, Torsten Schoenfeld)
2005-06-13 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkaccellabel.c (_gtk_accel_label_class_get_accelerator_label):
Try harder not to modify readonly strings. (#307541, Torsten Schoenfeld)
Diffstat (limited to 'gtk/gtkaccellabel.c')
-rw-r--r-- | gtk/gtkaccellabel.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/gtk/gtkaccellabel.c b/gtk/gtkaccellabel.c index cca5d342f9..cafd022018 100644 --- a/gtk/gtkaccellabel.c +++ b/gtk/gtkaccellabel.c @@ -590,25 +590,27 @@ _gtk_accel_label_class_get_accelerator_label (GtkAccelLabelClass *klass, gchar *tmp; tmp = gdk_keyval_name (gdk_keyval_to_lower (accelerator_key)); - if (tmp == NULL) - tmp = ""; - else if (tmp[0] != 0 && tmp[1] == 0) - tmp[0] = g_ascii_toupper (tmp[0]); - else + if (tmp != NULL) { - gchar msg[128]; - gchar *str; - - strcpy (msg, "keyboard label|"); - g_strlcat (msg, tmp, 128); - str = dgettext (GETTEXT_PACKAGE, msg); - if (str == msg) - substitute_underscores (tmp); + if (tmp[0] != 0 && tmp[1] == 0) + g_string_append_c (gstring, g_ascii_toupper (tmp[0])); else - tmp = str; + { + gchar msg[128]; + gchar *str; + + strcpy (msg, "keyboard label|"); + g_strlcat (msg, tmp, 128); + str = dgettext (GETTEXT_PACKAGE, msg); + if (str == msg) + { + g_string_append (gstring, tmp); + substitute_underscores (gstring->str); + } + else + g_string_append (gstring, str); + } } - - g_string_append (gstring, tmp); } return g_string_free (gstring, FALSE); |