[Bug?] Tree insert

Hi,

i have some trouble with Gtk::TreeStore.insert

The following little example works like it should.

require ‘gtk2’

class Win
def initialize
win = Gtk::Window.new
win.set_default_size 400, 200

@model = Gtk::TreeStore.new String, String, String
view = Gtk::TreeView.new @model
view.headers_visible = true
view.reorderable = false
view.selection.mode = Gtk::SelectionMode::SINGLE

view_headers = ['one', 'two', 'three']
0.upto(2) do |i|
  renderer = Gtk::CellRendererText.new
  column = Gtk::TreeViewColumn.new view_headers[i], renderer, :text

=> i
view.append_column column
end

10.times do |i|
  make_row "first #{i}", "second #{i}", "third #{i}", i
end

win.add view
win.show_all

end

def make_row first, second, third, i
iter = @model.append @head_iter
if @head_iter.nil?
iter.set_value 0, first
else
iter.set_value 1, second
iter.set_value 2, third
end

@head_iter = iter if @head_iter.nil?

end
end

win = Win.new
Gtk.main

but if i change the row

iter = @model.append @head_iter

to

iter = @model.insert nil, i

it throws this error message:

tree.rb:30:in insert': Fixnum isn't supported (TypeError) from tree.rb:30:inmake_row’
from tree.rb:22:in initialize' from tree.rb:21:intimes’
from tree.rb:21:in initialize' from tree.rb:42:innew’
from tree.rb:42

Afaik this is a bug. Can someone confirm (and fix) it? I’ve looked at
the sources, but could not found any errors.

Cheers, detlef

Hi! Not tested, just compared to the docs, but insert needs 3
parameters. Am I wrong?

http://ruby-gnome2.sourceforge.jp/hiki.cgi?Gtk%3A%3ATreeStore#insert

the sources, but could not found any errors.
ruby-gnome2-devel-en mailing list
[email protected]
ruby-gnome2-devel-en List Signup and Options


±[ Gergely K. [email protected] ]------------------+
| |
| Mobile:(+36 20)356 9656 |
| |
± “Olyan lángész vagyok, hogy poroltóval kellene járnom!” -+

Hoops, 2 insert methods :open_mouth: With the same anchor. One of them has 2
parameters. Sorry, overlooked.

On Feb 11, 2008 9:59 PM, KONTRA, Gergely [email protected] wrote:

    from tree.rb:42:in `new'


±[ Gergely K. [email protected] ]------------------+
| |
| Mobile:(+36 20)356 9656 |
| |
± “Olyan lángész vagyok, hogy poroltóval kellene járnom!” -+


±[ Gergely K. [email protected] ]------------------+
| |
| Mobile:(+36 20)356 9656 |
| |
± “Olyan lángész vagyok, hogy poroltóval kellene járnom!” -+