WIP: Comment accéder à la fonction : gtk_tree_view_new() ?

This commit is contained in:
Jean Sirmai 2023-11-13 23:49:24 +01:00
parent 355a6d4969
commit c4769fc5d9
Signed by: jean
GPG Key ID: FB3115C340E057E3
1 changed files with 29 additions and 2 deletions

View File

@ -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
}