View previous topic :: View next topic |
Author |
Message |
bkropf
Joined: 28 Oct 2008 Posts: 6
|
Posted: Wed May 06, 2009 9:43 pm Post subject: using TreeModelFilter? |
|
|
I'm trying to figure out how to use a TreeModelFilter and not having much luck. I'm including a pretty minimal example that segfaults for me, but I don't see any reason why it should (the segfault happens in the setVisibleFunc method). I'm using gdc and tango on ubuntu amd64
Code: |
import gtk.Main;
import gtk.Window;
import gtk.TreeView;
import gtk.TreeModelFilter;
import gtk.ListStore;
extern(C) int onFilterTree(GtkTreeModel* tree, GtkTreeIter* iter, void* data) {
return true;
}
int main(char[][] args) {
Main.init(args);
Window window = new Window("TreeView Example");
TreeView tree = new TreeView();
window.add(tree);
ListStore musicListStore = new ListStore([ GType.STRING, GType.STRING ]);
TreeModelFilter filter = cast(TreeModelFilter)TreeModelFilter.newTreeModelFilter(musicListStore, null);
filter.setVisibleFunc(&onFilterTree, null, null);
tree.setModel(filter);
tree.setModel(musicListStore);
window.addOnHide(delegate void(Widget w) { Main.exit(0); });
window.showAll;
Main.run();
return 0;
}
|
|
|
Back to top |
|
|
Mike Wey
Joined: 07 May 2007 Posts: 428
|
Posted: Thu May 07, 2009 3:48 pm Post subject: |
|
|
Fixed in svn r680.
The constructor for gtk.TreeModelFilter wasn't wrapped correctly, the following should now work:
Code: | TreeModelFilter filter = new TreeModelFilter(musicListStore, null); |
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|