I've posted an example of subclassing Gtk::Container that does not work, here:

http://pastebin.com/f1171f0ee

and here it is in plain text:

require 'gtk2'

class Foo < Gtk::Container
    type_register
    def initialize
        super()
        set_flags Gtk::Widget::NO_WINDOW
    end
    def add child
        # !! following code generates this warning: "Gtk-WARNING **:GtkContainerClass::add not implemented for `Foo'"
        child.parent = self
    end
    def size_allocate
        # this method should be called by gtk subsystem, but it isn't
        puts "called size_allocate"
    end
    def size_request
        # this method also should be called by gtk subsystem, but it isn't
        puts "called size_request"
    end
end

class App < Gtk::Window
    def initialize
        super()
        foo = Foo.new

        button = Gtk::Button.new("hello")
        foo.add button

        add foo
    end
end

app = App.new
app.show_all
Gtk.main


On 8/24/07, Guillaume Cottenceau <gcottenc@gmail.com> wrote:
On 8/20/07, wo boo <graablaa@gmail.com> wrote:
> When subclassing Gtk::Container I've found that overriding "abstract"
> methods seems to go unnoticed by the underlying gtk system...
>
> When I override Gtk::Container#add and do child.parent=self inside it I get
> this:
>
> /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:
> line 27
>    Gtk-WARNING **:GtkContainerClass::add not implemented for `FooTest'
>
> This message is generated by the "abstract" add method
> (gtk_container_add_unimplemented()) in gtkcontainer.c and
> it tells me that Ruby-GNOME2 has not updated these function pointers when I
> call type_register in the ruby class definition of FooTest.

Can you paste your FooTest code somewhere?

--
Guillaume Cottenceau - http://zarb.org/~gc/

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>   http://get.splunk.com/
_______________________________________________
ruby-gnome2-devel-en mailing list
ruby-gnome2-devel-en@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en