Re: Treeview Row Count
- From: Tadej BorovÅak <tadeboro gmail com>
- To: dhk <dhkuhl optonline net>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Treeview Row Count
- Date: Thu, 24 Sep 2009 13:32:30 +0200
Hello.
Is there a function to give the number of rows in a treeview?
You probably want to know how many lines are in the GtkTreeModel that
serves as data source for GtkTreeView. There is no simple function
that would serve you this number, so you'll have to take one of the
two available paths:
1) maintain number of rows externally by increasing/decreasing it on
additions/removals
2) traverse the whole model and count the lines
If you go with second option, gtk_tree_model_foreach function may be
of help. Sample counter would look like this:
---- CODE ----
...
gint no_rows = 0;
gtk_tree_model_foreach( model, (GtkTreeModelForeachFunc)count, &no_rows );
...
static gboolean
count( GtkTreeModel *model,
GtkTreePath *path,
GtkTreeIter *iter,
gint *no_rows )
{
*no_rows+;
return( FALSE );
}
---- CODE ----
Tadej
--
Tadej BorovÅak
tadeboro.blogspot.com
tadeboro gmail com
tadej borovsak gmail com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]