WIP: learning... cleaning... (no more)
This commit is contained in:
parent
97732da285
commit
9e1d54d469
Binary file not shown.
30
main.c
30
main.c
|
@ -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
|
// Recursive function to free a TreeNode and its children
|
||||||
void free_tree_node (struct TreeNode_t *node)
|
void free_tree_node (struct TreeNode_t *node)
|
||||||
{
|
{
|
||||||
|
@ -215,20 +226,7 @@ int main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
// Create a simple tree structure
|
// Create a simple tree structure
|
||||||
root = create_tree_node("Root");
|
root = create_tree_node("Root");
|
||||||
struct TreeNode_t *A = create_tree_node("A");
|
insert_data();
|
||||||
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);
|
|
||||||
|
|
||||||
GtkApplication *app = gtk_application_new("org.gtk.example", G_APPLICATION_FLAGS_NONE);
|
GtkApplication *app = gtk_application_new("org.gtk.example", G_APPLICATION_FLAGS_NONE);
|
||||||
g_signal_connect(app, "activate", G_CALLBACK(app_activate), NULL);
|
g_signal_connect(app, "activate", G_CALLBACK(app_activate), NULL);
|
||||||
|
@ -238,3 +236,7 @@ int main (int argc, char **argv)
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------
|
||||||
|
// guix shell -m manifest.scm && pkg-config --libs gtk4
|
||||||
|
// make clean && clear && make && ./gtk_treeview_example
|
||||||
|
|
Loading…
Reference in New Issue