CList in Ruby-Gnome2?

Hello,

Does Gnome2 no longer have CList?
What’s the easiest way to get a list widget in Gnome2? The simplest I’ve
managed to write uses TreeView:

---------------- tree.rb -------------

···

Create the TreeStore and TreeView.

tree = Gtk::TreeStore.new( String )
render = Gtk::CellRendererText.new
column = Gtk::TreeViewColumn.new( “Contacts”, render, {:text => 0} )
tree_view = Gtk::TreeView.new( tree )
tree_view.append_column( column )
window.add( tree_view )

Build tree.

jeffrey = tree.append(nil).set_value( 0, “Jeffrey” )
melissa = tree.append(nil).set_value( 0, “Melissa” )
sandy = tree.append(nil).set_value( 0, “Sandy” )

Is this the simplest it gets? Because it’s not very simple. I’d like to
see a list-type widget which could be used somwhat like this:

list = Gtk::CList
window.add(list)

jeffrey = list.append( “Jeffrey” )
melissa = list.append( “Melissa” )
sandy = list.append( “Sandy” )

That would be a lot nicer. Is there any such widget? I can’t find any in
the documentation, but I can’t believe that Gtk+2 doesn’t have a list
widget.

Any help would be appreciated.


Daniel Carrera
Graduate Teaching Assistant. Math Dept.
University of Maryland. (301) 405-5137

Hi,

Hello,

Does Gnome2 no longer have CList?

Yes. Ruby-GNOME2 doesn’t support the obsolete classes/methods.
Check Hello World in Ruby-GNOME2.

What’s the easiest way to get a list widget in Gnome2? The simplest I’ve
managed to write uses TreeView:

---------------- tree.rb -------------

Create the TreeStore and TreeView.

tree = Gtk::TreeStore.new( String )

It is better to use Gtk::ListStore here.

···

On Thu, 20 Feb 2003 14:06:29 +0900 Daniel Carrera dcarrera@math.umd.edu wrote:

render = Gtk::CellRendererText.new
column = Gtk::TreeViewColumn.new( “Contacts”, render, {:text => 0} )
tree_view = Gtk::TreeView.new( tree )
tree_view.append_column( column )
window.add( tree_view )

Build tree.

jeffrey = tree.append(nil).set_value( 0, “Jeffrey” )
melissa = tree.append(nil).set_value( 0, “Melissa” )
sandy = tree.append(nil).set_value( 0, “Sandy” )

Is this the simplest it gets? Because it’s not very simple. I’d like to
see a list-type widget which could be used somwhat like this:

list = Gtk::CList
window.add(list)

jeffrey = list.append( “Jeffrey” )
melissa = list.append( “Melissa” )
sandy = list.append( “Sandy” )


require ‘gtk2’

Gtk.init
module Gtk
class CList < TreeView
def initialize(title)
super(Gtk::ListStore.new(String))
append_column(Gtk::TreeViewColumn.new(title,
Gtk::CellRendererText.new(),
:text => 0))
end
def append(text)
model.append.set_value(0, text)
end
end
end

list = Gtk::CList.new(“Contacts”)

jeffrey = list.append( “Jeffrey” )
melissa = list.append( “Melissa” )
sandy = list.append( “Sandy” )

Gtk::Window.new.add(list).show_all
Gtk.main

That would be a lot nicer.

I don’t think so. It may be the simplest but not flexible.

Is there any such widget? I can’t find any in
the documentation, but I can’t believe that Gtk+2 doesn’t have a list
widget.

See http://developer.gnome.org/doc/API/2.0/gtk/TreeWidgetObjects.html


.:% Masao Mutohmutoh@highway.ne.jp