GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Thu Aug 25, 2016 4:41 pm

All times are UTC

Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: GTK/C treview/listview question
PostPosted: Sat May 31, 2008 6:45 pm 
GTK+ Geek

Joined: Sat May 10, 2008 1:52 pm
Posts: 54
I can find out the number of row in a treview/listview by walkin through it.

I am trying to find a call that will directly return the number of rows in the treview.

Any idea?

 Post subject:
PostPosted: Sun Jun 01, 2008 12:09 am 
Never Seen the Sunlight

Joined: Thu Jun 14, 2007 11:02 pm
Posts: 923
Location: Falun, WI USA
I don't know of any direct call to get the number of rows,
but you might want to write one yourself that you could reuse if you're doing this often,
something like this:
#include <gtk/gtk.h>

static gboolean _gtk_tree_model_get_n_rows_foreach(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
   gint *i;

   i = (gint*)data;

   return FALSE;

gint gtk_tree_model_get_n_rows(GtkTreeModel *model)
   gint ret;

   ret = 0;
   gtk_tree_model_foreach(model, _gtk_tree_model_get_n_rows_foreach, (gpointer)&ret);

   return ret;

of course, it doesn't have to hijack the gtk_ namespace, it could be called anything you want...

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC

Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group