ke, 2009-10-28 kello 16:55 -0700, Daniel B. Thurman kirjoitti: > How is it possible to bring up the gtk window first, > before loading your treestore, which might take > a long time?
I am not sure from your problem description which aspect is most troublesome for you, so I'll answer both I can think of. First, if it is going to take a long time, how are you intending to do it without the user interface freezing? There are two common approaches: either background threads or idle handlers. With background threds you start a new thread, it does whatever it needs to collect the data and add it to the treestore. This brings on all the problems of thread programming: you'll need to handle locking carefully, crashes are possibly inevitable and certainly mysterious, etc. In the idle handler case you register a callback with g_idle_add. The main loop calls the handler whenever it doesn't have anything better to do. The handler needs to do a little bit of work at a time, and then return; otherwise it freezes the main loop until it is done. In other words, the handler does not run in its own thread. The benefit is avoidance of threading related complexity, and the drawback is that it'll be slower. Second, to trigger threads or register idle handlers, you may be able to do this before calling gtk_main, or you can connect to the main window's map-event signal and trigger things from there. _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list