This commit is contained in:
Jean Sirmai 2024-02-01 23:22:28 +01:00
parent 6c7b70103c
commit f8aa2caa76
Signed by: jean
GPG Key ID: FB3115C340E057E3
1 changed files with 5 additions and 3 deletions

View File

@ -46,7 +46,7 @@ void on_activate_window_creation (GtkApplication *app, gpointer data)
static void on_setup_cb (GtkSignalListItemFactory *self, GtkListItem *my_list_item, gpointer user_data) static void on_setup_cb (GtkSignalListItemFactory *self, GtkListItem *my_list_item, gpointer user_data)
{ {
GtkWidget *my_label = gtk_label_new ("here am I"); // <<< compare with : gtk_label_new("..."); !! GtkWidget *my_label = gtk_label_new ("here am I"); // <<< compare with : gtk_label_editable_new("..."); !!
if (1) // some condition on parent and child, I presume. if (1) // some condition on parent and child, I presume.
gtk_list_item_set_child (my_list_item, my_label); // releasing (unref) isn't necessary for my_label. gtk_list_item_set_child (my_list_item, my_label); // releasing (unref) isn't necessary for my_label.
} }
@ -62,6 +62,7 @@ static void on_bind_cb (GtkSignalListItemFactory *self, GtkListItem *my_list_ite
static void on_selection_change (GtkStringList *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("(line 65) gtk_tree_list_row_get_position (GtkTreeListRow* self) = %d\n", gtk_tree_list_row_get_position (my_selection_model));
printf("list size = %d item type = %ld\ printf("list size = %d item type = %ld\
position (premier élement ayant changé d'état) = %2d %7s\ position (premier élement ayant changé d'état) = %2d %7s\
nombre d'éléments ayant changé d'état = %2d\n", nombre d'éléments ayant changé d'état = %2d\n",
@ -112,7 +113,6 @@ static void and_now_let_s_climb_that_tree (GtkWidget *in_that_box)
g_signal_connect (my_list_item_factory, "bind", G_CALLBACK (on_bind_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 (my_selection_model, "selection-changed", G_CALLBACK (on_selection_change), NULL);}
// https://docs.gtk.org/gtk4/callback.TreeListModelCreateModelFunc.html // https://docs.gtk.org/gtk4/callback.TreeListModelCreateModelFunc.html
// https://docs.gtk.org/gtk4/method.TreeListRow.set_expanded.html // https://docs.gtk.org/gtk4/method.TreeListRow.set_expanded.html
@ -157,6 +157,8 @@ static void and_now_let_s_climb_that_tree (GtkWidget *in_that_box)
if (strcmp(gtk_string_object_get_string (my_item_string), "two")) if (strcmp(gtk_string_object_get_string (my_item_string), "two"))
gtk_list_item_set_child (my_list_item, my_item_string); gtk_list_item_set_child (my_list_item, my_item_string);
// Because gtk_list_item_set_child sunk the floating reference of my_label, releasing (unref) isn't necessary for my_label. // Because gtk_list_item_set_child sunk the floating reference of my_label, releasing (unref) isn't necessary for my_label.
}*/ }
// guint xx = gtk_tree_list_row_get_position (GtkTreeListRow* self);
*/