Re: libglade connections
| From: | Andrei Zmievski | Date: | Mon, 07 Nov 2005 18:37:42 +0000 |
| Subject: | Re: libglade connections | ||
| References: | 1 2 3 4 5 | Groups: | php.gtk.dev |
| Request: | Send a blank email to php-gtk-dev+get-2069@lists.php.net to get a copy of this message | ||
Hey,
I don't have time to research it right now. But I had an idea for another type of signal connection, if you actually wanted to connect to a method of a Glade object. Suppose you have a button called 'button1' which is inside a window called 'window1'. And you wanted to connect button1's "clicked" signal so that it invokes window1's destroy() method. In regular PHP-GTK you would do:
$button->connect_simple('clicked', array($window, 'destroy'));
In Glade I think we can do it by specifying the handler as "window1->destroy". I can easily write code to parse this and connect things properly. But here we do need to differentiate between simple and normal connections (or even replaced ones), so prefixing it with something may be useful.
-Andrei
On Nov 7, 2005, at 1:54 AM, Steph Fox wrote:
Hey Andrei, OK, I tried to think of one example when a calling object might need to be carried as part of the signal to a _static_ function or method, and I honestly can't. Heck, Glade 2 doesn't even allow for it, and I can't think of anywhere GTK+ does either, and this is a wrapper around libglade _as it exists_, not as it may be in the future. Where the calling object's passed to the callback with the signal, it's never a static call. How could it be? How could you have $window->Gtk::main()? You might have a callback like GtkContainer::do_stuff($container), but that's catered for... If you (or anyone?) can come up with any serious examples that render those arguments invalid, please do so and I'll revert (albeit unhappily, because I think the existing solution's a good one). Remember, this doesn't affect static methods belonging to classes created in user space - it's purely about internal class methods. - Steph ----- Original Message ----- From: "Andrei Zmievski" <andrei@gravitonic.com> To: "Steph Fox" <steph@zend.com> Cc: "PHP-GTK dev" <php-gtk-dev@lists.php.net> Sent: Sunday, November 06, 2005 9:15 PM Subject: Re: [PHP-GTK-DEV] libglade connections"640k should be enough for everybody" -Andrei On Nov 5, 2005, at 10:47 AM, Steph Fox wrote:There should never be any... put it this way, there never have been. ----- Original Message ----- From: "Andrei Zmievski" <andrei@gravitonic.com> To: "Steph Fox" <steph@zend.com> Cc: "PHP-GTK dev" <php-gtk-dev@lists.php.net> Sent: Saturday, November 05, 2005 6:40 PM Subject: Re: [PHP-GTK-DEV] libglade connectionsBah, thanks for consulting me too. This is not as simple as it looks. Can you guarantee that any internal class method that .glade file may wish to connect to will need only simple connection? What if there are methods that actually need to have the signal widget? -Andrei On Nov 5, 2005, at 10:22 AM, Steph Fox wrote:-- PHP-GTK Development Mailing List (http://gtk.php.net/) To unsubscribe, visit: http://www.php.net/unsub.phpThanks to the irc gang (Rob, Wez, Derick), the need for a tag just left the building. All systems go :) ----- Original Message ----- From: "Steph Fox" <steph@zend.com> To: "Andrei" <andrei@gravitonic.com> Cc: "PHP-GTK dev" <php-gtk-dev@lists.php.net> Sent: Saturday, November 05, 2005 4:08 PM Subject: Fw: [PHP-GTK-DEV] libglade connectionsps signal_autoconnect_instance() is brilliant :) The only remaining problem's having to tag those statics, we shouldn'tneedto do that. ----- Original Message ----- From: "Steph Fox" <steph@zend.com> To: "Andrei" <andrei@gravitonic.com> Cc: "PHP-GTK dev" <php-gtk-dev@lists.php.net> Sent: Saturday, November 05, 2005 3:59 PM Subject: Fw: [PHP-GTK-DEV] libglade connectionsOK, crash gorn. Statics still weird. I don't get the '-' reference... ----- Original Message ----- From: "Steph Fox" <steph@zend.com> To: "Andrei" <andrei@gravitonic.com> Cc: "PHP-GTK dev" <php-gtk-dev@lists.php.net> Sent: Saturday, November 05, 2005 3:25 PM Subject: [PHP-GTK-DEV] libglade connections-- PHP-GTK Development Mailing List (http://gtk.php.net/) To unsubscribe, visit: http://www.php.net/unsub.phpAndrei, I just tested some of the changes using a bog-standard no-clever-object-business test script. signal_autoconnect() works for everything except static calls (i.e. gtk::main_quit doesn't work anymore),no leaks, congrats (but can we have our static support back please? -sinceGlade actually encourages it. At present it's seen as a straight connect() - it needs to go as connect_simple()). signal_connect() crashes whatever you try to do to it, haven'tinvestigatedwhy yet. Mind if I play? - Steph -- PHP-GTK Development Mailing List (http://gtk.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php-- PHP-GTK Development Mailing List (http://gtk.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php