[Geany] Plugin Events

Nick Treleaven nick.treleaven at xxxxx
Fri Aug 10 16:28:42 UTC 2007


On 08/09/2007 05:29:28 PM, Nick Treleaven wrote:
> On 08/09/2007 04:54:31 PM, blackdog wrote:
> > 
> > yep that sounds ok. if I can get a per char event
> > I'm happy don't care how it's done.
> > 
> OK, I'll add the new-document signal then.
> 
I've now committed the plugin signals code to SVN. Added signal names 
are:
"document-new"
"document-open"
"document-save"

You'll need to connect both "document-new" and "document-open". They 
are sent after all the document fields are set, including filetype. So 
it should be possible to connect to doc_list[idx].sci in the callbacks, 
only when doc_list[idx].file_type is Haxe.

I added the geany_callbacks array (see the attachment) so that Geany 
can disconnect the callbacks when the plugin is unloaded. Note that if 
you're connecting to sci-notify I think you will need to keep track of 
the result of g_signal_connect, so you can disconnect it in cleanup(). 
Otherwise the callback will probably segfault after the plugin is 
unloaded. (In future users will be able to easily load and unload 
plugins without restarting.)

Attached is a simple plugin I used to test it. (The init and cleanup 
parts are not really necessary, just so it was clear the plugin was 
loaded).

Regards,
Nick

-------------- next part --------------
A non-text attachment was scrubbed...
Name: sigtest.c
Type: text/x-csrc
Size: 2428 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/users/attachments/20070810/2b435637/attachment.c>


More information about the Users mailing list