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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2001>
This commit is contained in:
Carlos Garnacho 2021-07-16 12:44:19 +02:00 committed by Marge Bot
parent abecf557bf
commit 101cae03f3

View File

@ -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);