callback registry code - working - needs review...
| From: | Alan Knowles | Date: | Tue, 01 Jul 2003 03:24:32 +0000 |
| Subject: | callback registry code - working - needs review... | ||
| Groups: | php.gtk.dev | ||
| Request: | Send a blank email to php-gtk-dev+get-493@lists.php.net to get a copy of this message | ||
ok, with a bit of help from free(1) and gdb, I finaly worked out how to
get it working..
The first part of the patch illustrates it's usage in gtkextra to handle
callbacks for traverse, which has 2 pointers to integers which would
normally just be blank using the standard callback handlers.
The example does raise an interesting issue, as 2 of the arguments are
Read/Write, but I've no idea how to deal with fetching their values at
the end of the function call..
To define a module specific callback
a) define the C code to recieve the data
- convert the arguments into a Hash array.
- call php_gtk_simple_signal_callback with the right values..
b) add a line
php_gtk_register_callback(
"GtkSheet::traverse",
(GtkSignalFunc) php_gtk_sheet_callback_traverse);
to the initialization section of the module.
The patch
a) replaces the standard gtk_signal_connect_impl with a method that
checks the registry before assigning the handler.
b) registers an extra global hash table to store the registry.
c) provides a php_simple_signal_callback to do all the hard work of
guessing the callback and handling any user data.
Let me know if you can find any obvious mistakes, like not freeing
memory (very likely)..
Regards
Alan
--
Can you help out?
Need Consulting Services or Know of a Job?
http://www.akbkhome.com