[gnome-control-center] keyboard: Clear additional bindings when changing a shortcut



commit bd54cd1342f9a2804cfcc789edb79f7a213d5c76
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Aug 27 00:24:08 2013 +0200

    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 files changed, 2 insertions(+), 12 deletions(-)
---
diff --git a/panels/keyboard/cc-keyboard-item.c b/panels/keyboard/cc-keyboard-item.c
index d6f9938..e1558aa 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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]