def initialize
super(true, "testGNOME", "Icon List")
sw = Gtk::ScrolledWindow.new(nil, nil)
sw.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
self.contents = sw
sw.set_size_request(430, 300)
sw.show()
iconlist = Gnome::IconList.new(80, nil, Gnome::IconList::IS_EDITABLE)
sw.add(iconlist)
iconlist.signal_connect("select_icon") do |gii, n, event|
printf("Icon %d selected", n)
if (event)
printf(" with event type %d\n", event.event_type)
else
printf("\n")
end
end
iconlist.signal_connect("unselect_icon") do |gii, n, event|
printf("Icon %d unselected", n)
if (event)
printf(" with event type %d\n", event.event_type)
else
printf("\n")
end
end
iconlist.set_property(:can_focus, true)
pix = Gdk::Pixbuf.new(File.dirname(__FILE__) + '/bomb.xpm')
iconlist.grab_focus()
iconlist.freeze()
30.times do
iconlist.append_pixbuf(pix, "bomb.xpm", "Foo")
iconlist.append_pixbuf(pix, "bomb.xpm", "Bar")
iconlist.append_pixbuf(pix, "bomb.xpm", "LaLa")
end
iconlist.append("non-existant.png", "No Icon")
iconlist.selection_mode = Gtk::SELECTION_MULTIPLE
iconlist.thaw()
iconlist.show()
self.show()
end