WIP: on_bind_cb() Bind data from the store object to the widget << adapting from the kriptolix example

This commit is contained in:
Jean Sirmai 2024-02-07 13:41:55 +01:00
parent cfa46b6a2a
commit 7bd92fad23
Signed by: jean
GPG Key ID: FB3115C340E057E3
1 changed files with 10 additions and 5 deletions

View File

@ -56,12 +56,17 @@ static void on_setup_cb (GtkSignalListItemFactory *self, GtkListItem *my_list_it
}
static void on_bind_cb (GtkSignalListItemFactory *self, GtkListItem *my_list_item, gpointer user_data)
/* Bind data from the store object to the widget << adapting from the kriptolix example */
{
GtkWidget *my_label = gtk_list_item_get_child (my_list_item);
/* my_string_object is owned by the instance. Caller mustn't change or destroy it. */
GtkStringObject *my_string_object = gtk_list_item_get_item (my_list_item);
/* The string returned by gtk_string_object_get_string is owned by the instance. */
gtk_label_set_text (GTK_LABEL (my_label), gtk_string_object_get_string (my_string_object));
GtkWidget *my_expander = gtk_expander_new (NULL);
gtk_expander_set_child (GTK_EXPANDER(my_expander), gtk_list_item_get_child (my_list_item));
GtkWidget *my_label = gtk_list_item_get_child (my_list_item);
/* my_string_object is owned by the instance. Caller mustn't change or destroy it. */
GtkStringObject *my_string_object = gtk_list_item_get_item (my_list_item);
/* The string returned by gtk_string_object_get_string is owned by the instance. */
gtk_label_set_text (GTK_LABEL (my_label), gtk_string_object_get_string (my_string_object));
}
static void on_selection_change (GtkStringList *my_selection_model, guint position, guint n_items, gpointer user_data)