From 1069e323e81e3dcb9ddb422233c753c7a9a02889 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Wed, 28 Jan 2009 12:01:15 +0000 Subject: [PATCH] Only print warnings for non-custom keybindings, Set the GConf key for the 2009-01-28 Bastien Nocera * gnome-keybinding-properties.c (append_keys_to_tree), (edit_custom_shortcut), (update_custom_shortcut): Only print warnings for non-custom keybindings, Set the GConf key for the description when editing existing custom key shortcuts, Avoid warnings when the description for a custom key shortcut is empty svn path=/trunk/; revision=9215 --- capplets/keybindings/ChangeLog | 9 ++++++++ .../keybindings/gnome-keybinding-properties.c | 23 ++++++++++++++----- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/capplets/keybindings/ChangeLog b/capplets/keybindings/ChangeLog index 2752230ec..3f41499da 100644 --- a/capplets/keybindings/ChangeLog +++ b/capplets/keybindings/ChangeLog @@ -1,3 +1,12 @@ +2009-01-28 Bastien Nocera + + * gnome-keybinding-properties.c (append_keys_to_tree), + (edit_custom_shortcut), (update_custom_shortcut): Only print + warnings for non-custom keybindings, Set the GConf key for + the description when editing existing custom key shortcuts, + Avoid warnings when the description for a custom key shortcut + is empty + 2009-01-28 Bastien Nocera * gnome-keybinding-properties.c (append_keys_to_tree): diff --git a/capplets/keybindings/gnome-keybinding-properties.c b/capplets/keybindings/gnome-keybinding-properties.c index 55f50339f..7807ebef3 100644 --- a/capplets/keybindings/gnome-keybinding-properties.c +++ b/capplets/keybindings/gnome-keybinding-properties.c @@ -608,7 +608,9 @@ append_keys_to_tree (GladeXML *dialog, if (description == NULL) { - g_warning ("No description for key '%s'", key_string); + /* Only print a warning for keys that should have a schema */ + if (keys_list[j].description_name == NULL) + g_warning ("No description for key '%s'", key_string); description = g_path_get_basename (key_string); } @@ -1373,9 +1375,9 @@ edit_custom_shortcut (KeyEntry *key) const gchar *text; gboolean ret; - gtk_entry_set_text (GTK_ENTRY (custom_shortcut_name_entry), key->description); + gtk_entry_set_text (GTK_ENTRY (custom_shortcut_name_entry), key->description ? key->description : ""); gtk_widget_set_sensitive (custom_shortcut_name_entry, key->desc_editable); - gtk_entry_set_text (GTK_ENTRY (custom_shortcut_command_entry), key->command); + gtk_entry_set_text (GTK_ENTRY (custom_shortcut_command_entry), key->command ? key->command : ""); gtk_widget_set_sensitive (custom_shortcut_command_entry, key->cmd_editable); gtk_window_present (GTK_WINDOW (custom_shortcut_dialog)); @@ -1456,10 +1458,19 @@ update_custom_shortcut (GtkTreeModel *model, GtkTreeIter *iter) edit_custom_shortcut (key); if (key->command == NULL || key->command[0] == '\0') - remove_custom_shortcut (model, iter); + { + remove_custom_shortcut (model, iter); + } else - gtk_tree_store_set (GTK_TREE_STORE (model), iter, - KEYENTRY_COLUMN, key, -1); + { + GConfClient *client; + + gtk_tree_store_set (GTK_TREE_STORE (model), iter, + KEYENTRY_COLUMN, key, -1); + client = gconf_client_get_default (); + gconf_client_set_string (client, key->desc_gconf_key, key->description, NULL); + g_object_unref (client); + } } static gchar *