Re: how create model use variable
- From: David Nečas (Yeti) <yeti physics muni cz>
- To: gtk-list gnome org
- Subject: Re: how create model use variable
- Date: Fri, 9 Feb 2007 09:49:24 +0100
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.
Yeti
--
Whatever.
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]