TreeModel, again

I’ve been reading everything I can on implementing a TreeModel in Ruby.
Seems it can’t be done at the moment.

It looks like PyGTK has a GenericTreeModel that can be inherited from
and implemented. I’ve been wondering what it would take to do something
like this in ruby-gtk?

bye
John


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys – and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

On Tue, 2006-08-01 at 08:34 +0200, John A. wrote:

I’ve been reading everything I can on implementing a TreeModel in Ruby.
Seems it can’t be done at the moment.

It looks like PyGTK has a GenericTreeModel that can be inherited from
and implemented. I’ve been wondering what it would take to do something
like this in ruby-gtk?

I’ve been thinking about this - seems like it would be possible to
create a ruby class (in c), the methods of which would be called by
implementations of the various c functions required for a TreeModel.
TreeIter structures might cause some problems though.

I’d like to start writing some code to do this, so please let me know if
I’m on the wrong track.

bye
John


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys – and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys – and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

On Wed, 2006-08-02 at 16:45 +0300, Dobai-Pataky B. wrote:

http://ruby-gnome2.sourceforge.jp/hiki.cgi?cmd=view&p=Gtk%3A%
3ATreeModel&key=treemodel
module Gtk::TreeModel is not what you want?

It’s exactly what I want. But this

class OtherModel < Gtk::TreeModel
end

doesn’t work because TreeModel is a module not a class. Neither does

class OtherModel < GLib::Object
include Gtk::TreeModel
type_register
end

because = <<EOF
TypeError: Not a subclass of GLib::Instantiatable
from (irb):9:in `append_features’
from (irb):9
EOF

And looking through the archives for the list the last few questions
along these lines were answered in the negative.

So, I’d be very happy if you knew of some way of implementing TreeModel
in Ruby only - then I wouldn’t have to go and write a bunch of c code,
for which a grumpy and pedantic state of mind is necessary :wink:

bye
John


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys – and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys – and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

On Wed, 2006-08-02 at 19:00 +0300, Dobai-Pataky B. wrote:

i see `append_features’ is missing from GLib::OBject, so it can’t
include Gtk::TreeModel
i just ran a
grep -r append_features //usr/lib/ruby/site_ruby/
Binary file //usr/lib/ruby/site_ruby/1.8/i686-linux/glib2.so matches

so i guess you should look at the sources to find out how
Gtk::TreeModel was included in Gtk::TreeStore
http://ruby-gnome2.sourceforge.jp/hiki.cgi?Gtk%3A%3ATreeStore
it should be easier than writing that c code :wink:

OK, so what I think I’ve discovered ( after a couple of hours spelunking
the sources, and a few minutes reading the developer docs :expressionless: ) is that
TreeStore includes TreeModel because it’s hooked up that way in the gtk
sources, and then code in glib/src figures out those relationships.

So what I would really like to know for now is this: is writing the code
for a TreeModel that can be implemented in Ruby Really Hard™, or is
it just that nobody’s gotten around to it yet?

bye
John


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys – and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV