Writing a custom TreeModel

Hi,
I’m trying to implement a custom TreeModel. My primary reason for doing
so is, that I don’t want to load all the data into a list/tree store,
but only want to load it when the view actually tries to access it. The
basic thing I tried was this:

class MyStore < GLib::Object
type_register # I don’t know if this is needed ?
include Gtk::TreeModel

def initialize
super()
# some stuff…
end

here I implement all the stuff from TreeModel.

end

Now there are a few problems:

  • including Gtk::TreeModel raises this: “in `append_features’: Not a
    subclass of GLib::Instantiatable (TypeError)”
    ** trying to track this down, I found the code that raises it:
    Ruby-GNOME 2 download | SourceForge.net
    ** it seems clear to me that this is raises (as the klass passed into
    interface_s_append_features is a class and not an object.
    GLib::Instantiatable is a ancestor of that class, but not of that
    class’s class)
  • Not including Gtk::TreeModel (or extending with it in the initializer)
    gives me runtime errors from gtk:
    ** GLib-GObject-WARNING **:invalid cast from MyStore' to GtkTreeModel’
    ** GLib-GObject-WARNING **:IA__g_object_new_valist: invalid object type
    MyStore' for value type GtkTreeModel’

Can anyone explain me what I’m missing? Or is there maybe no way to
write custom stores in ruby at all?
I already brought this up in IRC, but no response.

– niklas