From c4769fc5d91683ce48d527ed87afa3847f05980e Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Mon, 13 Nov 2023 23:49:24 +0100 Subject: [PATCH] =?UTF-8?q?WIP:=20Comment=20acc=C3=A9der=20=C3=A0=20la=20f?= =?UTF-8?q?onction=20:=20gtk=5Ftree=5Fview=5Fnew()=20=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ui/tree.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/src/ui/tree.c b/src/ui/tree.c index 5185f88..a4a71f8 100644 --- a/src/ui/tree.c +++ b/src/ui/tree.c @@ -71,8 +71,35 @@ create_and_fill_model (void) void Hello(void) { GtkWidget *view; // = gtk_tree_view_new (); - printf("Hello, from src/ui/tree.c ! -------------------------\n"); - return NULL; + GtkCellRenderer *renderer = gtk_cell_renderer_text_new (); + + gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (view), + -1, + "Name", + renderer, + "text", COL_NAME, + NULL); + + /* --- Column #2 --- */ + renderer = gtk_cell_renderer_text_new (); + gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (view), + -1, + "Age", + renderer, + "text", COL_AGE, + NULL); + + GtkTreeModel *model = create_and_fill_model (); + + + printf(" Hello, from src/ui/tree.c ! ----------------------------------------------------------\n\ + Remplacer la ligne 73 par : GtkWidget *view = gtk_tree_view_new ();\n\ + provoque une erreur de segmentation.\n\ + La méthode suivie est d'insèrer progressivement des fragments de l'exemple suivant :\n\ + For the impatient, here is a small tree view ‘Hello World’ program:\n\ + https :// docs.gtk.org/gtk3/treeview-tutorial.html \n\ + > Pourquoi cette erreur de segmentation ? <\n"); + return NULL;q }