[Gtk-sharp-list] what is best approach to update model for TreeView?

danieru samuraidanieru at gmail.com
Wed Mar 25 18:10:16 EDT 2009

I'm a beginner with GTK and I'm off to a good start w/ the various tutorials
and some answers from this mailing list, thanks! I've got the basics down
for connecting a TreeView to a ListStore, and populating the model with
data, so now I have a couple of questions that I'm hoping for help with, but
first a little info on my project:

I have a separate thread that's processing tasks, then we need to see these
updates in the TreeView. I understand the MVC concept, and that I modify the
model, and the TreeView will reflect those changes.

So, the questions:

1. I understand that I should let the GTK main loop thread handle GUI
changes; I've been doing this with the invoke method, but does this rule
apply to the model that is tied to the TreeView as well?  Should my queue
thread ask the GTK loop thread to make all the changes to the model, or can
the queue thread make the changes and the GTK main loop will auto-notice
them and update the treeview?

2. In connection with question one, are there any extra steps I need to take
to notify the GTK main loop?  I've looked through the ListStore methods and
I'm seeing methods like 'EmitRowChanged', etc. These would seem to imply
that the GTK main loop won't notice these changes...and maybe that my queue
thread can change the model, but I'm not sure.

3. I want to be able to perform actions based on a unique ID in my data
rows, remove them, update them, etc. What methods/approaches are good for
this with GTK, both from the user side (e.g. capturing the row that the user
clicked on), or from the program side (e.g. remove row with unique ID 'x')?

View this message in context: http://www.nabble.com/what-is-best-approach-to-update-model-for-TreeView--tp22709706p22709706.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.

More information about the Gtk-sharp-list mailing list