[gtk] - My image the Treeview column

Hi all,

   I need to display the images in the one of columns in the Treeview.
I have found this example
(http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-treev-pxbr\).

   But in this example are used the standard gnome icons:

   parent[$pixbuf] = Gtk::Stock::DIALOG_INFO

   I have tried to change code to:

    pixbuf = Gdk::Pixbuf.new('/home/demas/settings/awn_icons/emacs.png')
    parent[$pxbuf] = pixbuf

   but it doesn't work.

   How can I display images in the threeview column?

···

--
Posted via http://www.ruby-forum.com/\.

I think I have found the answer:

    user_renderer = Gtk::CellRendererPixbuf.new
    col = Gtk::TreeViewColumn.new
    col.title = "pic"
    col.pack_start(user_renderer, false)

    pixbuf = Gdk::Pixbuf.new('/home/demas/settings/awn_icons/emacs.png')
    user_renderer.set_pixbuf(pixbuf)

···

--
Posted via http://www.ruby-forum.com/.

Or better:

    iter = @store.append
    iter[0] = twi.message()
    iter[1] =
Gdk::Pixbuf.new('/home/demas/settings/awn_icons/emacs.png')

    ....

    user_renderer = Gtk::CellRendererPixbuf.new
    col = Gtk::TreeViewColumn.new
    col.title = "pic"
    col.pack_start(user_renderer, false)
    col.add_attribute(user_renderer, 'pixbuf', 1)

···

--
Posted via http://www.ruby-forum.com/.