summaryrefslogtreecommitdiff
path: root/gtk/gtkaccellabel.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2004-02-24 22:59:51 +0000
committerOwen Taylor <otaylor@src.gnome.org>2004-02-24 22:59:51 +0000
commitb435c31d754b26b5a54a7086ce03281ac9bf86ce (patch)
tree49c98015a43bd4568b1f7364b117c9fe223cbd1c /gtk/gtkaccellabel.c
parent89a877800a4488e11552a14011ef78dcb4d6d688 (diff)
downloadgdk-pixbuf-b435c31d754b26b5a54a7086ce03281ac9bf86ce.tar.gz
Convert underscores in keyval names to spaces. (#131480)
Tue Feb 24 17:51:49 2004 Owen Taylor <otaylor@redhat.com> * gtk/gtkaccellabel.c (gtk_accel_label_refetch): Convert underscores in keyval names to spaces. (#131480)
Diffstat (limited to 'gtk/gtkaccellabel.c')
-rw-r--r--gtk/gtkaccellabel.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gtk/gtkaccellabel.c b/gtk/gtkaccellabel.c
index 5af947a45..86b993a66 100644
--- a/gtk/gtkaccellabel.c
+++ b/gtk/gtkaccellabel.c
@@ -503,6 +503,19 @@ gtk_accel_label_get_string (GtkAccelLabel *accel_label)
return accel_label->accel_string;
}
+/* Underscores in key names are better displayed as spaces
+ * E.g., Page_Up should be "Page Up"
+ */
+static void
+substitute_underscores (char *str)
+{
+ char *p;
+
+ for (p = str; *p; p++)
+ if (*p == '_')
+ *p = ' ';
+}
+
gboolean
gtk_accel_label_refetch (GtkAccelLabel *accel_label)
{
@@ -577,6 +590,7 @@ gtk_accel_label_refetch (GtkAccelLabel *accel_label)
tmp = gtk_accelerator_name (key->accel_key, 0);
if (tmp[0] != 0 && tmp[1] == 0)
tmp[0] = g_ascii_toupper (tmp[0]);
+ substitute_underscores (tmp);
g_string_append (gstring, tmp);
g_free (tmp);
}