From 6724424219ac31d1c2d90c332fb550efb6280203 Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Mon, 18 Dec 2023 15:46:50 +0100 Subject: [PATCH] manifest --- demos/gtk-demo/tree_store.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/demos/gtk-demo/tree_store.c b/demos/gtk-demo/tree_store.c index 69ae6fd..d7c56b9 100644 --- a/demos/gtk-demo/tree_store.c +++ b/demos/gtk-demo/tree_store.c @@ -89,15 +89,6 @@ static TreeItem A[] = {{ "C", C }, { "D", D }, { NULL }}; static TreeItem R[] = {{ "A", A }, { "B", B }, { NULL }}; // ROOT static TreeItem O[] = {{ "R", R }, { NULL }}; // Artefact added for symmetry -static void create_node (GtkTreeStore *model, - GtkTreeIter *iter_children, - TreeItem *item_children, - GtkTreeIter *iter_parent) -{ - gtk_tree_store_append (model, iter_children, iter_parent); - gtk_tree_store_set (model, iter_children, COLUMN_0, item_children->label, -1); -} - static GtkTreeStore create_node_recursive (GtkTreeStore *model, TreeItem *current_item) { TreeItem *item_children; @@ -116,6 +107,15 @@ static GtkTreeStore create_node_recursive (GtkTreeStore *model, TreeItem *curren return *model; } +static void create_node (GtkTreeStore *model, + GtkTreeIter *iter_children, + TreeItem *item_children, + GtkTreeIter *iter_parent) +{ + gtk_tree_store_append (model, iter_children, iter_parent); + gtk_tree_store_set (model, iter_children, COLUMN_0, item_children->label, -1); +} + static GtkTreeModel * create_model (void) { @@ -183,7 +183,7 @@ do_tree_store (GtkWidget *do_widget) GtkWidget *sw; GtkWidget *treeview; GtkTreeModel *tree_model; - //GtkTreeStore *tree_store; + GtkTreeStore *tree_store; /* create window, etc */ window = gtk_window_new (); @@ -209,15 +209,15 @@ do_tree_store (GtkWidget *do_widget) gtk_box_append (GTK_BOX (vbox), sw); /* create tree_model */ - // tree_model = create_model (); // GtkTreeStore *model = gtk_tree_store_new (NUM_COLUMNS, G_TYPE_STRING); - GtkTreeStore tree_store = create_node_recursive (gtk_tree_store_new (NUM_COLUMNS, G_TYPE_STRING), O); - // tree_model = create_node_recursive (tree_store, O); + tree_model = create_model (); // GtkTreeStore *model = gtk_tree_store_new (NUM_COLUMNS, G_TYPE_STRING); + /* tree_store = gtk_tree_store_new (NUM_COLUMNS, G_TYPE_STRING); */ + /* tree_model = create_node_recursive (*tree_store, O); */ /* create tree view */ - treeview = gtk_tree_view_new_with_model (&tree_store); + treeview = gtk_tree_view_new_with_model (tree_model); gtk_widget_set_vexpand (treeview, TRUE); gtk_tree_view_set_reorderable (GTK_TREE_VIEW (treeview), TRUE); - g_object_unref (&tree_store); + g_object_unref (tree_model); gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)), GTK_SELECTION_MULTIPLE);