Re: ext/libglade complete?

From: Date: Sun, 30 Oct 2005 19:36:20 +0000
Subject: Re: ext/libglade complete?
References: 1 2 3 4  Groups: php.gtk.dev 
Request: Send a blank email to php-gtk-dev+get-1995@lists.php.net to get a copy of this message
> We're all getting confused here, partly because I don't have Glade2 > installed yet, I think. When you talk about "object instance > specified via Glade ('button'3)", are you talking about a widget > named 'button3'? If so, it has nothing to do with what I suggested, > which is being able to easily connect a bunch of callbacks to methods > of a PHP object. Like this: > > class MyApp { > > function on_ok_clicked($button) { ... } > function on_notebook_switched_page($notebook, $page) { ... } > function on_destroy($widget) { ... } > > } > > $app = new MyApp(); > > $glade = new GladeXML($file); > $glade->signal_autoconnect_object($app); > > Now everything is connected to the methods of that object. Thing 1, which you won't know yet because you don't have the code handy, is there is no such thing as signal_autoconnect_object() in libglade now. signal_autoconnect() does it all. Thing 2 is that there's already a way to achieve this. I don't see what's so problematic about having a callback in the Glade file called 'MyApp::on_ok_clicked'... if you have some issue with the callbacks being public you can just move the whole lot, including the call to gtk::main(), inside the class and use self:: instead. What am I missing here? Thing 3 is that there's no precedent for that syntax. Doesn't mean it couldn't be done, but _should_ it be done? - personally I think not, given that you were right about the need for the optional array parameter to pass data. The main problems with the signal_autoconnect() function are the ones I'm working on addressing now. - Steph

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