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:
http://ruby-gnome2.svn.sourceforge.net/viewvc/ruby-gnome2/ruby-gnome2/trunk/glib/src/rbgobj_typeinterface.c?revision=3776&view=markup
** 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
on 2010-06-20 11:33
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.