WIP: learning... cleaning... (no more)

This commit is contained in:
Jean Sirmai 2024-02-16 08:32:56 +01:00
parent 97732da285
commit 9e1d54d469
Signed by: jean
GPG Key ID: FB3115C340E057E3
2 changed files with 16 additions and 14 deletions

Binary file not shown.

30
main.c
View File

@ -48,6 +48,17 @@ void add_child_node (struct TreeNode_t *parent, struct TreeNode_t *child)
}
}
static insert_data() // (TreeNode_t *root)
{
struct TreeNode_t *A = create_tree_node("A"); add_child_node(root, A);
struct TreeNode_t *B = create_tree_node("B"); add_child_node(A, B);
struct TreeNode_t *C = create_tree_node("C"); add_child_node(B, C);
struct TreeNode_t *D = create_tree_node("D"); add_child_node(C, D);
struct TreeNode_t *E = create_tree_node("E"); add_child_node(D, E);
struct TreeNode_t *F = create_tree_node("F"); add_child_node(E, E);
struct TreeNode_t *G = create_tree_node("G"); add_child_node(E, A);
}
// Recursive function to free a TreeNode and its children
void free_tree_node (struct TreeNode_t *node)
{
@ -215,20 +226,7 @@ int main (int argc, char **argv)
{
// Create a simple tree structure
root = create_tree_node("Root");
struct TreeNode_t *A = create_tree_node("A");
struct TreeNode_t *B = create_tree_node("B");
struct TreeNode_t *C = create_tree_node("C");
struct TreeNode_t *D = create_tree_node("D");
struct TreeNode_t *E = create_tree_node("E");
struct TreeNode_t *F = create_tree_node("F");
struct TreeNode_t *G = create_tree_node("G");
add_child_node(root, A);
add_child_node(A, B);
add_child_node(B, C);
add_child_node(C, D);
add_child_node(D, E);
add_child_node(E, E);
add_child_node(E, A);
insert_data();
GtkApplication *app = gtk_application_new("org.gtk.example", G_APPLICATION_FLAGS_NONE);
g_signal_connect(app, "activate", G_CALLBACK(app_activate), NULL);
@ -238,3 +236,7 @@ int main (int argc, char **argv)
return status;
}
//----------------------------------------------------------------------------------------
// guix shell -m manifest.scm && pkg-config --libs gtk4
// make clean && clear && make && ./gtk_treeview_example