diff --git a/hot.c b/hot.c index 6f0e1a6..735d8a0 100644 --- a/hot.c +++ b/hot.c @@ -91,6 +91,12 @@ static void add_child_node (struct TreeNode_t *parent, struct TreeNode_t *child) } 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 ()); 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); @@ -101,10 +107,16 @@ void create_experimental_tree (GtkBox *experimental_box){ g_signal_connect (hello, "activate", G_CALLBACK (on_experimental_expander_toggled), hello); gtk_box_append (experimental_box, GTK_WIDGET (hello)); - GtkExpander *it_s_me = GTK_EXPANDER (gtk_expander_new ("it's me !")); - gtk_expander_set_expanded (GTK_EXPANDER (it_s_me), FALSE); - gtk_widget_set_margin_start(GTK_WIDGET (it_s_me), 20); - g_signal_connect (it_s_me, "activate", G_CALLBACK (on_experimental_expander_toggled), it_s_me); - gtk_box_append (experimental_box, GTK_WIDGET (it_s_me)); + GtkTreeListModel *tree_model = gtk_tree_list_model_new( + G_LIST_MODEL (model), + FALSE, // Passthrough - False in actual usage with dynamic children retrieval + FALSE, // autoexpand + (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); } diff --git a/hot.o b/hot.o index 7a5af09..6471493 100644 Binary files a/hot.o and b/hot.o differ diff --git a/myprogram b/myprogram index 99ca84f..9e5030d 100755 Binary files a/myprogram and b/myprogram differ