1 --- gnome-control-center-2.28.1/capplets/keybindings/gnome-keybinding-properties.c 2 +++ gnome-control-center-2.28.1/capplets/keybindings/gnome-keybinding-properties.c 3 @@ -522,11 +522,10 @@ find_section (GtkTreeModel *model, 4 GtkTreeIter *iter, 5 const char *title) 6 { 7 - gboolean success, found; 8 + gboolean success; 9 10 - found = FALSE; 11 success = gtk_tree_model_get_iter_first (model, iter); 12 - while (success && !found) 13 + while (success) 14 { 15 char *description = NULL; 16 17 @@ -534,16 +533,15 @@ find_section (GtkTreeModel *model, 18 DESCRIPTION_COLUMN, &description, 19 -1); 20 21 - found = (g_strcmp0 (description, title) == 0); 22 + if (g_strcmp0 (description, title) == 0) 23 + return; 24 success = gtk_tree_model_iter_next (model, iter); 25 } 26 - if (!found) 27 - { 28 - gtk_tree_store_append (GTK_TREE_STORE (model), iter, NULL); 29 - gtk_tree_store_set (GTK_TREE_STORE (model), iter, 30 - DESCRIPTION_COLUMN, title, 31 - -1); 32 - } 33 + 34 + gtk_tree_store_append (GTK_TREE_STORE (model), iter, NULL); 35 + gtk_tree_store_set (GTK_TREE_STORE (model), iter, 36 + DESCRIPTION_COLUMN, title, 37 + -1); 38 } 39 40 static void 41 @@ -555,7 +553,6 @@ append_keys_to_tree (GtkBuilder *builder, 42 GtkTreeIter parent_iter, iter; 43 GtkTreeModel *model; 44 gint i, j; 45 - gint rows_before; 46 47 client = gconf_client_get_default (); 48 model = gtk_tree_view_get_model (GTK_TREE_VIEW (gtk_builder_get_object (builder, "shortcut_treeview"))); 49 @@ -571,7 +568,6 @@ append_keys_to_tree (GtkBuilder *builder, 50 * then we need to scroll now */ 51 ensure_scrollbar (builder, i - 1); 52 53 - rows_before = i; 54 for (j = 0; keys_list[j].name != NULL; j++) 55 { 56 GConfEntry *entry; 57 @@ -689,7 +685,7 @@ append_keys_to_tree (GtkBuilder *builder, 58 g_object_unref (client); 59 60 /* Don't show an empty section */ 61 - if (i == rows_before) 62 + if (gtk_tree_model_iter_n_children (model, &parent_iter) == 0) 63 gtk_tree_store_remove (GTK_TREE_STORE (model), &parent_iter); 64 65 if (i == 0) 66 @@ -868,7 +868,7 @@ append_keys_to_tree_from_file (GtkBuilder *builder, 67 /* If there's no keys to add, or the settings apply to a window manager 68 * that's not the one we're running */ 69 if (keylist->entries->len == 0 70 - || (keylist->wm_name != NULL && strv_contains (wm_keybindings, keylist->wm_name)) 71 + || (keylist->wm_name != NULL && !strv_contains (wm_keybindings, keylist->wm_name)) 72 || keylist->name == NULL) 73 { 74 g_free (keylist->name); 75 --- gnome-control-center-2.28.1/capplets/common/wm-common.c 76 +++ gnome-control-center-2.28.1/capplets/common/wm-common.c 77 @@ -27,7 +27,7 @@ wm_common_get_window_manager_property (Atom atom) 78 guchar *val; 79 80 if (wm_window == None) 81 - return g_strdup (WM_COMMON_UNKNOWN); 82 + return NULL; 83 84 utf8_string = XInternAtom (GDK_DISPLAY (), "UTF8_STRING", False); 85 86 @@ -46,7 +46,7 @@ wm_common_get_window_manager_property (Atom atom) 87 type != utf8_string || format != 8 || nitems == 0 || 88 !g_utf8_validate (val, nitems, NULL)) 89 { 90 - retval = g_strdup (WM_COMMON_UNKNOWN); 91 + retval = NULL; 92 } 93 else 94 { 95 @@ -93,7 +93,7 @@ wm_common_get_current_keybindings (void) 96 char *wm_name = wm_common_get_window_manager_property (wm_atom); 97 char *to_copy[] = { NULL, NULL }; 98 99 - to_copy[0] = wm_name; 100 + to_copy[0] = wm_name ? wm_name : g_strdup (WM_COMMON_UNKNOWN); 101 102 results = g_strdupv (to_copy); 103 g_free (wm_name); 104