diff --git a/demos/gtk-demo/tree_store.c b/demos/gtk-demo/tree_store.c index 7837b6e..fda6319 100644 --- a/demos/gtk-demo/tree_store.c +++ b/demos/gtk-demo/tree_store.c @@ -53,9 +53,16 @@ enum }; /* tree data */ -static TreeItem D[] = {{ "I", NULL }, { "J", NULL }, { "K", NULL }, { NULL }}; -static TreeItem C[] = {{ "H", NULL }, { NULL }}; -static TreeItem B[] = {{ "E", NULL }, { "F", NULL }, { "G", NULL }, { NULL }}; +static TreeItem K[] = { NULL }; +static TreeItem J[] = { NULL }; +static TreeItem I[] = { NULL }; +static TreeItem H[] = { NULL }; +static TreeItem G[] = { NULL }; +static TreeItem F[] = { NULL }; +static TreeItem E[] = { NULL }; +static TreeItem D[] = {{ "I", I }, { "J", J }, { "K", K }, { NULL }}; +static TreeItem C[] = {{ "H", H }, { NULL }}; +static TreeItem B[] = {{ "E", E }, { "F", F }, { "G", G }, { NULL }}; static TreeItem A[] = {{ "C", C }, { "D", D }, { NULL }}; static TreeItem R[] = {{ "A", A }, { "B", B }, { NULL }}; @@ -66,10 +73,8 @@ create_model (void) GtkTreeIter iter; TreeItem *item_0 = R; - /* create tree store */ model = gtk_tree_store_new (NUM_COLUMNS, G_TYPE_STRING); - /* add data to the tree store */ while (item_0->label) { TreeItem *item_1 = item_0->children; @@ -77,7 +82,6 @@ create_model (void) gtk_tree_store_append (model, &iter, NULL); gtk_tree_store_set (model, &iter, COLUMN_0, item_0->label, -1); - /* add children */ while (item_1->label) { GtkTreeIter child_iter; @@ -86,9 +90,7 @@ create_model (void) gtk_tree_store_set (model, &child_iter, COLUMN_0, item_1->label, -1); TreeItem *item_2 = item_1->children; - if (item_1->children) while (item_2->label) { - //printf("while (item_1->label) item_1->label = %s item_2->label = %s\n", item_1->label, item_2->label); GtkTreeIter child_child_iter; gtk_tree_store_append (model, &child_child_iter, &child_iter); gtk_tree_store_set (model, &child_child_iter, COLUMN_0, item_2->label, -1); @@ -114,6 +116,7 @@ add_columns (GtkTreeView *treeview) gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview), -1, "Col 0", renderer, "text", COLUMN_0, NULL); + /* WE DON'T NEED A SECOND COLUMN UNTILL WE WANT TO REPRESENT LEAVES */ /* renderer = gtk_cell_renderer_text_new (); g_object_set (renderer, "xalign", 0.0, NULL); */ /* gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview), -1, */ /* "Col 1", renderer, "text", COLUMN_1, NULL); */