On Fri, Feb 09, 2007 at 09:49:24AM +0100, David Nečas (Yeti) wrote:
> On Fri, Feb 09, 2007 at 02:48:19PM +0700, Hariyanto wrote:
> > I create model in treeview like this :
> >
> > GtkTreeModel *create_model_tw(gint ncol)
> > {
> > GtkListStore *model;
> >
> > if (ncol == 2)
> > model = gtk_list_store_new (NUM_COLUMNS,
> > G_TYPE_STRING,
> > G_TYPE_STRING);
> >
> > if (ncol == 3)
> > model = gtk_list_store_new (NUM_COLUMNS,
> > G_TYPE_STRING,
> > G_TYPE_STRING,
> > G_TYPE_STRING);
> >
> > ...
> >
> > Is there another way to make it more simple?
>
> If you need this kind of flexibility, it can be easier to
> use a G_TYPE_POINTER column and store just pointers to some
> some structs representing the rows to the GtkListStore.
Well, in a simple case like this when the model is uniform
and only the number of columns differs, you can also use
for-cycles (and gtk_list_store_newv() for creation).
Yeti
--
Whatever.
_______________________________________________
gtk-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtk-list