diff --git a/source/app.d b/source/app.d index 99584bf..850d9e7 100644 --- a/source/app.d +++ b/source/app.d @@ -159,29 +159,52 @@ void main(string[] args) }); buttonNewCol.addOnClicked((Button){ - auto store = cast(ListStore)tree.getModel(); - int newColIndex = store.getNColumns(); + auto oldstore = cast(ListStore)tree.getModel(); + int newColIndex = oldstore.getNColumns(); GType[] types; - foreach(i ; 0..newColIndex+1) - types~= store.getColumnType(i); - store.setColumnTypes(types); + string[] titles; + foreach(i ; 0..newColIndex){ + if(i==0)types~= GType.INT; + else types~= GType.STRING; + titles~= tree.getColumn(0).getTitle; + tree.removeColumn(tree.getColumn(0)); + } + types~=GType.STRING; + titles~="new_col"; - writeln(types.length); + writeln(types); + auto store = new ListStore(types); + tree.setModel(store); - //auto col = SetupColumn(tree, "new_col", newColIndex); + //setup cols + foreach(i ; 0..newColIndex+1){ + tree.appendColumn(SetupColumn(tree, titles[i], i)); + } + //Fill them + TreeIter oldit = new TreeIter(); + TreeIter newit = new TreeIter(); + if(oldstore.getIterFirst(oldit)){ + do{ + store.append(newit); - //TreeIter it = new TreeIter(); - //if(store.getIterFirst(it)){ - // do{ - // store.setValue(it, newColIndex, "_"); - // }while(store.iterNext(it)); - //} + foreach(i ; 0..newColIndex+1){ + if(i