diff options
author | Florian Müllner <fmuellner@gnome.org> | 2017-06-29 18:55:40 +0200 |
---|---|---|
committer | Georges Basile Stavracas Neto <georges.stavracas@gmail.com> | 2017-07-24 21:43:24 -0300 |
commit | 796981d39058e2cd12808d71f510f1d551123af9 (patch) | |
tree | ac2782b1e3f5a1ec01916e8e2d210d4238328ce1 | |
parent | f794fe6cfd20cc5218326abf867493143a5822d4 (diff) | |
download | gnome-control-center-796981d39058e2cd12808d71f510f1d551123af9.tar.gz |
keyboard: Special-case disabling of multi-bindings shortcuts
For shortcuts that support multiple bindings, the disabled state is
expressed as an empty list rather than a list with a single empty
element. While the latter certainly works as expected as far as the
actual keybinding is concerned, the shortcut will show up as modified
even if it is disabled by default. Explicitly setting bindings to the
empty list when a shortcut is disabled fixes this.
https://bugzilla.gnome.org/show_bug.cgi?id=784620
-rw-r--r-- | panels/keyboard/cc-keyboard-item.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/panels/keyboard/cc-keyboard-item.c b/panels/keyboard/cc-keyboard-item.c index f68d64a13..a970a18f6 100644 --- a/panels/keyboard/cc-keyboard-item.c +++ b/panels/keyboard/cc-keyboard-item.c @@ -131,13 +131,18 @@ settings_set_binding (GSettings *settings, g_settings_set_string (settings, key, value ? value : ""); else if (g_variant_is_of_type (variant, G_VARIANT_TYPE_STRING_ARRAY)) { - char **str_array = g_new0 (char *, 2); - - /* clear any additional bindings by only setting the first one */ - *str_array = g_strdup (value); - - g_settings_set_strv (settings, key, (const char * const *)str_array); - g_strfreev (str_array); + if (value == NULL || *value == '\0') + g_settings_set_strv (settings, key, NULL); + else + { + char **str_array = g_new0 (char *, 2); + + /* clear any additional bindings by only setting the first one */ + *str_array = g_strdup (value); + + g_settings_set_strv (settings, key, (const char * const *)str_array); + g_strfreev (str_array); + } } g_variant_unref (variant); |