[Mono-list] Use stock icon in GTK treeview?
Steven F.
willywilly at guerrillamailblock.com
Tue Jun 16 03:21:40 EDT 2009
Maybe let me rephrase that.
I want to insert a Gtk stock icon into a Gtk treeview. For that to work, I
must somehow create a Pixbuf from a stock icon, since Gtk treeview only
takes Pixbufs. What I tried in my first post did not work for reasons
unknown.
I believe these posts try something similar, but it was done in Python, not
Mono.
http://faq.pygtk.org/index.py?req=show&file=faq13.006.htp
It is using Gtk::CellRendererPixbuf
http://www.gtkmm.org/docs/gtkmm-2.4/docs/reference/html/classGtk_1_1CellRendererPixbuf.html
All the pieces are there, I am just unable to complete the puzzle. :/
Steven F. wrote:
>
> Here is what I think should work:
> Gtk.ListStore logStore = new Gtk.ListStore (typeof (Gdk.Pixbuf), typeof
> (string));
> Gtk.Image icon = new Gtk.Image(Stock.Cdrom, IconSize.Dialog);
> iconPixbuf = icon.Pixbuf;
> logStore.AppendValues (iconPixbuf, "Testing");
>
> Sadly, this gives me a warning at runtime:
> Gtk-CRITICAL **: gtk_image_get_pixbuf: assertion `image->storage_type ==
> GTK_IMAGE_PIXBUF || image->storage_type == GTK_IMAGE_EMPTY' failed
>
-----
We learn something every day, and lots of times it's that what we learned the
day before was wrong. - Bill Vaughan
--
View this message in context: http://www.nabble.com/Use-stock-icon-in-GTK-treeview--tp24025993p24049041.html
Sent from the Mono - General mailing list archive at Nabble.com.
More information about the Mono-list
mailing list