gtk_tree_model_iter_n_children (same gtkliststore) works in a file while not in another

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

gtk_tree_model_iter_n_children (same gtkliststore) works in a file while not in another

Colossus
Hi Tim,

I have a problem with gtk_tree_model_iter_n_children. Calling it from
the callback.c file where I declare the iter and the liststore:

callbacks.h:
GtkListStore *liststore;
GtkTreeIter iter;
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;

callbacks.c:
if ( liststore != NULL) gtk_list_store_clear ( liststore ); // it works

if (gtk_tree_model_iter_n_children (GTK_TREE_MODEL(liststore), NULL) >
0) gtk_window_set_title ( GTK_WINDOW (MainWindow) , path );

Here above it always returns 0; while calling from a file (zip.c)
where I create the liststore, attach it to the model of the treeview
it correctly returns the number of rows:

zip.c:
#include "callbacks.h"
liststore = gtk_list_store_new (1, G_TYPE_STRING );
        gtk_tree_view_set_model (GTK_TREE_VIEW (treeview1), GTK_TREE_MODEL
(liststore) );
some code to fill the liststore...
g_print ("ZipOutput: Number of rows: %d",
gtk_tree_model_iter_n_children (GTK_TREE_MODEL(liststore), NULL) );

Why this different behaviour ?
--
Colossus

Cpsed, a Linux OpenGL 3D scene editor
http://cpsed.sourceforge.net/

_______________________________________________
gtk-app-devel-list mailing list
[hidden email]
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list