How to use CellRendererPixbuf



Hi all.

I want one of the columns of my TreeView to be a toggle-able icon - just like a button with several 
states. I set CellRendererPixbuf as a renderer for this column, but can't figure out how to set pixbuf for 
it. I added stock Gtk::Image to the xml using glade. I use the code I have put below:

CellRendererPixbuf* r = new Gtk::CellRendererPixbuf;
int cnt = tree_downloads->append_column("",  *r);
TreeViewColumn* c = tree_downloads->get_column(cnt - 1);
r->property_pixbuf().set_value(ia->get_pixbuf());

The last line produces the error:

(f-manager.exe:4332): Gtk-CRITICAL **: gtk_image_get_pixbuf: assertion `image->storage_type == 
GTK_IMAGE_PIXBUF || image->storage_type == GTK_IMAGE_EMPTY' failed

Please help to configure CellRendererPixbuf properly. Can't find any docs on that stuff.

Thank you.





Я в Моем Мире - http://my.mail.ru/mail/kitovyj/



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