diff --git a/src/ui/tree.c b/src/ui/tree.c index 243c89c..c19a7a8 100644 --- a/src/ui/tree.c +++ b/src/ui/tree.c @@ -56,6 +56,37 @@ static GtkWidget *my_tree_view; static GListModel *my_list_model = NULL; +// view = gtk_list_view_new (model, factory); <<<<<< + +typedef struct _GtkSignalListItemFactory GtkSignalListItemFactory; +GtkListItemFactory *gtk_signal_list_item_factory_new (void); + + +// The “setup” signal is emitted when the factory needs to create a new row widget. +// g_signal_connect (factory, "setup", setup_listitem_cb, NULL); <<<<<< +// +// The “bind” signal is emitted when a row widget needs to be connected to an item from the model. +// g_signal_connect (factory, "bind", bind_listitem_cb, NULL); <<<<<< +// +// Both of these signals take a GtkListItem as argument, +// which is a wrapper object that lets you get at the model item (with gtk_list_item_get_item()) +// and also lets you deliver the new row widget (with gtk_list_item_set_child()). +// +// If your “bind” handler connects to signals on the item or does other things that require cleanup, +// you can use the “unbind” signal to do that cleanup. The “setup” signal has a similar counterpart called “teardown”. + +static void setup_listitem_cb (GtkListItemFactory *factory, GtkListItem *list_item) +{ + GtkWidget *label = gtk_label_new (""); + gtk_list_item_set_child (list_item, label); +} + +// user_function can be : setup, bind, unbind or teardown +// Parameters : self, The GtkSignalListItemFactory, listitem, The GtkListItem to bind, +// user_data : user data set when the signal handler was connected. +// Flags: Run First +static void user_function (GtkSignalListItemFactory *self, GtkListItem *listitem, gpointer user_data) {} + //------------------------------------------------------------------------------ // guix shell -m manifest.scm make clean && clear && time make run