summaryrefslogtreecommitdiff
path: root/plugins/gtkui/hotkeys.c
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <waker@users.sourceforge.net>2013-10-13 15:38:47 +0200
committerGravatar Alexey Yakovenko <waker@users.sourceforge.net>2013-10-13 15:38:47 +0200
commit934a10b9a5ea67734a74a44361868654fc15297d (patch)
tree535ee399cf2a39c1aa608206faffaa71e10dd884 /plugins/gtkui/hotkeys.c
parent81eb75d90b8b963cadedbb5642e9030beac9828f (diff)
gtkui: prettified assigned hotkey action text
Diffstat (limited to 'plugins/gtkui/hotkeys.c')
-rw-r--r--plugins/gtkui/hotkeys.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/plugins/gtkui/hotkeys.c b/plugins/gtkui/hotkeys.c
index a8d4ee67..afe4197d 100644
--- a/plugins/gtkui/hotkeys.c
+++ b/plugins/gtkui/hotkeys.c
@@ -89,6 +89,27 @@ unescape_forward_slash (const char *src, char *dst, int size) {
*dst = 0;
}
+static void
+prettify_forward_slash (const char *src, char *dst, int size) {
+ char *start = dst;
+ const char arrow[] = " → ";
+ int larrow = strlen (arrow);
+ while (*src && size > 1) {
+ if (*src == '\\' && *(src+1) == '/') {
+ src++;
+ }
+ else if (*src == '/' && size > larrow) {
+ memcpy (dst, arrow, larrow);
+ src++;
+ dst += larrow;
+ size -= larrow;
+ continue;
+ }
+ *dst++ = *src++;
+ size--;
+ }
+ *dst = 0;
+}
static const char *
get_display_action_title (const char *title) {
@@ -463,7 +484,10 @@ set_button_action_label (const char *act, int action_ctx, GtkWidget *button) {
}
char s[200];
snprintf (s, sizeof (s), "%s%s%s", ctx_str ? ctx_str : "", ctx_str ? " ⇒ ": "", action->title);
- gtk_button_set_label (GTK_BUTTON (button), s);
+ char s_fixed[200];
+ prettify_forward_slash (s, s_fixed, sizeof (s_fixed));
+
+ gtk_button_set_label (GTK_BUTTON (button), s_fixed);
return;
}
}