[gnome-control-center] keyboard: Use NULL rather than "" to disable keybindings



commit 2dbcb26f16348db8d2e5461ce22fafd50acbb11e
Author: Christophe Fergeau <cfergeau redhat com>
Date:   Sat Jun 28 12:52:46 2014 +0200

    keyboard: Use NULL rather than "" to disable keybindings
    
    When disabling a keybinding, we set its value to { "", NULL } in gsettings
    (bindings are stored as arrays of strings).
    However, when a binding is disabled by default, its value is set to {
    NULL }, not to the empty string.
    
    The use of "" dates back to gconf where I think NULL was not a valid
    value. Now that we have switched to gsettings, we can use NULL rather
    than an artificial "".
    
    https://bugzilla.gnome.org/show_bug.cgi?id=732383

 panels/keyboard/keyboard-shortcuts.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/panels/keyboard/keyboard-shortcuts.c b/panels/keyboard/keyboard-shortcuts.c
index 7b37932..4dfd573 100644
--- a/panels/keyboard/keyboard-shortcuts.c
+++ b/panels/keyboard/keyboard-shortcuts.c
@@ -1214,7 +1214,7 @@ binding_name (guint                   keyval,
         gtk_accelerator_get_label_with_keycode (NULL, keyval, keycode, mask) :
         gtk_accelerator_name_with_keycode (NULL, keyval, keycode, mask);
   else
-    return g_strdup (translate ? _("Disabled") : "");
+    return g_strdup (translate ? _("Disabled") : NULL);
 }
 
 static gboolean
@@ -1489,7 +1489,7 @@ handle_reverse_item (CcKeyboardItem        *item,
 
           if (reverse_conflict_item != NULL)
             g_object_set (G_OBJECT (reverse_conflict_item),
-                          "binding", "", NULL);
+                          "binding", NULL, NULL);
         }
       else
         {
@@ -1504,7 +1504,7 @@ handle_reverse_item (CcKeyboardItem        *item,
             {
               g_warn_if_fail (conflict_item == reverse_item);
               g_object_set (G_OBJECT (conflict_item),
-                            "binding", "", NULL);
+                            "binding", NULL, NULL);
             }
         }
     }
@@ -1568,7 +1568,7 @@ accel_edited_callback (GtkCellRendererText   *cell,
 
       if (response == GTK_RESPONSE_ACCEPT)
         {
-         g_object_set (G_OBJECT (conflict_item), "binding", "", NULL);
+         g_object_set (G_OBJECT (conflict_item), "binding", NULL, NULL);
 
           str = binding_name (keyval, keycode, mask, FALSE);
           g_object_set (G_OBJECT (item), "binding", str, NULL);
@@ -1622,7 +1622,7 @@ accel_cleared_callback (GtkCellRendererText *cell,
     return;
 
   /* Unset the key */
-  g_object_set (G_OBJECT (item), "binding", "", NULL);
+  g_object_set (G_OBJECT (item), "binding", NULL, NULL);
 }
 
 static gchar *


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