Gtk2: trouble with gtk_tree_view()



*** Gtk2: trouble with gtk_tree_view() ***

In Gtk documentation, section 'Common Questions' i've read it's
possible to put a pixmap renderer and a text renderer into the
same tree view column. But i have a conflict:

treeView->model=gtk_tree_store_new(1, G_TYPE_STRING);

This results a GObject Warnig like "unable to set property
'pixbuf' of type 'gchararray'".

Cause there is no G_TYPE_PIXBUF, for both types i tried:

treeView->model=gtk_tree_store_new(1, G_TYPE_OBJECT);

GObject Warnig: unable to set property 'text'.....

Is there any G_TYPE that can handle with pixbuf and text in the
same tree view model? Have found nothing in Gtk API reference.

Last my try to display a 'test icon' in the tree view:

treeView->icon=gtk_image_new_from_stock(GTK_STOCK_OPEN,
                                GTK_ICON_SIZE_SMALL_TOOLBAR);

gtk_tree_view_column_set_attributes(treeView->column,
                                treeView->icon_cell,
                                "pixbuf",
                                0, GDK_PIXBUF(treeView->icon),
                        /*      "pixbuf-expander-open",
                                0, treeView->icon,
                                "pixbuf-expander-closed",
                                0, treeView->icon, */
                                NULL);

This is very buggy (My first try to create a tree view). so i
have some questions about this:

Do i need to set all properties for this pixbuf part of column?
Which ones are necessary to set? What is with gtk_image_new()?
Is that possible or do i need a real GdkPixbuf? And if yes: How
can i put a stock icon to a GdkPixbuf?

Mathew




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