This method is deprecated or moved on the latest stable version.
The last existing version (v1_9_2_180) is shown here.
add_item(label, keyval = nil, klass = MenuItem, &callback)
public
Adds a Gtk::MenuItem to this instance’s #menu. label is the
label string, klass is the item type, and callback is the
procedure, that is called if the item is activated.
# File ext/json/lib/json/editor.rb, line 231
def add_item(label, keyval = nil, klass = MenuItem, &callback)
label = "#{label} (C-#{keyval.chr})" if keyval
item = klass.new(label)
item.signal_connect(:activate, &callback)
if keyval
self.signal_connect(:'key-press-event') do |item, event|
if event.state & Gdk::Window::ModifierType::CONTROL_MASK != 0 and
event.keyval == keyval
callback.call item
end
end
end
menu.append item
item
end