Re: Fwd: GtkTreeView, GtkListStore and more...
- From: Iago Rubio <iago iagorubio com>
- To: gtk-app-devel-list gnome org
- Subject: Re: Fwd: GtkTreeView, GtkListStore and more...
- Date: Fri, 18 Aug 2006 11:20:29 +0200
On Thu, 2006-08-17 at 18:34 +0200, Fernando ApesteguÃa wrote:
Thanks,
[snip fixed stuff]
Can you point me to an example on how to traverse a GtkListStore?
/* ##### example 1 - "the quick and cheap, only for list" #### */
void
traverse_store (GtkListStore *store)
{
gboolean valid;
valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL(store), &iter);
while( valid ){
/* do stuff as
gtk_tree_model_get (GTK_TREE_MODEL(store), &iter, ... )
*/
valid = gtk_tree_model_iter_next (GTK_TREE_MODEL(store), &iter);
}
}
/* ##### example 2 - "works for all" #### */
gboolean foreach_func (GtkTreeModel *model,
GtkTreePath *path,
GtkTreeIter *iter,
gpointer data)
{
// do stuff
if( want_to_stop )
return TRUE;
else // want to continue
return FALSE;
}
void
traverse_model (GtkTreeModel *model)
{
gtk_tree_model_foreach (model, foreach_func, NULL);
}
Hope this helps.
--
Iago Rubio
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]