From 101cae03f3ae3f74d0cfc64280f19e9ad23345ac Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Fri, 16 Jul 2021 12:44:19 +0200 Subject: [PATCH] core: Handle mixture of keycombo/no action in pad rings/strips When generating the action label, we expect both directions of these features to have consistent settings (either both get a keycombo, or they don't) or these just return NULL altogether. Since one of the directions has an action associated, this is misleading, so be more lenient at the time of generating the action label. Part-of: --- src/core/meta-pad-action-mapper.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/core/meta-pad-action-mapper.c b/src/core/meta-pad-action-mapper.c index 7c78c4014..88634c32c 100644 --- a/src/core/meta-pad-action-mapper.c +++ b/src/core/meta-pad-action-mapper.c @@ -704,12 +704,18 @@ compose_directional_action_label (GSettings *direction1, GSettings *direction2) { char *accel1, *accel2, *str = NULL; + /* TRANSLATORS: This is a (non) action on an input device gadget */ + const char *none_label = N_("None"); accel1 = g_settings_get_string (direction1, "keybinding"); accel2 = g_settings_get_string (direction2, "keybinding"); - if (accel1 && *accel1 && accel2 && *accel2) - str = g_strdup_printf ("%s / %s", accel1, accel2); + if ((accel1 && *accel1) || (accel2 && *accel2)) + { + str = g_strdup_printf ("%s / %s", + (accel1 && *accel1) ? accel1 : _(none_label), + (accel2 && *accel2) ? accel2 : _(none_label)); + } g_free (accel1); g_free (accel2);