diff options
author | Florian Müllner <fmuellner@gnome.org> | 2013-08-27 00:24:08 +0200 |
---|---|---|
committer | Florian Müllner <fmuellner@gnome.org> | 2017-07-10 19:29:43 +0200 |
commit | bd54cd1342f9a2804cfcc789edb79f7a213d5c76 (patch) | |
tree | c800a5dc98e66f03e02b81b9989aa0665f53c659 /panels/keyboard/cc-keyboard-item.c | |
parent | db551f1c5d53fbff262ea033fce53e2bb9765679 (diff) | |
download | gnome-control-center-bd54cd1342f9a2804cfcc789edb79f7a213d5c76.tar.gz |
keyboard: Clear additional bindings when changing a shortcut
Some shortcuts allow multiple bindings for the same actions, which
we mainly use to keep supporting old settings when changing defaults.
Multiple bindings are not exposed in the interface though, so when
changing a shortcut with multiple bindings, we previously only updated
the first one and left additional bindings untouched. This is confusing
however, precisely because additional bindings are not shown in the
UI - for instance, this makes it impossible to actually disable
such a shortcut completely. The less confusing option is to clear
any additional bindings when changing a shortcut.
https://bugzilla.gnome.org/show_bug.cgi?id=673078
Diffstat (limited to 'panels/keyboard/cc-keyboard-item.c')
-rw-r--r-- | panels/keyboard/cc-keyboard-item.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/panels/keyboard/cc-keyboard-item.c b/panels/keyboard/cc-keyboard-item.c index d6f9938d6..e1558aa46 100644 --- a/panels/keyboard/cc-keyboard-item.c +++ b/panels/keyboard/cc-keyboard-item.c @@ -136,19 +136,9 @@ 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; + char **str_array = g_new0 (char *, 2); - str_array = g_variant_dup_strv (variant, NULL); - - /* create a space for the new binding if empty */ - if (*str_array == NULL) - { - g_free (str_array); - str_array = g_new0 (char *, 2); - } - - /* replace the first binding */ - g_free (*str_array); + /* 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); |