FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

using TreeModelFilter?

 
Post new topic   Reply to topic     Forum Index -> gtkD
View previous topic :: View next topic  
Author Message
bkropf



Joined: 28 Oct 2008
Posts: 6

PostPosted: Wed May 06, 2009 9:43 pm    Post subject: using TreeModelFilter? Reply with quote

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
View user's profile Send private message
Mike Wey



Joined: 07 May 2007
Posts: 428

PostPosted: Thu May 07, 2009 3:48 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> gtkD All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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