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

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:

GtkListStore *liststore;
GtkTreeIter iter;
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;

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:

#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 ?

Cpsed, a Linux OpenGL 3D scene editor

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