Re: get interface pointer, how?




Ian> Specifically, GListStore is said to implement GtkTreeSortable.  So,
Ian> given a GListStore*, how do I get the GtkTreeSortable*?

Tommi> sortable = GTK_TREE_SORTABLE (store);

Thanks, that indeed works.

Tommi> It's almost like using objects in other languages, except that in
Tommi> C you need the explicit cast, like with widgets already.  That
Tommi> could be shortly mentioned in gtk tutorial, but I can't remember
Tommi> for sure.

I'm afraid you miss the point.  The solution you give is _not_ a cast;
it's a macro, and doesn't expand to a cast in the case of interfaces,
though it does in the case of objects.  I've read the tutorial, and known
about the syntax, but since it's explained away as just sugar for casts,
I didn't know applied in the interface case.

If interfaces come to play a large role in the API, they should get an
explicit mention in the tutorial.

Ian

-- 
Nothing can be explained to a stone.
Or to a stoned person, either.



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