[Gtk-sharp-list] TreeCellDataFunc: How often and why?

Adam Williams awilliam at whitemice.org
Wed May 2 22:34:35 EDT 2007


> > I assume this is not a difficult thing, but could not figure out how
> > to do it! 
> > Any help would be greatly appreciated! 
> Check out EmitRowChanged on Gtk.TreeModel (which TreeStore implements).
> Docs:  http://go-mono.org/docs/monodoc.ashx?link=T%3aGtk.TreeModel%2f*

Here is one thing I haven't quite figured out yet:

I have a -
(a) ListStore initialized like: taskStore = new ListStore(typeof(Task));
(b) Objects added to ListStore like: taskStore.AppendValues(task);
(c) Columns in TreeViews are rendered using rendering functions,  setup
like -

  column = new Gtk.TreeViewColumn ();
  column.Title = "Object Id";
  cell = new Gtk.CellRendererText ();
  column.PackStart(cell, true);
  column.SetCellDataFunc(cell, 
  new Gtk.TreeCellDataFunc(RenderObjectId));
  _view.AppendColumn(column);
    etc...

(d) This ListStore is added to three TreeModelFilters each of which is
addred to a a TreeView;  so we see this ListStore three times in the
application each through a separate TreeModelFilter.

This works **GREAT**!

But each of these Task objects can be updated by a server, and upon
update they emit a signal.  But how does one go about connecting the
signal from the contained object to the EmitRowChanged(TreePath,
TreeIter)?  The object has no idea what it's path or iter is,  and I
don't see a way to ask the store "Hey, what is the path for this
object?".  

Do I need to save the TreeIter I get when I Append() and keep it
associated with the object:  hashtable.Add(task,
taskStore.AppendValues(task)) and use an intermediary to receive the
change event from task, lookup the Iter, and signal the ListStore?




More information about the Gtk-sharp-list mailing list