WIP: transtyper model de GtkTreeStore en GtkTreeIter ? (ligne 96)

This commit is contained in:
Jean Sirmai 2023-12-16 10:38:34 +01:00
parent 3b5b5585d5
commit c00e97b4bd
Signed by: jean
GPG Key ID: FB3115C340E057E3
1 changed files with 8 additions and 6 deletions

View File

@ -69,13 +69,15 @@ static TreeItem A[] = {{ "C", C }, { "D", D }, { NULL }};
static TreeItem R[] = {{ "A", A }, { "B", B }, { NULL }}; static TreeItem R[] = {{ "A", A }, { "B", B }, { NULL }};
static TreeItem O[] = {{ "R", R }, { NULL }}; // Artefact added for symetry static TreeItem O[] = {{ "R", R }, { NULL }}; // Artefact added for symetry
// iterate_node(model, item_0, item_1, &iter, &child_iter);
static GtkTreeModel * static GtkTreeModel *
iterate_node(GtkTreeStore *model, iterate_node(GtkTreeStore *model,
TreeItem *item_parent, TreeItem *item_children, TreeItem *item_parent, TreeItem *item_children,
GtkTreeIter *iter_parent, GtkTreeIter *iter_children) GtkTreeIter iter_parent, GtkTreeIter iter_children)
{ { printf("parent, children : %s -> %s %p -> %p %p -> %p %p -> %p %p -> %p\n",\
printf("parent, children : %s -> %s %p -> %p %p -> %p\n",\
item_parent->label, item_children->label,\ item_parent->label, item_children->label,\
item_parent, item_children,
&item_parent, &item_children,
iter_parent, iter_children, iter_parent, iter_children,
&iter_parent, &iter_children); &iter_parent, &iter_children);
/* gtk_tree_store_append (model, &iter_children, &iter_parent); */ /* gtk_tree_store_append (model, &iter_children, &iter_parent); */
@ -91,21 +93,21 @@ create_model (void)
TreeItem *item_0 = O->children; TreeItem *item_0 = O->children;
while (item_0->label) { while (item_0->label) {
GtkTreeIter iter; GtkTreeIter iter;
iterate_node(model, O, item_0, model, &iter); // iterate_node(model, O, item_0, (GtkTreeIter) model, iter);
gtk_tree_store_append (model, &iter, NULL); gtk_tree_store_append (model, &iter, NULL);
gtk_tree_store_set (model, &iter, COLUMN_0, item_0->label, -1); gtk_tree_store_set (model, &iter, COLUMN_0, item_0->label, -1);
TreeItem *item_1 = item_0->children; TreeItem *item_1 = item_0->children;
while (item_1->label) { while (item_1->label) {
GtkTreeIter child_iter; GtkTreeIter child_iter;
iterate_node(model, item_0, item_1, &iter, &child_iter); iterate_node(model, item_0, item_1, iter, child_iter);
gtk_tree_store_append (model, &child_iter, &iter); gtk_tree_store_append (model, &child_iter, &iter);
gtk_tree_store_set (model, &child_iter, COLUMN_0, item_1->label, -1); gtk_tree_store_set (model, &child_iter, COLUMN_0, item_1->label, -1);
TreeItem *item_2 = item_1->children; TreeItem *item_2 = item_1->children;
while (item_2->label) { while (item_2->label) {
GtkTreeIter child_child_iter; GtkTreeIter child_child_iter;
iterate_node(model, item_1, item_2, &child_iter, &child_child_iter); iterate_node(model, item_1, item_2, child_iter, child_child_iter);
gtk_tree_store_append (model, &child_child_iter, &child_iter); gtk_tree_store_append (model, &child_child_iter, &child_iter);
gtk_tree_store_set (model, &child_child_iter, COLUMN_0, item_2->label, -1); gtk_tree_store_set (model, &child_child_iter, COLUMN_0, item_2->label, -1);