diff --git a/src/ui/sand_box.c b/src/ui/sand_box.c index 14db78c..b6898c5 100644 --- a/src/ui/sand_box.c +++ b/src/ui/sand_box.c @@ -60,13 +60,13 @@ static void on_bind_cb (GtkSignalListItemFactory *self, GtkListItem *my_list_ite gtk_label_set_text (GTK_LABEL (my_label), gtk_string_object_get_string (my_string_object)); } -static void on_selection_change (GtkSelectionModel* my_selection_model, guint position, guint n_items, gpointer user_data) +static void on_selection_change (GtkStringList *my_selection_model, guint position, guint n_items, gpointer user_data) { printf("list size = %d item type = %ld\ position (premier élement ayant changé d'état) = %2d %7s\ nombre d'éléments ayant changé d'état = %2d\n", - g_list_model_get_n_items (my_selection_model), - g_list_model_get_item_type(my_selection_model), + 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 ); @@ -74,19 +74,20 @@ static void on_selection_change (GtkSelectionModel* my_selection_model, guint p //------------------------------------------------------------------------------------------------------------------------------------------- -void on_activating_this_expander (GtkExpander *my_expander, gpointer my_data) {printf("on_activating > %s\n", gtk_string_object_get_string (my_expander));} -void gtk_expander_set_child (GtkExpander* expander, GtkWidget* child) {printf("gtk_expander_set_child () %s\n", gtk_string_object_get_string (child));} +void on_activating_this_expander (GtkExpander *my_expander, gpointer my_data) {printf("on_activating exp. > %s\n", gtk_string_object_get_string (GTK_STRING_OBJECT(my_expander)));} +void gtk_expander_set_child (GtkExpander* expander, GtkWidget* child) {printf("gtk_expander_set_child () %s\n", gtk_string_object_get_string (GTK_STRING_OBJECT(child)));} GListModel *my_item_create_func (gpointer item, gpointer user_data) { printf("%s ", gtk_string_object_get_string(item)); gchar *my_child_array[] = {"1", "2", "3", NULL}; + GtkStringList *my_child_string_list = gtk_string_list_new ((const char * const *) my_child_array); - if (gtk_string_object_get_string(item) == "zero") { - GtkWidget *my_expander = gtk_expander_new (my_child_array); - gtk_expander_set_child (my_expander, NULL); - on_activating_this_expander (my_expander, NULL); - return my_child_array; + 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); */ + return G_LIST_MODEL (my_child_string_list); } else return NULL; } @@ -99,12 +100,12 @@ static void and_now_let_s_climb_that_tree (GtkWidget *in_that_box) GtkMultiSelection *my_selection_model = gtk_multi_selection_new (G_LIST_MODEL (my_string_list)); /* if (gtk_single_selection_get_selected_item (my_selection_model)) */ - /* gtk_selection_model_selection_changed (my_selection_model, 0, 1); */ + /* gtk_selection_model_selection_changed (my_selection_model, 0, 1); */ 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 (my_selection_model, "selection-changed", G_CALLBACK (on_selection_change), NULL);} + if (1) { g_signal_connect (G_LIST_MODEL (my_string_list), "selection-changed", G_CALLBACK (on_selection_change), NULL);} // GListModel *(* GtkTreeListModelCreateModelFunc) (GObject* item, gpointer user_data) // remplacerait gtk_string_list_new() ?