un micro commit intermédiaire

This commit is contained in:
Jean Sirmai 2024-05-16 17:29:11 +02:00
parent 6e2594085a
commit 64e1948351
Signed by: jean
GPG Key ID: FB3115C340E057E3
3 changed files with 17 additions and 5 deletions

22
hot.c
View File

@ -91,6 +91,12 @@ static void add_child_node (struct TreeNode_t *parent, struct TreeNode_t *child)
} }
void create_experimental_tree (GtkBox *experimental_box){ void create_experimental_tree (GtkBox *experimental_box){
struct TreeNode_t *tree_root = create_tree_node("hello");
struct TreeNode_t *child = create_tree_node("it's me");
add_child_node(tree_root, child);
GtkStringList *model = gtk_string_list_new(NULL);
gtk_string_list_append (model, tree_root->text);
GtkSignalListItemFactory *factory = GTK_SIGNAL_LIST_ITEM_FACTORY (gtk_signal_list_item_factory_new ()); GtkSignalListItemFactory *factory = GTK_SIGNAL_LIST_ITEM_FACTORY (gtk_signal_list_item_factory_new ());
g_signal_connect (factory, "setup", G_CALLBACK(on_experimental_tree_setup_factory), NULL); g_signal_connect (factory, "setup", G_CALLBACK(on_experimental_tree_setup_factory), NULL);
g_signal_connect (factory, "bind", G_CALLBACK(on_experimental_tree_bind_factory), NULL); g_signal_connect (factory, "bind", G_CALLBACK(on_experimental_tree_bind_factory), NULL);
@ -101,10 +107,16 @@ void create_experimental_tree (GtkBox *experimental_box){
g_signal_connect (hello, "activate", G_CALLBACK (on_experimental_expander_toggled), hello); g_signal_connect (hello, "activate", G_CALLBACK (on_experimental_expander_toggled), hello);
gtk_box_append (experimental_box, GTK_WIDGET (hello)); gtk_box_append (experimental_box, GTK_WIDGET (hello));
GtkExpander *it_s_me = GTK_EXPANDER (gtk_expander_new ("it's me !")); GtkTreeListModel *tree_model = gtk_tree_list_model_new(
gtk_expander_set_expanded (GTK_EXPANDER (it_s_me), FALSE); G_LIST_MODEL (model),
gtk_widget_set_margin_start(GTK_WIDGET (it_s_me), 20); FALSE, // Passthrough - False in actual usage with dynamic children retrieval
g_signal_connect (it_s_me, "activate", G_CALLBACK (on_experimental_expander_toggled), it_s_me); FALSE, // autoexpand
gtk_box_append (experimental_box, GTK_WIDGET (it_s_me)); (GtkTreeListModelCreateModelFunc)ui_experimental_tree_create_model_func,
tree_root,
NULL // (GDestroyNotify) free_tree_node
);
GtkSingleSelection *selection_model = gtk_single_selection_new (G_LIST_MODEL (tree_model));
gtk_single_selection_set_autoselect (selection_model, FALSE);
gtk_single_selection_set_can_unselect (selection_model, TRUE);
} }

BIN
hot.o

Binary file not shown.

BIN
myprogram

Binary file not shown.