Re: Programmer's criticism of GTK2
- From: Jonathan Blandford <jrb redhat com>
- To: Maxim Koshelev <max krascoal ru>
- Cc: gtk-app-devel-list gtk org
- Subject: Re: Programmer's criticism of GTK2
- Date: 18 Mar 2002 00:53:59 -0500
Maxim Koshelev <max krascoal ru> writes:
Jonathan Blandford wrote:
And again, I repeat myself. All stored iters of a GtkListStore or
GtkTreeStore should _not_ become invalid after a change in the model.
They're only invalid when the row they point to is removed.
Before writing such statement try to write some code or look inside GTK2!!!!
Look to structure of iterator:
I wrote the widget.
struct _GtkTreeIter{
gint stamp;
gpointer user_data;
gpointer user_data2;
gpointer user_data3;
};
also look to first strings of
gtk_list_store_remove (GtkListStore *list_store, GtkTreeIter *iter){
...
g_return_if_fail (VALID_ITER (iter, list_store));
...
there is apropriate define:
#define VALID_ITER(iter, list_store) (iter!= NULL && iter->user_data
!= NULL && list_store->stamp == iter->stamp)
....
That is correct. The stamp is set once per instance of a tree, and
never changed. This test is to make sure that you're passing in an iter
that belongs to that list, and not uninitialized data, an iter belonging
to another model, or NULL.
I still don't understand what your problem with iters is. There's
nothing wrong with doing:
GtkTreeIter *iter = g_new (GtkTreeIter, 1);
gtk_tree_model_get_iter (list_store, iter, path);
/* lots of changes to the tree that do not involve deleting that
* particular row */
gtk_tree_model_get (list_store, iter, ...);
Thanks,
-Jonathan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]