R E C U R S I V E T R E E (cleaning + comments)

This commit is contained in:
Jean Sirmai 2023-12-18 18:54:58 +01:00
parent 705af8c187
commit 63f662ddc9
Signed by: jean
GPG Key ID: FB3115C340E057E3
1 changed files with 3 additions and 16 deletions

View File

@ -32,22 +32,7 @@
/*************************************************************************************************************************************/ /*************************************************************************************************************************************/
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // /* The GtkTreeStore is used to store data in tree form, to be used later on by a GtkTreeView to display it */
/******************************** S O M E L I T T L E T H I N G S T O K N O W **********************************/
/* */
/* gtk_tree_view_set_show_expanders (GTK_TREE_VIEW (treeview), TRUE); */
/* gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview), TRUE); */
/* gtk_widget_set_vexpand (treeview, TRUE); */
/* gtk_tree_view_set_reorderable (GTK_TREE_VIEW (treeview), TRUE); */
/* */
/*************************************************************************************************************************************/
/* The GtkTreeStore is used to store data in tree form, to be used later on by a GtkTreeView to display it.
* This demo builds a simple GtkTreeStore and displays it.
* If you're new to the GtkTreeView widgets and associates, look into the GtkListStore example first. */
#include <gtk/gtk.h> #include <gtk/gtk.h>
@ -81,6 +66,7 @@ static TreeItem A[] = {{"D", D}, {NULL}}, B[] = {{"E", E}, {NULL}};
static TreeItem R[] = {{"A", A}, {"B", B}, {"C", C}, {NULL}}; static TreeItem R[] = {{"A", A}, {"B", B}, {"C", C}, {NULL}};
static TreeItem O[] = {{"ROOT", R}, {NULL}}; // Artefact added for symmetry static TreeItem O[] = {{"ROOT", R}, {NULL}}; // Artefact added for symmetry
static GtkTreeModel *create_node_recursive (GtkTreeStore *model, static GtkTreeModel *create_node_recursive (GtkTreeStore *model,
TreeItem *current_item, TreeItem *current_item,
GtkTreeIter *iter_parent, GtkTreeIter *iter_parent,
@ -110,6 +96,7 @@ static GtkTreeModel *create_node_recursive (GtkTreeStore *model,
return NULL; return NULL;
} }
GtkWidget * GtkWidget *
do_tree_store (GtkWidget *do_widget) do_tree_store (GtkWidget *do_widget)
{ {