On Thu, Nov 24, 2011 at 04:30:25PM +0100, Rafał Krupiński wrote:
> How do I display list of custom objects in GtkTreeView?
> GtkTreeView takes GtkListStore as a model, but it doesn't allow custom
> objects, only list of gobjects.
> 
> On the other hand, when I want to read list's selection all I get is
> the GtkListStore model - list of gobjets and I have to figure out the
> actual domain object the data comes from.
> 
> I thought of adding a hidden column with some id, but maybe there is a
> better solution?

What are you talking about?  You can pass any GObject-derived type as
the column type (not that it matters much, the net result is the same as
passing G_TYPE_OBJECT).  You get back the objects that you stored there.

If you store objects of different classes to the same column and want to
know the precise type use RTTI: type macros such as MY_IS_FOO(),
G_TYPE_FROM_INSTANCE(), g_type_is_a(), etc.

Yeti

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to