Thanks,
Would storing TreeRowReference's be faster than
using:
my $iter = $model->get_iter_first;
while (defined $iter)
{
....
$iter = $model->iter_next($iter);
}
-----Original Message-----
From: gtk-perl-list-admin@xxxxxxxxx
[mailto:gtk-perl-list-admin@xxxxxxxxx] On Behalf Of muppet
Sent: Monday, March 29, 2004 3:25 PM
To: gtk-perl-list@xxxxxxxxx
Subject: Re: liststore update question
B McAndrews said:
> I have liststore setup with an appropriate view. The model was
> initially set with data from database. I can get updates from the
> database, but I'm unsure as to how I go about updating the model and
> subsequently the view. Rows won't be added or deleted, so I thought
> of something I could cache the iterators that were created at
> initialization, but I'm not sure that would work. Can anyone help me
> here?
The iters are not guaranteed long lifetimes, so you do not want to cache
them. Instead, you'd use a Gtk2::TreeRowReference, which is guaranteed
to point to the right place, even if the data in the list changes, so
long as the row exists.
http://developer.gnome.org/doc/API/2.0/gtk/GtkTreeModel.html#gtk-tree-ro
w-reference-new
and http://gtk2-perl.sourceforge.net/doc/pod/Gtk2/TreeRowReference.html
After that, as far as i know, when you do
$model->set ($iter, COL1 $val1, COL2, $val2, ...);
the view should update automatically, with no intervention from you. In
fact, i've been looking for a way to freeze/thaw the liststore during
large updates; i think $object->freeze_notify and thaw_notify are
supposed to work here.
--
muppet <scott at asofyet dot org>
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-perl-list
|