GtkBuilder does not call __construct() for custom widgets

From: Date: Tue, 13 Oct 2009 11:44:12 +0000
Subject: GtkBuilder does not call __construct() for custom widgets
Groups: php.gtk.dev 
Request: Send a blank email to php-gtk-dev+get-4359@lists.php.net to get a copy of this message
Hi, I'm trying to add custom php-gtk widgets to glade-3 - I've compiled a php with the embed sapi and linked it with a library of my own which includes the php code. - added the .so to the glade path - added the needed catalogue files It seems to be ok with glade but there is a major problem: GtkBuilder creates the php-gtk Derived objects but does not call their constructor (their __construct() method in php) check this code: <?php class MyWin extends GtkWindow { public function __construct() { echo "MyWin::__construct(): constructor called\n"; parent::__construct(); } } GObject::register_type('MyWin'); $xml = '<interface><object class="MyWin" id="window1"></object></interface>'; $builder = new GtkBuilder(); $builder->add_from_string($xml); $win = $builder->get_object('window1'); $win->connect_simple('destroy', array('Gtk', 'main_quit')); $win->show_all(); Gtk::main(); ?> no conctructor is called Same thing works in pygtk: import gtk class MyWin(gtk.Window): __gtype_name__ = 'MyWin' def __init__(self): print "MyWin.__init__(): constructor called" super(MyWin, self).__init__() xml = '<interface><object class="MyWin" id="window1"></object></interface>' builder = gtk.Builder() builder.add_from_string(xml) win = builder.get_object('window1') win.connect('destroy', gtk.main_quit) win.show_all() gtk.main() Isn't this a bug? I have tried to check it from the php-gtk code but I don't know zend so I can't do much. Con

« previous php.gtk.dev (#4359) next »