Re: GtkListStore usage



On Wed, Feb 12, 2003 at 09:11:38PM +0700, pclouds wrote:
> Hello
> 
> I would like to use GtkListStore in this way:
>  - Create GtkListStore with 1 column (G_TYPE_POINTER) 
>  - Register two functions get_value and set_value. When 
>    gtk_list_store_{get,set}_value is called, my {get,set}_value will be
>    called, returning a value from the object in column 1 (or generate
>    a value from the object), and set a value in the object, respectively.
>    "Registering" may be connecting to signal or setting a function pointer
>    in GtkListStore struct, ..
> 
>  * Or we can create GtkListStore with n+1 columns, and let GtkListStore
>    check data types instead of {get,set}_value.
>  - {get,set}_value contain a lot of switches to control each column data.
> 
> Is there a way to do this without modifying GtkListStore or implementing
> a new GtkTreeModel?
> 
> BTW, Gtk(2.0) uses gtktreedatalist to store a row. It would be better if 
> GtkListStore allows developer to use another type instead of gtktreedatalist
> when they want.

I don't understand this question - you're asking how to modify
GtkListStore or implement a custom model, without modifying
GtkListStore or implementing a custom model. As far as I can tell. ;-)

Maybe what you want to do is stuff a lot of structs in the list store
then have accessor functions to get at the fields in the structs, see 
gtk-demo for an example of doing that. The "stock browser" example may
do it if the tree view example doesn't.

Havoc



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