From bd54cd1342f9a2804cfcc789edb79f7a213d5c76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Tue, 27 Aug 2013 00:24:08 +0200 Subject: 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 --- panels/keyboard/cc-keyboard-item.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'panels/keyboard/cc-keyboard-item.c') 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); -- cgit v1.2.1