Re: Key-value file parser, howto get all groups and create loop from them



On Mon, 14 Aug 2006, Lance Dillon wrote:

The problem is your code doesn't seem to initialize iter in any way. Before you call make_list, you should probably do something like this:

No, no. make_list() by itself is fine. It sets its local iter in every iteration through the call to gtk_list_store_append().

The problem is that the global treedata.iter doesn't get set by the call to make_list().

If it /had/ been a call-by-reference parameter, then it would have been set to point to the last item in the model (which is perhaps also not what Rupert wanted but at least /something/ would happen).

gtk_tree_model_get_iter_first(treedata.store,treedata.iter);

This initializes iter to the beginning of the treemodel.
Then you can call make_list().

1) Not necessary at all before calling make_list().
2) might be nice anyway -- but after calling make_list or perhaps inside the callback function.

But actually, the real question is: why keep a global iterator around in the first place?

-Peter



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]