From 393f3d81ba7105efc60d3733acb933499f58fbd9 Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Wed, 31 Jan 2024 13:08:59 +0100 Subject: [PATCH] =?UTF-8?q?WIP:=20j'apprivoise=20:=20gtk=5Ftree=5Flist=5Fm?= =?UTF-8?q?odel=5Fnew(...)=20dans=20l'espoir=20d'ajouter=20des=20enfants?= =?UTF-8?q?=20=C3=A0=20des=20items=20de=20ma=20liste?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ui/sand_box.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/ui/sand_box.c b/src/ui/sand_box.c index b6898c5..e0675b5 100644 --- a/src/ui/sand_box.c +++ b/src/ui/sand_box.c @@ -67,9 +67,9 @@ static void on_selection_change (GtkStringList *my_selection_model, guint posit nombre d'éléments ayant changé d'état = %2d\n", g_list_model_get_n_items (G_LIST_MODEL (my_selection_model)), g_list_model_get_item_type(G_LIST_MODEL (my_selection_model)), - position, - gtk_string_list_get_string (my_selection_model, position), - n_items ); + position, "debug", 0); + /* gtk_string_list_get_string (my_selection_model, position), // GTK_STRING_LIST ? */ + /* n_items ); */ } //------------------------------------------------------------------------------------------------------------------------------------------- @@ -85,8 +85,8 @@ GListModel *my_item_create_func (gpointer item, gpointer user_data) if (strcmp(gtk_string_object_get_string(item), "zero")) { GtkWidget *my_expander = gtk_expander_new (NULL); - /* gtk_expander_set_child (GTK_EXPANDER(my_expander), NULL); */ - /* on_activating_this_expander (GTK_EXPANDER(my_expander), NULL); */ + gtk_expander_set_child (GTK_EXPANDER(my_expander), NULL); + on_activating_this_expander (GTK_EXPANDER(my_expander), NULL); return G_LIST_MODEL (my_child_string_list); } else return NULL; @@ -105,15 +105,15 @@ static void and_now_let_s_climb_that_tree (GtkWidget *in_that_box) GtkListItemFactory *my_list_item_factory = gtk_signal_list_item_factory_new (); g_signal_connect (my_list_item_factory, "setup", G_CALLBACK (on_setup_cb), NULL); g_signal_connect (my_list_item_factory, "bind", G_CALLBACK (on_bind_cb), NULL); - if (1) { g_signal_connect (G_LIST_MODEL (my_string_list), "selection-changed", G_CALLBACK (on_selection_change), NULL);} + if (1) { g_signal_connect (my_selection_model, "selection-changed", G_CALLBACK (on_selection_change), NULL);} // GListModel *(* GtkTreeListModelCreateModelFunc) (GObject* item, gpointer user_data) // remplacerait gtk_string_list_new() ? // https://docs.gtk.org/gtk4/callback.TreeListModelCreateModelFunc.html // https://docs.gtk.org/gtk4/method.TreeListRow.set_expanded.html - GtkTreeListModel *my_tree_list_model = gtk_tree_list_model_new (my_selection_model, 1, 1, my_item_create_func, NULL, NULL); - int rank = 0; printf("in : GListModel *item_create_func (gpointer item,...) (line 80) (item n°%d is %s)\n", + GtkTreeListModel *my_tree_list_model = gtk_tree_list_model_new (G_LIST_MODEL (my_string_list), 1, 0, my_item_create_func, NULL, NULL); // my_string_list my_selection_model + int rank = 1; printf("in : GListModel *item_create_func (gpointer item,...) (line 80) (item n°%d is %s)\n", rank, gtk_string_list_get_string (my_string_list, rank)); GtkWidget *my_list_view = gtk_list_view_new (GTK_SELECTION_MODEL (my_selection_model), my_list_item_factory);