G
Guido de Melo
Hallo ruby users,
I' writing a tool to display bibliographical data in columns and I want to
employ glade for the first time. My display gets built with the source
below, but I don't get any columns. Can someone please comment?
Thanks
Guido
#!/usr/bin/ruby
require 'libglade2'
class Rbib
def initialize(path)
@glade = GladeXML.new(path) {|handler| method(handler)}
@view = @glade.get_widget("treeview1")
# key, title, name, year, rank, category
@liststore = Gtk::ListStore.new(String, String, String, String, String, String, String)
iter = @liststore.append
iter[0] = "key"
iter[1] = "title"
iter[2] = "name"
iter[3] = "year"
iter[4] = "rank"
iter[5] = "category"
%w{key title name year rank category}.each_with_index do |title, i|
col = Gtk::TreeViewColumn.new(title, Gtk::CellRendererText.new, {:text => 0})
@view.append_column(col)
end
end
# just do simple stuff for now
def on_quit
Gtk.main_quit
end
end
Gnome:rogram.new("test", "0.1")
Rbib.new(File.dirname($0) + "/test.glade")
Gtk.main
I' writing a tool to display bibliographical data in columns and I want to
employ glade for the first time. My display gets built with the source
below, but I don't get any columns. Can someone please comment?
Thanks
Guido
#!/usr/bin/ruby
require 'libglade2'
class Rbib
def initialize(path)
@glade = GladeXML.new(path) {|handler| method(handler)}
@view = @glade.get_widget("treeview1")
# key, title, name, year, rank, category
@liststore = Gtk::ListStore.new(String, String, String, String, String, String, String)
iter = @liststore.append
iter[0] = "key"
iter[1] = "title"
iter[2] = "name"
iter[3] = "year"
iter[4] = "rank"
iter[5] = "category"
%w{key title name year rank category}.each_with_index do |title, i|
col = Gtk::TreeViewColumn.new(title, Gtk::CellRendererText.new, {:text => 0})
@view.append_column(col)
end
end
# just do simple stuff for now
def on_quit
Gtk.main_quit
end
end
Gnome:rogram.new("test", "0.1")
Rbib.new(File.dirname($0) + "/test.glade")
Gtk.main