MCPcopy Create free account
hub / github.com/coreboot/coreboot / update_tree

Function update_tree

util/kconfig/gconf.c:1245–1327  ·  view source on GitHub ↗

* Update the tree by adding/removing entries * Does not change other nodes */

Source from the content-addressed store, hash-verified

1243 * Does not change other nodes
1244 */
1245static void update_tree(struct menu *src, GtkTreeIter * dst)
1246{
1247 struct menu *child1;
1248 GtkTreeIter iter, tmp;
1249 GtkTreeIter *child2 = &iter;
1250 gboolean valid;
1251 GtkTreeIter *sibling;
1252 struct symbol *sym;
1253 struct menu *menu1, *menu2;
1254
1255 if (src == &rootmenu)
1256 indent = 1;
1257
1258 valid = gtk_tree_model_iter_children(model2, child2, dst);
1259 for (child1 = src->list; child1; child1 = child1->next) {
1260
1261 sym = child1->sym;
1262
1263 reparse:
1264 menu1 = child1;
1265 if (valid)
1266 gtk_tree_model_get(model2, child2, COL_MENU,
1267 &menu2, -1);
1268 else
1269 menu2 = NULL; // force adding of a first child
1270
1271#ifdef DEBUG
1272 printf("%*c%s | %s\n", indent, ' ',
1273 menu1 ? menu_get_prompt(menu1) : "nil",
1274 menu2 ? menu_get_prompt(menu2) : "nil");
1275#endif
1276
1277 if ((opt_mode == OPT_NORMAL && !menu_is_visible(child1)) ||
1278 (opt_mode == OPT_PROMPT && !menu_has_prompt(child1)) ||
1279 (opt_mode == OPT_ALL && !menu_get_prompt(child1))) {
1280
1281 /* remove node */
1282 if (gtktree_iter_find_node(dst, menu1) != NULL) {
1283 memcpy(&tmp, child2, sizeof(GtkTreeIter));
1284 valid = gtk_tree_model_iter_next(model2,
1285 child2);
1286 gtk_tree_store_remove(tree2, &tmp);
1287 if (!valid)
1288 return; /* next parent */
1289 else
1290 goto reparse; /* next child */
1291 } else
1292 continue;
1293 }
1294
1295 if (menu1 != menu2) {
1296 if (gtktree_iter_find_node(dst, menu1) == NULL) { // add node
1297 if (!valid && !menu2)
1298 sibling = NULL;
1299 else
1300 sibling = child2;
1301 gtk_tree_store_insert_before(tree2,
1302 child2,

Callers 3

renderer_editedFunction · 0.85
change_sym_valueFunction · 0.85
toggle_sym_valueFunction · 0.85

Calls 8

printfFunction · 0.85
menu_get_promptFunction · 0.85
menu_is_visibleFunction · 0.85
menu_has_promptFunction · 0.85
gtktree_iter_find_nodeFunction · 0.85
set_nodeFunction · 0.85
fill_rowFunction · 0.85
memcpyFunction · 0.50

Tested by

no test coverage detected